Skip to content

Commit

Permalink
upgrade tsp compiler to 0.59 (#5003)
Browse files Browse the repository at this point in the history
Co-authored-by: Pan Shao <[email protected]>
  • Loading branch information
pshao25 and Pan Shao authored Aug 19, 2024
1 parent c77664b commit d00c2a0
Show file tree
Hide file tree
Showing 18 changed files with 248 additions and 346 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@autorest/openapi-to-typespec",
"comment": "Upgrade tsp compiler to 0.59",
"type": "patch"
}
],
"packageName": "@autorest/openapi-to-typespec"
}
298 changes: 154 additions & 144 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions packages/extensions/openapi-to-typespec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@
"@azure-tools/codegen": "~2.10.0",
"@autorest/extension-base": "~3.6.0",
"@autorest/codemodel": "~4.20.0",
"@typespec/compiler": "^0.58.0",
"@typespec/rest": "^0.58.0",
"@typespec/http": "^0.58.0",
"@typespec/versioning": "^0.58.0",
"@typespec/prettier-plugin-typespec": "^0.58.0",
"@azure-tools/typespec-azure-core": "^0.44.0",
"@azure-tools/typespec-autorest": "^0.44.0",
"@azure-tools/typespec-azure-resource-manager": "^0.44.0",
"@typespec/openapi": "^0.58.0",
"@typespec/openapi3": "^0.58.0",
"@typespec/compiler": "^0.59.0",
"@typespec/rest": "^0.59.0",
"@typespec/http": "^0.59.0",
"@typespec/versioning": "^0.59.0",
"@typespec/prettier-plugin-typespec": "^0.59.0",
"@azure-tools/typespec-azure-core": "^0.45.0",
"@azure-tools/typespec-autorest": "^0.45.0",
"@azure-tools/typespec-azure-resource-manager": "^0.45.0",
"@typespec/openapi": "^0.59.0",
"@typespec/openapi3": "^0.59.0",
"prettier": "~3.1.0",
"lodash": "~4.17.20",
"pluralize": "^8.0.0",
Expand All @@ -68,8 +68,8 @@
"fs-extra": "^10.1.0",
"@types/fs-extra": "^9.0.13",
"chalk": "^4.1.0",
"@azure-tools/typespec-autorest": "^0.44.0",
"@azure-tools/typespec-client-generator-core": "^0.44.0",
"@azure-tools/typespec-autorest": "^0.45.0",
"@azure-tools/typespec-client-generator-core": "^0.45.0",
"webpack-cli": "~5.1.4",
"webpack": "~5.89.0",
"@typescript-eslint/eslint-plugin": "^6.11.0",
Expand Down
23 changes: 17 additions & 6 deletions packages/extensions/openapi-to-typespec/src/utils/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,23 @@ export function getPropertyDecorators(element: Property | Parameter): TypespecDe
format = "tsv";
break;
}
locationDecorator.arguments = [
{
value: `{name: "${element.language.default.serializedName}", format: "${format}"}`,
options: { unwrap: true },
},
];
locationDecorator.arguments =
format === "multi"
? [
{
value: `#{ name: "${element.language.default.serializedName}", explode: true }`,
options: { unwrap: true },
},
]
: [
{
value:
format === "csv"
? `"${element.language.default.serializedName}"`
: `{name: "${element.language.default.serializedName}", format: "${format}"}`,
options: { unwrap: true },
},
];
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,37 +44,25 @@ interface DataManagerForAgricultureExtensions {
/**
* DataManagerForAgricultureExtension ids.
*/
@query({
name: "farmBeatsExtensionIds",
format: "multi",
})
@query(#{ name: "farmBeatsExtensionIds", explode: true })
farmBeatsExtensionIds?: string[];

/**
* DataManagerForAgriculture extension names.
*/
@query({
name: "farmBeatsExtensionNames",
format: "multi",
})
@query(#{ name: "farmBeatsExtensionNames", explode: true })
farmBeatsExtensionNames?: string[];

/**
* Extension categories.
*/
@query({
name: "extensionCategories",
format: "multi",
})
@query(#{ name: "extensionCategories", explode: true })
extensionCategories?: string[];

/**
* Publisher ids.
*/
@query({
name: "publisherIds",
format: "multi",
})
@query(#{ name: "publisherIds", explode: true })
publisherIds?: string[];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,13 @@ interface DataManagerForAgricultureSolutions {
/**
* Ids of Data Manager For Agriculture Solutions which the customer requests to fetch.
*/
@query({
name: "farmBeatsSolutionIds",
format: "multi",
})
@query(#{ name: "farmBeatsSolutionIds", explode: true })
farmBeatsSolutionIds?: string[];

/**
* Names of Data Manager For Agriculture Solutions which the customer requests to fetch.
*/
@query({
name: "farmBeatsSolutionNames",
format: "multi",
})
@query(#{ name: "farmBeatsSolutionNames", explode: true })
farmBeatsSolutionNames?: string[];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,13 @@ interface Extensions {
/**
* Installed extension ids.
*/
@query({
name: "extensionIds",
format: "multi",
})
@query(#{ name: "extensionIds", explode: true })
extensionIds?: string[];

/**
* Installed extension categories.
*/
@query({
name: "extensionCategories",
format: "multi",
})
@query(#{ name: "extensionCategories", explode: true })
extensionCategories?: string[];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,47 +56,32 @@ interface Solutions {
/**
* Installed Solution ids.
*/
@query({
name: "solutionIds",
format: "multi",
})
@query(#{ name: "solutionIds", explode: true })
solutionIds?: string[];

/**
* Ids of the resource.
*/
@query({
name: "ids",
format: "multi",
})
@query(#{ name: "ids", explode: true })
ids?: string[];

/**
* Names of the resource.
*/
@query({
name: "names",
format: "multi",
})
@query(#{ name: "names", explode: true })
names?: string[];

/**
* Filters on key-value pairs within the Properties object.
* eg. "{testKey} eq {testValue}".
*/
@query({
name: "propertyFilters",
format: "multi",
})
@query(#{ name: "propertyFilters", explode: true })
propertyFilters?: string[];

/**
* Statuses of the resource.
*/
@query({
name: "statuses",
format: "multi",
})
@query(#{ name: "statuses", explode: true })
statuses?: string[];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,19 @@ interface Applications {
/**
* Select the specified fields to be included in the response.
*/
@query({
name: "select",
format: "multi",
})
@query(#{ name: "select", explode: true })
select?: string[];

/**
* Expand the indicated resources into the response.
*/
@query({
name: "expand",
format: "multi",
})
@query(#{ name: "expand", explode: true })
expand?: string[];

/**
* Expressions that specify the order of returned results.
*/
@query({
name: "orderby",
format: "multi",
})
@query(#{ name: "orderby", explode: true })
orderby?: string[];
}
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,19 @@ interface BusinessProcesses {
/**
* Select the specified fields to be included in the response.
*/
@query({
name: "select",
format: "multi",
})
@query(#{ name: "select", explode: true })
select?: string[];

/**
* Expand the indicated resources into the response.
*/
@query({
name: "expand",
format: "multi",
})
@query(#{ name: "expand", explode: true })
expand?: string[];

/**
* Expressions that specify the order of returned results.
*/
@query({
name: "orderby",
format: "multi",
})
@query(#{ name: "orderby", explode: true })
orderby?: string[];
}
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,19 @@ interface BusinessProcessVersions {
/**
* Select the specified fields to be included in the response.
*/
@query({
name: "select",
format: "multi",
})
@query(#{ name: "select", explode: true })
select?: string[];

/**
* Expand the indicated resources into the response.
*/
@query({
name: "expand",
format: "multi",
})
@query(#{ name: "expand", explode: true })
expand?: string[];

/**
* Expressions that specify the order of returned results.
*/
@query({
name: "orderby",
format: "multi",
})
@query(#{ name: "orderby", explode: true })
orderby?: string[];
}
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,19 @@ interface InfrastructureResources {
/**
* Select the specified fields to be included in the response.
*/
@query({
name: "select",
format: "multi",
})
@query(#{ name: "select", explode: true })
select?: string[];

/**
* Expand the indicated resources into the response.
*/
@query({
name: "expand",
format: "multi",
})
@query(#{ name: "expand", explode: true })
expand?: string[];

/**
* Expressions that specify the order of returned results.
*/
@query({
name: "orderby",
format: "multi",
})
@query(#{ name: "orderby", explode: true })
orderby?: string[];
}
>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,19 @@ interface Spaces {
/**
* Select the specified fields to be included in the response.
*/
@query({
name: "select",
format: "multi",
})
@query(#{ name: "select", explode: true })
select?: string[];

/**
* Expand the indicated resources into the response.
*/
@query({
name: "expand",
format: "multi",
})
@query(#{ name: "expand", explode: true })
expand?: string[];

/**
* Expressions that specify the order of returned results.
*/
@query({
name: "orderby",
format: "multi",
})
@query(#{ name: "orderby", explode: true })
orderby?: string[];
}
>;
Expand Down
Loading

0 comments on commit d00c2a0

Please sign in to comment.