Skip to content

Commit

Permalink
Update folder name for canonical swagger (#968)
Browse files Browse the repository at this point in the history
ISSUE: since the canonical swagger file version is "canonical", based on
current logic, the swagger file folder name is "stable", which should be
"canonical".

---------

Co-authored-by: Ding <[email protected]>
  • Loading branch information
dinwa-ms and Ding authored Jun 7, 2024
1 parent d179b2a commit 42e2912
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@azure-tools/typespec-autorest-canonical"
---

update the canonical swagger file folder name
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Output file will interpolate the following values:
- service-name: Name of the service if multiple
- azure-resource-provider-folder: Value of the azure-resource-provider-folder option

Default: `{azure-resource-provider-folder}/{service-name}/{version}/openapi.json`
Default: `{azure-resource-provider-folder}/{service-name}/canonical/openapi.json`

Example: Single service

Expand Down
2 changes: 1 addition & 1 deletion eng/feeds/arm-canonical/tspconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ options:
'@azure-tools/typespec-autorest-canonical':
emitter-output-dir: "{project-root}/.."
azure-resource-provider-folder: "resource-manager"
output-file: "{azure-resource-provider-folder}/{service-name}/{version-status}/{version}/openapi.json"
output-file: "{azure-resource-provider-folder}/{service-name}/canonical/openapi.json"
linter:
extends:
- "@azure-tools/typespec-azure-rulesets/resource-manager"
2 changes: 1 addition & 1 deletion packages/typespec-autorest-canonical/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Output file will interpolate the following values:
- service-name: Name of the service if multiple
- azure-resource-provider-folder: Value of the azure-resource-provider-folder option

Default: `{azure-resource-provider-folder}/{service-name}/{version}/openapi.json`
Default: `{azure-resource-provider-folder}/{service-name}/canonical/openapi.json`

Example: Single service

Expand Down
9 changes: 1 addition & 8 deletions packages/typespec-autorest-canonical/src/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ async function emitAllServices(
function resolveOutputFile(
service: Service,
multipleServices: boolean,
options: ResolvedAutorestCanonicalEmitterOptions,
version?: string
options: ResolvedAutorestCanonicalEmitterOptions
): string {
const azureResourceProviderFolder = options.azureResourceProviderFolder;
const interpolated = interpolatePath(options.outputFile, {
Expand All @@ -144,12 +143,6 @@ function resolveOutputFile(
multipleServices || azureResourceProviderFolder
? getNamespaceFullName(service.type)
: undefined,
"version-status": azureResourceProviderFolder
? version?.includes("preview")
? "preview"
: "stable"
: undefined,
version,
});

return resolvePath(options.outputDir, interpolated);
Expand Down
4 changes: 2 additions & 2 deletions packages/typespec-autorest-canonical/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface AutorestCanonicalEmitterOptions {
* - version: Version of the service if multiple
* - azure-resource-provider-folder: Value of the azure-resource-provider-folder option
*
* @default `{azure-resource-provider-folder}/{service-name}/{version}/openapi.json`
* @default `{azure-resource-provider-folder}/{service-name}/canonical/openapi.json`
*
*
* @example Single service no versioning
Expand Down Expand Up @@ -68,7 +68,7 @@ const EmitterOptionsSchema: JSONSchemaType<AutorestCanonicalEmitterOptions> = {
" - service-name: Name of the service if multiple",
" - azure-resource-provider-folder: Value of the azure-resource-provider-folder option",
"",
"Default: `{azure-resource-provider-folder}/{service-name}/{version}/openapi.json`",
"Default: `{azure-resource-provider-folder}/{service-name}/canonical/openapi.json`",
"",
"",
"Example: Single service",
Expand Down

0 comments on commit 42e2912

Please sign in to comment.