@azure-tools/typespec-autorest-canonical 0.3.0-dev.4 → 0.3.0-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -52,6 +52,12 @@ Example: Multiple services
52
52
 
53
53
  **Type:** `string`
54
54
 
55
+ #### `arm-types-dir`
56
+
57
+ **Type:** `string`
58
+
59
+ Path to the common-types.json file folder. Default: '${project-root}/../../common-types/resource-management'
60
+
55
61
  #### `new-line`
56
62
 
57
63
  **Type:** `"crlf" | "lf"`
@@ -0,0 +1,5 @@
1
+ import { EmitContext } from "@typespec/compiler";
2
+ import { AutorestCanonicalEmitterOptions } from "./lib.js";
3
+ export declare const canonicalVersion = "canonical";
4
+ export declare function $onEmit(context: EmitContext<AutorestCanonicalEmitterOptions>): Promise<void>;
5
+ //# sourceMappingURL=emitter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../src/emitter.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,WAAW,EAYZ,MAAM,oBAAoB,CAAC;AAO5B,OAAO,EAAE,+BAA+B,EAAoB,MAAM,UAAU,CAAC;AAQ7E,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAc5C,wBAAsB,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,+BAA+B,CAAC,iBAqBlF"}
@@ -0,0 +1,125 @@
1
+ import { getOpenAPIForService, sortOpenAPIDocument, } from "@azure-tools/typespec-autorest";
2
+ import { createSdkContext } from "@azure-tools/typespec-client-generator-core";
3
+ import { emitFile, getDirectoryPath, getNamespaceFullName, interpolatePath, listServices, navigateType, resolvePath, } from "@typespec/compiler";
4
+ import { getRenamedFrom, getReturnTypeChangedFrom, getTypeChangedFrom, getVersion, } from "@typespec/versioning";
5
+ import { reportDiagnostic } from "./lib.js";
6
+ const defaultOptions = {
7
+ "output-file": "{azure-resource-provider-folder}/{service-name}/canonical/openapi.json",
8
+ "new-line": "lf",
9
+ "include-x-typespec-name": "never",
10
+ };
11
+ export const canonicalVersion = "canonical";
12
+ export async function $onEmit(context) {
13
+ const resolvedOptions = { ...defaultOptions, ...context.options };
14
+ const tcgcSdkContext = createSdkContext(context, "@azure-tools/typespec-autorest-canonical");
15
+ const armTypesDir = interpolatePath(resolvedOptions["arm-types-dir"] ?? "{project-root}/../../common-types/resource-management", {
16
+ "project-root": context.program.projectRoot,
17
+ "emitter-output-dir": context.emitterOutputDir,
18
+ });
19
+ const options = {
20
+ outputFile: resolvedOptions["output-file"],
21
+ outputDir: context.emitterOutputDir,
22
+ azureResourceProviderFolder: resolvedOptions["azure-resource-provider-folder"],
23
+ newLine: resolvedOptions["new-line"],
24
+ omitUnreachableTypes: resolvedOptions["omit-unreachable-types"],
25
+ includeXTypeSpecName: resolvedOptions["include-x-typespec-name"],
26
+ armTypesDir,
27
+ };
28
+ await emitAllServices(context.program, tcgcSdkContext, options);
29
+ }
30
+ async function emitAllServices(program, tcgcSdkContext, options) {
31
+ const services = listServices(program);
32
+ if (services.length === 0) {
33
+ services.push({ type: program.getGlobalNamespaceType() });
34
+ }
35
+ for (const service of services) {
36
+ validateUnsupportedVersioning(program, service.type);
37
+ const context = {
38
+ program,
39
+ outputFile: resolveOutputFile(service, services.length > 1, options),
40
+ service,
41
+ version: canonicalVersion,
42
+ tcgcSdkContext,
43
+ };
44
+ const result = await getOpenAPIForService(context, options);
45
+ const includedVersions = getVersion(program, service.type)
46
+ ?.getVersions()
47
+ ?.map((item) => item.name);
48
+ result.document.info["x-canonical-included-versions"] = includedVersions;
49
+ result.document.info["x-typespec-generated"] = [
50
+ {
51
+ emitter: "@azure-tools/typespec-autorest-canonical",
52
+ },
53
+ ];
54
+ if (!program.compilerOptions.noEmit && !program.hasError()) {
55
+ // Sort the document
56
+ const sortedDocument = sortOpenAPIDocument(result.document);
57
+ // Write out the OpenAPI document to the output path
58
+ await emitFile(program, {
59
+ path: context.outputFile,
60
+ content: prettierOutput(JSON.stringify(sortedDocument, null, 2)),
61
+ newLine: options.newLine,
62
+ });
63
+ // Copy examples to the output directory
64
+ if (options.examplesDirectory && result.operationExamples.length > 0) {
65
+ const examplesPath = resolvePath(getDirectoryPath(context.outputFile), "examples");
66
+ await program.host.mkdirp(examplesPath);
67
+ for (const { examples } of result.operationExamples) {
68
+ if (examples) {
69
+ for (const [fileName, { file }] of Object.entries(examples)) {
70
+ await emitFile(program, {
71
+ path: resolvePath(examplesPath, fileName),
72
+ content: file.text,
73
+ newLine: options.newLine,
74
+ });
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ }
82
+ function resolveOutputFile(service, multipleServices, options, version) {
83
+ const azureResourceProviderFolder = options.azureResourceProviderFolder;
84
+ const interpolated = interpolatePath(options.outputFile, {
85
+ "azure-resource-provider-folder": azureResourceProviderFolder,
86
+ "service-name": multipleServices || azureResourceProviderFolder
87
+ ? getNamespaceFullName(service.type)
88
+ : undefined,
89
+ "version-status": azureResourceProviderFolder
90
+ ? version?.includes("preview")
91
+ ? "preview"
92
+ : "stable"
93
+ : undefined,
94
+ version,
95
+ });
96
+ return resolvePath(options.outputDir, interpolated);
97
+ }
98
+ function prettierOutput(output) {
99
+ return output + "\n";
100
+ }
101
+ function validateUnsupportedVersioning(program, namespace) {
102
+ navigateType(namespace, {
103
+ operation: (operation) => {
104
+ if (getReturnTypeChangedFrom(program, operation)) {
105
+ reportDisallowedDecorator("returnTypeChangedFrom", operation);
106
+ }
107
+ },
108
+ modelProperty: (prop) => {
109
+ if (getRenamedFrom(program, prop)) {
110
+ reportDisallowedDecorator("renamedFrom", prop);
111
+ }
112
+ if (getTypeChangedFrom(program, prop)) {
113
+ reportDisallowedDecorator("typeChangedFrom", prop);
114
+ }
115
+ },
116
+ }, {});
117
+ function reportDisallowedDecorator(decorator, type) {
118
+ reportDiagnostic(program, {
119
+ code: "unsupported-versioning-decorator",
120
+ format: { decorator },
121
+ target: type,
122
+ });
123
+ }
124
+ }
125
+ //# s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,CAAC;KACF,EACD,EAAE,CACH,CAAC;IAEF,SAAS,yBAAyB,CAAC,SAAiB,EAAE,IAAU;QAC9D,gBAAgB,CAAC,OAAO,EAAE;YACxB,IAAI,EAAE,kCAAkC;YACxC,MAAM,EAAE,EAAE,SAAS,EAAE;YACrB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -1,3 +1,3 @@
1
+ export { $onEmit } from "./emitter.js";
1
2
  export { $lib, AutorestCanonicalEmitterOptions } from "./lib.js";
2
- export * from "./openapi.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC;AACjE,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,+BAA+B,EAAE,MAAM,UAAU,CAAC"}
package/dist/src/index.js CHANGED
@@ -1,3 +1,3 @@
1
+ export { $onEmit } from "./emitter.js";
1
2
  export { $lib } from "./lib.js";
2
- export * from "./openapi.js";
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmC,MAAM,UAAU,CAAC;AACjE,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAmC,MAAM,UAAU,CAAC"}
package/dist/src/lib.d.ts CHANGED
@@ -41,146 +41,22 @@ export interface AutorestCanonicalEmitterOptions {
41
41
  * @default "never"
42
42
  */
43
43
  "include-x-typespec-name"?: "inline-only" | "never";
44
+ /**
45
+ * Path to the common-types.json file folder.
46
+ * @default "${project-root}/../../common-types/resource-management"
47
+ */
48
+ "arm-types-dir"?: string;
44
49
  }
45
50
  export declare const $lib: import("@typespec/compiler").TypeSpecLibrary<{
46
- "duplicate-body-types": {
47
- readonly default: "Request has multiple body types";
48
- };
49
- "invalid-schema": {
50
- readonly default: import("@typespec/compiler").CallableMessage<["type"]>;
51
- };
52
- "union-null": {
53
- readonly default: "Cannot have a union containing only null types.";
54
- };
55
- "union-unsupported": {
56
- readonly default: "Unions cannot be emitted to OpenAPI v2 unless all options are literals of the same type.";
57
- readonly empty: "Empty unions are not supported for OpenAPI v2 - enums must have at least one value.";
58
- };
59
- "invalid-default": {
60
- readonly default: import("@typespec/compiler").CallableMessage<["type"]>;
61
- };
62
- "invalid-multi-collection-format": {
63
- readonly default: "The 'multi' should be applied to parameter in 'query', 'header' or 'formData'.";
64
- };
65
- "inline-cycle": {
66
- readonly default: import("@typespec/compiler").CallableMessage<["type"]>;
67
- };
68
- "nonspecific-scalar": {
69
- readonly default: import("@typespec/compiler").CallableMessage<["type", "chosenType"]>;
70
- };
71
- "unsupported-http-auth-scheme": {
72
- readonly default: import("@typespec/compiler").CallableMessage<["scheme"]>;
73
- };
74
- "unsupported-status-code-range": {
75
- readonly default: import("@typespec/compiler").CallableMessage<["start", "end"]>;
76
- };
77
- "unsupported-multipart-type": {
78
- readonly default: import("@typespec/compiler").CallableMessage<["part"]>;
79
- };
80
- "unsupported-param-type": {
81
- readonly default: import("@typespec/compiler").CallableMessage<["part"]>;
82
- };
83
- "invalid-format": {
84
- readonly default: import("@typespec/compiler").CallableMessage<["schema", "format"]>;
85
- };
86
- "unsupported-auth": {
87
- readonly default: import("@typespec/compiler").CallableMessage<["authType"]>;
88
- };
89
51
  "unsupported-versioning-decorator": {
90
52
  readonly default: import("@typespec/compiler").CallableMessage<["decorator"]>;
91
53
  };
92
54
  }, AutorestCanonicalEmitterOptions, never>;
93
- export declare const reportDiagnostic: <C extends "duplicate-body-types" | "invalid-schema" | "union-null" | "union-unsupported" | "invalid-default" | "invalid-multi-collection-format" | "inline-cycle" | "nonspecific-scalar" | "unsupported-http-auth-scheme" | "unsupported-status-code-range" | "unsupported-multipart-type" | "unsupported-param-type" | "invalid-format" | "unsupported-auth" | "unsupported-versioning-decorator", M extends keyof {
94
- "duplicate-body-types": {
95
- readonly default: "Request has multiple body types";
96
- };
97
- "invalid-schema": {
98
- readonly default: import("@typespec/compiler").CallableMessage<["type"]>;
99
- };
100
- "union-null": {
101
- readonly default: "Cannot have a union containing only null types.";
102
- };
103
- "union-unsupported": {
104
- readonly default: "Unions cannot be emitted to OpenAPI v2 unless all options are literals of the same type.";
105
- readonly empty: "Empty unions are not supported for OpenAPI v2 - enums must have at least one value.";
106
- };
107
- "invalid-default": {
108
- readonly default: import("@typespec/compiler").CallableMessage<["type"]>;
109
- };
110
- "invalid-multi-collection-format": {
111
- readonly default: "The 'multi' should be applied to parameter in 'query', 'header' or 'formData'.";
112
- };
113
- "inline-cycle": {
114
- readonly default: import("@typespec/compiler").CallableMessage<["type"]>;
115
- };
116
- "nonspecific-scalar": {
117
- readonly default: import("@typespec/compiler").CallableMessage<["type", "chosenType"]>;
118
- };
119
- "unsupported-http-auth-scheme": {
120
- readonly default: import("@typespec/compiler").CallableMessage<["scheme"]>;
121
- };
122
- "unsupported-status-code-range": {
123
- readonly default: import("@typespec/compiler").CallableMessage<["start", "end"]>;
124
- };
125
- "unsupported-multipart-type": {
126
- readonly default: import("@typespec/compiler").CallableMessage<["part"]>;
127
- };
128
- "unsupported-param-type": {
129
- readonly default: import("@typespec/compiler").CallableMessage<["part"]>;
130
- };
131
- "invalid-format": {
132
- readonly default: import("@typespec/compiler").CallableMessage<["schema", "format"]>;
133
- };
134
- "unsupported-auth": {
135
- readonly default: import("@typespec/compiler").CallableMessage<["authType"]>;
136
- };
55
+ export declare const reportDiagnostic: <C extends "unsupported-versioning-decorator", M extends keyof {
137
56
  "unsupported-versioning-decorator": {
138
57
  readonly default: import("@typespec/compiler").CallableMessage<["decorator"]>;
139
58
  };
140
59
  }[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{
141
- "duplicate-body-types": {
142
- readonly default: "Request has multiple body types";
143
- };
144
- "invalid-schema": {
145
- readonly default: import("@typespec/compiler").CallableMessage<["type"]>;
146
- };
147
- "union-null": {
148
- readonly default: "Cannot have a union containing only null types.";
149
- };
150
- "union-unsupported": {
151
- readonly default: "Unions cannot be emitted to OpenAPI v2 unless all options are literals of the same type.";
152
- readonly empty: "Empty unions are not supported for OpenAPI v2 - enums must have at least one value.";
153
- };
154
- "invalid-default": {
155
- readonly default: import("@typespec/compiler").CallableMessage<["type"]>;
156
- };
157
- "invalid-multi-collection-format": {
158
- readonly default: "The 'multi' should be applied to parameter in 'query', 'header' or 'formData'.";
159
- };
160
- "inline-cycle": {
161
- readonly default: import("@typespec/compiler").CallableMessage<["type"]>;
162
- };
163
- "nonspecific-scalar": {
164
- readonly default: import("@typespec/compiler").CallableMessage<["type", "chosenType"]>;
165
- };
166
- "unsupported-http-auth-scheme": {
167
- readonly default: import("@typespec/compiler").CallableMessage<["scheme"]>;
168
- };
169
- "unsupported-status-code-range": {
170
- readonly default: import("@typespec/compiler").CallableMessage<["start", "end"]>;
171
- };
172
- "unsupported-multipart-type": {
173
- readonly default: import("@typespec/compiler").CallableMessage<["part"]>;
174
- };
175
- "unsupported-param-type": {
176
- readonly default: import("@typespec/compiler").CallableMessage<["part"]>;
177
- };
178
- "invalid-format": {
179
- readonly default: import("@typespec/compiler").CallableMessage<["schema", "format"]>;
180
- };
181
- "unsupported-auth": {
182
- readonly default: import("@typespec/compiler").CallableMessage<["authType"]>;
183
- };
184
60
  "unsupported-versioning-decorator": {
185
61
  readonly default: import("@typespec/compiler").CallableMessage<["decorator"]>;
186
62
  };
@@ -1 +1 @@
1
- {"version":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CAAC"}
package/dist/src/lib.js CHANGED
@@ -24,6 +24,11 @@ const EmitterOptionsSchema = {
24
24
  ].join("\n"),
25
25
  },
26
26
  "azure-resource-provider-folder": { type: "string", nullable: true },
27
+ "arm-types-dir": {
28
+ type: "string",
29
+ nullable: true,
30
+ description: "Path to the common-types.json file folder. Default: '${project-root}/../../common-types/resource-management'",
31
+ },
27
32
  "new-line": {
28
33
  type: "string",
29
34
  enum: ["crlf", "lf"],
@@ -49,91 +54,6 @@ const EmitterOptionsSchema = {
49
54
  const libDef = {
50
55
  name: "@azure-tools/typespec-autorest-canonical",
51
56
  diagnostics: {
52
- "duplicate-body-types": {
53
- severity: "error",
54
- messages: {
55
- default: "Request has multiple body types",
56
- },
57
- },
58
- "invalid-schema": {
59
- severity: "error",
60
- messages: {
61
- default: paramMessage `Couldn't get schema for type ${"type"}`,
62
- },
63
- },
64
- "union-null": {
65
- severity: "error",
66
- messages: {
67
- default: "Cannot have a union containing only null types.",
68
- },
69
- },
70
- "union-unsupported": {
71
- severity: "warning",
72
- messages: {
73
- default: "Unions cannot be emitted to OpenAPI v2 unless all options are literals of the same type.",
74
- empty: "Empty unions are not supported for OpenAPI v2 - enums must have at least one value.",
75
- },
76
- },
77
- "invalid-default": {
78
- severity: "error",
79
- messages: {
80
- default: paramMessage `Invalid type '${"type"}' for a default value`,
81
- },
82
- },
83
- "invalid-multi-collection-format": {
84
- severity: "error",
85
- messages: {
86
- default: "The 'multi' should be applied to parameter in 'query', 'header' or 'formData'.",
87
- },
88
- },
89
- "inline-cycle": {
90
- severity: "error",
91
- messages: {
92
- default: paramMessage `Cycle detected in '${"type"}'. Use @friendlyName decorator to assign an OpenAPI definition name and make it non-inline.`,
93
- },
94
- },
95
- "nonspecific-scalar": {
96
- severity: "warning",
97
- messages: {
98
- default: paramMessage `Scalar type '${"type"}' is not specific enough. The more specific type '${"chosenType"}' has been chosen.`,
99
- },
100
- },
101
- "unsupported-http-auth-scheme": {
102
- severity: "warning",
103
- messages: {
104
- default: paramMessage `The specified HTTP authentication scheme is not supported by this emitter: ${"scheme"}.`,
105
- },
106
- },
107
- "unsupported-status-code-range": {
108
- severity: "error",
109
- messages: {
110
- default: paramMessage `Status code range '${"start"} to '${"end"}' is not supported. OpenAPI 2.0 can only represent range 1XX, 2XX, 3XX, 4XX and 5XX. Example: \`@minValue(400) @maxValue(499)\` for 4XX.`,
111
- },
112
- },
113
- "unsupported-multipart-type": {
114
- severity: "warning",
115
- messages: {
116
- default: paramMessage `Multipart parts can only be represented as primitive types in swagger 2.0. Information is lost for part '${"part"}'.`,
117
- },
118
- },
119
- "unsupported-param-type": {
120
- severity: "warning",
121
- messages: {
122
- default: paramMessage `Parameter can only be represented as primitive types in swagger 2.0. Information is lost for part '${"part"}'.`,
123
- },
124
- },
125
- "invalid-format": {
126
- severity: "warning",
127
- messages: {
128
- default: paramMessage `'${"schema"}' format '${"format"}' is not supported in AutorestCanonical. It will not be emitted.`,
129
- },
130
- },
131
- "unsupported-auth": {
132
- severity: "warning",
133
- messages: {
134
- default: paramMessage `Authentication "${"authType"}" is not a known authentication by the AutorestCanonical emitter, it will be ignored.`,
135
- },
136
- },
137
57
  "unsupported-versioning-decorator": {
138
58
  severity: "warning",
139
59
  messages: {
@@ -1 +1 @@
1
- {"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAkB,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAmDzF,MAAM,oBAAoB,GAAoD;IAC5E,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE;gBACX,0BAA0B;gBAC1B,oDAAoD;gBACpD,kDAAkD;gBAClD,uFAAuF;gBACvF,EAAE;gBACF,mFAAmF;gBACnF,EAAE;gBACF,EAAE;gBACF,yBAAyB;gBACzB,6BA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ACb,WAAW,EAAE,+CAA+C;SAC7D;QACD,wBAAwB,EAAE;YACxB,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,8KAA8K;SACjL;QACD,yBAAyB,EAAE;YACzB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC;YAC9B,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,OAAO;YAChB,WAAW,EACT,0MAA0M;SAC7M;KACF;IACD,QAAQ,EAAE,EAAE;CACb,CAAC;AAEF,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,0CAA0C;IAChD,WAAW,EAAE;QACX,kCAAkC,EAAE;YAClC,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,cAAc,WAAW,yCAAyC;aACxF;SACF;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,oBAAuE;KACjF;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,IAAI,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-autorest-canonical",
3
- "version": "0.3.0-dev.4",
3
+ "version": "0.3.0-dev.6",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec library for emitting canonical swagger",
6
6
  "homepage": "https://azure.github.io/typespec-azure",
@@ -41,16 +41,17 @@
41
41
  ],
42
42
  "peerDependencies": {
43
43
  "@azure-tools/typespec-azure-core": "~0.41.0 || >=0.42.0-dev <0.42.0",
44
- "@azure-tools/typespec-client-generator-core": "~0.41.2 || >=0.42.0-dev <0.42.0",
45
- "@typespec/versioning": "~0.55.0 || >=0.56.0-dev <0.56.0"
44
+ "@azure-tools/typespec-client-generator-core": "~0.41.8 || >=0.42.0-dev <0.42.0",
45
+ "@typespec/versioning": "~0.55.0 || >=0.56.0-dev <0.56.0",
46
+ "@azure-tools/typespec-autorest": "~0.41.1 || >=0.42.0-dev <0.42.0"
46
47
  },
47
48
  "devDependencies": {
49
+ "@azure-tools/typespec-autorest": "~0.41.1 || >=0.42.0-dev <0.42.0",
48
50
  "@azure-tools/typespec-azure-core": "~0.41.0 || >=0.42.0-dev <0.42.0",
49
- "@azure-tools/typespec-client-generator-core": "~0.41.2 || >=0.42.0-dev <0.42.0",
51
+ "@azure-tools/typespec-client-generator-core": "~0.41.8 || >=0.42.0-dev <0.42.0",
50
52
  "@types/node": "~18.11.19",
51
53
  "@typespec/compiler": "~0.55.0 || >=0.56.0-dev <0.56.0",
52
54
  "@typespec/http": "~0.55.0 || >=0.56.0-dev <0.56.0",
53
- "@typespec/json-schema": "~0.55.0 || >=0.56.0-dev <0.56.0",
54
55
  "@typespec/library-linter": "~0.55.0 || >=0.56.0-dev <0.56.0",
55
56
  "@typespec/openapi": "~0.55.0 || >=0.56.0-dev <0.56.0",
56
57
  "@typespec/rest": "~0.55.0 || >=0.56.0-dev <0.56.0",
@@ -67,10 +68,9 @@
67
68
  "dependencies": {},
68
69
  "scripts": {
69
70
  "clean": "rimraf ./dist ./temp",
70
- "build": "npm run regen-autorest-canonical-openapi-schema && tsc -p . && npm run lint-typespec-library",
71
+ "build": " tsc -p . && npm run lint-typespec-library",
71
72
  "watch": "tsc -p . --watch",
72
73
  "lint-typespec-library": "tsp compile . --warn-as-error --import @typespec/library-linter --no-emit",
73
- "regen-autorest-canonical-openapi-schema": "tsp compile ./schema/autorest-canonical-openapi-schema.tsp --warn-as-error && node ./.scripts/schema-json-to-js.js",
74
74
  "test": "vitest run",
75
75
  "test:watch": "vitest -w",
76
76
  "test:ui": "vitest --ui",
@@ -1,3 +0,0 @@
1
- declare let AutorestCanonicalOpenAPISchema: any;
2
- export { AutorestCanonicalOpenAPISchema };
3
- //# sourceMappingURL=autorest-canonical-openapi-schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"autorest-canonical-openapi-schema.d.ts","sourceRoot":"","sources":["../../src/autorest-canonical-openapi-schema.ts"],"names":[],"mappings":"AAAA,QAAA,IAAI,8BAA8B,EAAE,GAAG,CAAC;AAUxC,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
@@ -1,12 +0,0 @@
1
- let AutorestCanonicalOpenAPISchema;
2
- try {
3
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
- // @ts-ignore
5
- AutorestCanonicalOpenAPISchema = (await import("../../schema/dist/schema.js")).default;
6
- }
7
- catch {
8
- const name = "../schema/dist/schema.js";
9
- AutorestCanonicalOpenAPISchema = (await import(/* @vite-ignore */ name)).default;
10
- }
11
- export { AutorestCanonicalOpenAPISchema };
12
- //# sourceMappingURL=autorest-canonical-openapi-schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"autorest-canonical-openapi-schema.js","sourceRoot":"","sources":["../../src/autorest-canonical-openapi-schema.ts"],"names":[],"mappings":"AAAA,IAAI,8BAAmC,CAAC;AACxC,IAAI,CAAC;IACH,6DAA6D;IAC7D,aAAa;IACb,8BAA8B,GAAG,CAAC,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC,CAAC,OAAO,CAAC;AACzF,CAAC;AAAC,MAAM,CAAC;IACP,MAAM,IAAI,GAAG,0BAA0B,CAAC;IACxC,8BAA8B,GAAG,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;AACnF,CAAC;AAED,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
@@ -1,30 +0,0 @@
1
- export type JsonSchema = {
2
- title?: string;
3
- id?: string;
4
- schema?: string;
5
- $defs?: Record<string, JsonSchemaType>;
6
- } & JsonSchemaObject;
7
- export type ResolvedJsonSchemaType = Exclude<JsonSchemaType, JsonSchemaRef>;
8
- export type JsonSchemaType = JsonSchemaObject | JsonSchemaArray | JsonSchemaPrimitive | JsonSchemaRef;
9
- export interface JsonSchemaBase {
10
- $id?: string;
11
- }
12
- export interface JsonSchemaObject extends JsonSchemaBase {
13
- type: "object";
14
- properties?: Record<string, JsonSchemaType>;
15
- additionalProperties?: JsonSchemaType | boolean;
16
- patternProperties?: Record<string, JsonSchemaType>;
17
- "x-ordering"?: "keep" | "url";
18
- }
19
- export interface JsonSchemaArray extends JsonSchemaBase {
20
- type: "array";
21
- items?: JsonSchema;
22
- }
23
- export interface JsonSchemaRef {
24
- $ref: string;
25
- }
26
- export interface JsonSchemaPrimitive extends JsonSchemaBase {
27
- type: "number" | "string" | "boolean";
28
- }
29
- export declare function sortWithJsonSchema<T>(value: T, jsonSchema: JsonSchema, ref?: string): T;
30
- //# sourceMappingURL=sorter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sorter.d.ts","sourceRoot":"","sources":["../../../src/json-schema-sorter/sorter.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACxC,GAAG,gBAAgB,CAAC;AAErB,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;AAE5E,MAAM,MAAM,cAAc,GACtB,gBAAgB,GAChB,eAAe,GACf,mBAAmB,GACnB,aAAa,CAAC;AAElB,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,oBAAoB,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;IAChD,iBAAiB,C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