@@ -67,7 +67,6 @@ import {
67
67
getHttpOperationWithCache ,
68
68
getWireName ,
69
69
isApiVersion ,
70
- isInternal ,
71
70
isSdkBuiltInKind ,
72
71
isSdkIntKind ,
73
72
listClients ,
@@ -116,10 +115,8 @@ import {
116
115
Visibility ,
117
116
getAuthentication ,
118
117
getHeaderFieldName ,
119
- getHeaderFieldOptions ,
120
118
getPathParamName ,
121
119
getQueryParamName ,
122
- getQueryParamOptions ,
123
120
getServers ,
124
121
getStatusCodeDescription ,
125
122
isHeader ,
@@ -306,6 +303,7 @@ export class CodeModelBuilder {
306
303
} ,
307
304
} ,
308
305
extensions : {
306
+ // TODO: deprecate this logic of string/url for x-ms-skip-url-encoding
309
307
"x-ms-skip-url-encoding" : schema instanceof UriSchema ,
310
308
} ,
311
309
// // make the logic same as TCGC, which takes the server-side default of host as client-side default
@@ -401,14 +399,12 @@ export class CodeModelBuilder {
401
399
return ! this . options [ "flavor" ] || this . options [ "flavor" ] . toLocaleLowerCase ( ) === "azure" ;
402
400
}
403
401
404
- private isInternal ( context : SdkContext , operation : Operation ) : boolean {
402
+ private isInternal ( operation : Operation ) : boolean {
405
403
const access = getAccess ( operation ) ;
406
404
if ( access ) {
407
405
return access === "internal" ;
408
406
} else {
409
- // TODO: deprecate "internal"
410
- // eslint-disable-next-line deprecation/deprecation
411
- return isInternal ( context , operation ) ;
407
+ return false ;
412
408
}
413
409
}
414
410
@@ -759,7 +755,7 @@ export class CodeModelBuilder {
759
755
this . sdkContext ,
760
756
operation ,
761
757
) ;
762
- codeModelOperation . internalApi = this . isInternal ( this . sdkContext , operation ) ;
758
+ codeModelOperation . internalApi = this . isInternal ( operation ) ;
763
759
764
760
const convenienceApiName = this . getConvenienceApiName ( operation ) ;
765
761
let generateConvenienceApi : boolean = Boolean ( convenienceApiName ) ;
@@ -1072,14 +1068,22 @@ export class CodeModelBuilder {
1072
1068
schema = this . processSchemaFromSdkType ( sdkType , param . param . name ) ;
1073
1069
}
1074
1070
1075
- // skip-url-encoding
1076
1071
let extensions : { [ id : string ] : any } | undefined = undefined ;
1072
+ // skip-url-encoding
1073
+ if ( param . type === "path" ) {
1074
+ if ( param . allowReserved ) {
1075
+ extensions = extensions ?? { } ;
1076
+ extensions [ "x-ms-skip-url-encoding" ] = true ;
1077
+ }
1078
+ }
1079
+ // TODO: deprecate this logic of string/url for x-ms-skip-url-encoding
1077
1080
if (
1078
1081
( param . type === "query" || param . type === "path" ) &&
1079
1082
param . param . type . kind === "Scalar" &&
1080
1083
schema instanceof UriSchema
1081
1084
) {
1082
- extensions = { "x-ms-skip-url-encoding" : true } ;
1085
+ extensions = extensions ?? { } ;
1086
+ extensions [ "x-ms-skip-url-encoding" ] = true ;
1083
1087
}
1084
1088
1085
1089
if ( this . supportsAdvancedVersioning ( ) ) {
@@ -1096,9 +1100,8 @@ export class CodeModelBuilder {
1096
1100
let explode = undefined ;
1097
1101
if ( param . param . type . kind === "Model" && isArrayModelType ( this . program , param . param . type ) ) {
1098
1102
if ( param . type === "query" ) {
1099
- const queryParamOptions = getQueryParamOptions ( this . program , param . param ) ;
1100
1103
// eslint-disable-next-line deprecation/deprecation
1101
- const queryParamFormat = queryParamOptions ?. format ;
1104
+ const queryParamFormat = param ?. format ;
1102
1105
if ( queryParamFormat ) {
1103
1106
switch ( queryParamFormat ) {
1104
1107
case "csv" :
@@ -1128,17 +1131,16 @@ export class CodeModelBuilder {
1128
1131
}
1129
1132
}
1130
1133
} else if ( param . type === "header" ) {
1131
- const headerFieldOptions = getHeaderFieldOptions ( this . program , param . param ) ;
1132
- switch ( headerFieldOptions ?. format ) {
1133
- case "csv" :
1134
- style = SerializationStyle . Simple ;
1135
- break ;
1136
-
1137
- default :
1138
- if ( headerFieldOptions ?. format ) {
1139
- this . logWarning ( `Unrecognized header parameter format: '${ headerFieldOptions ?. format } '.` ) ;
1140
- }
1141
- break ;
1134
+ if ( param . format ) {
1135
+ switch ( param . format ) {
1136
+ case "csv" :
1137
+ style = SerializationStyle . Simple ;
1138
+ break ;
1139
+
1140
+ default :
1141
+ this . logWarning ( `Unrecognized header parameter format: '${ param . format } '.` ) ;
1142
+ break ;
1143
+ }
1142
1144
}
1143
1145
}
1144
1146
}
0 commit comments