Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ function updateMethodParameter(
operationHttpParameter: SdkHttpParameter | SdkModelPropertyType,
rootApiVersions: string[],
): void {
// for content type parameter
if (isContentType(operationHttpParameter)) {
methodParameter.type = fromSdkType(
sdkContext,
operationHttpParameter.type,
operationHttpParameter,
);
}
methodParameter.serializedName = getNameInRequest(operationHttpParameter);
methodParameter.location = getParameterLocation(operationHttpParameter);
methodParameter.scope = getParameterScope(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ function createEnumType(
crossLanguageDefinitionId: sdkType.kind === "enum" ? sdkType.crossLanguageDefinitionId : "",
valueType:
sdkType.kind === "enum"
? (fromSdkType(sdkContext, sdkType.valueType) as InputPrimitiveType)
? fromSdkType(sdkContext, sdkType.valueType)
: fromSdkBuiltInType(sdkContext, sdkType.valueType),
values: values,
// constantType.access, TODO - constant type now does not have access. TCGC will add it later
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,14 @@ describe("Operation Converter", () => {
const method = root.clients[0].methods[0];
ok(method);

const contentTypeMethodParam = method.parameters.find((p) => p.name === "contentType");
ok(contentTypeMethodParam, "Content-Type parameter should exist in service method");
strictEqual(
contentTypeMethodParam.type.kind,
"constant",
"Content-type should remain a constant type, not transformed to enum",
);

// validate operation
const operation = method.operation;
ok(operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4717,7 +4717,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "90"
"$ref": "86"
},
"location": "Header",
"isApiVersion": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2278,7 +2278,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "21"
"$ref": "19"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -2398,7 +2398,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "25"
"$ref": "23"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -2519,7 +2519,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "29"
"$ref": "27"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -2641,7 +2641,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "33"
"$ref": "31"
},
"location": "Header",
"isApiVersion": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "9"
"$ref": "5"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -1033,7 +1033,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "15"
"$ref": "11"
},
"location": "Header",
"isApiVersion": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "3"
"$ref": "1"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -480,7 +480,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "11"
"$ref": "9"
},
"location": "Header",
"isApiVersion": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "5"
"$ref": "3"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -2198,7 +2198,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "9"
"$ref": "7"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -2312,7 +2312,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "13"
"$ref": "11"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -2426,7 +2426,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "17"
"$ref": "15"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -2540,7 +2540,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "21"
"$ref": "19"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -2654,7 +2654,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "25"
"$ref": "23"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -2768,7 +2768,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "29"
"$ref": "27"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -2882,7 +2882,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "33"
"$ref": "31"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -2996,7 +2996,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "37"
"$ref": "35"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -3157,7 +3157,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "41"
"$ref": "39"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -3318,7 +3318,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "45"
"$ref": "43"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -3432,7 +3432,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "49"
"$ref": "47"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -3546,7 +3546,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "53"
"$ref": "51"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -3708,7 +3708,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "57"
"$ref": "55"
},
"location": "Header",
"isApiVersion": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "20"
"$ref": "18"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -674,7 +674,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "24"
"$ref": "22"
},
"location": "Header",
"isApiVersion": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "16"
"$ref": "14"
},
"location": "Header",
"isApiVersion": false,
Expand Down Expand Up @@ -560,7 +560,7 @@
"name": "contentType",
"serializedName": "Content-Type",
"type": {
"$ref": "20"
"$ref": "18"
},
"location": "Header",
"isApiVersion": false,
Expand Down
Loading