@zuplo/openapi-tools 0.0.0 → 6.40.11

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/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./interfaces.js";
1
+ export * from "./openapi-utils.js";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./interfaces.js";
1
+ export * from "./openapi-utils.js";
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,270 @@
1
+ import { assert } from "chai";
2
+ import { getOperationKey, mergeOpenApiDocumentOnOperationId, } from "./openapi-utils.js";
3
+ import { ZUPLO_OPEN_API_ROUTE_KEY, } from "./interfaces.js";
4
+ const emptyOpenApi = {
5
+ openapi: "3.0.0",
6
+ info: {
7
+ title: "Test",
8
+ version: "1.0.0",
9
+ },
10
+ paths: {},
11
+ };
12
+ const basicOpenApi = {
13
+ openapi: "3.0.0",
14
+ info: {
15
+ title: "Test",
16
+ version: "1.0.0",
17
+ },
18
+ paths: {
19
+ "/test": {
20
+ get: {
21
+ operationId: "getTest",
22
+ },
23
+ },
24
+ },
25
+ };
26
+ const openApiWithOperationIdsMissing = {
27
+ openapi: "3.0.0",
28
+ info: {
29
+ title: "Test",
30
+ version: "1.0.0",
31
+ },
32
+ components: {},
33
+ paths: {
34
+ "/test": {
35
+ get: {
36
+ responses: {
37
+ "200": {
38
+ description: "OK",
39
+ },
40
+ },
41
+ },
42
+ },
43
+ },
44
+ };
45
+ const openApiWithMatchingPathMethodButDifferentOperationId = {
46
+ openapi: "3.0.0",
47
+ info: {
48
+ title: "Test",
49
+ version: "1.0.0",
50
+ },
51
+ paths: {
52
+ "/test": {
53
+ get: {
54
+ operationId: "get_test",
55
+ },
56
+ },
57
+ },
58
+ };
59
+ const openApiWithSomePathsAndMethods = {
60
+ openapi: "3.0.0",
61
+ info: {
62
+ title: "Test",
63
+ version: "1.0.0",
64
+ },
65
+ paths: {
66
+ "/test": {
67
+ get: {
68
+ operationId: "getTest",
69
+ deprecated: true,
70
+ "x-zuplo-route": {
71
+ corsPolicy: "none",
72
+ handler: {
73
+ export: "urlForwardHandler",
74
+ module: "$import(@zuplo/runtime)",
75
+ options: {
76
+ baseUrl: "https://echo.zuplo.io",
77
+ },
78
+ },
79
+ },
80
+ },
81
+ delete: {
82
+ operationId: "deleteTest",
83
+ "x-zuplo-route": {
84
+ corsPolicy: "none",
85
+ handler: {
86
+ export: "urlForwardHandler",
87
+ module: "$import(@zuplo/runtime)",
88
+ options: {
89
+ baseUrl: "https://echo.zuplo.io",
90
+ },
91
+ },
92
+ },
93
+ },
94
+ post: {
95
+ operationId: "postTest",
96
+ "x-zuplo-route": {
97
+ corsPolicy: "none",
98
+ handler: {
99
+ export: "urlForwardHandler",
100
+ module: "$import(@zuplo/runtime)",
101
+ options: {
102
+ baseUrl: "https://echo.zuplo.io",
103
+ },
104
+ },
105
+ },
106
+ },
107
+ },
108
+ "/humans": {
109
+ delete: {
110
+ operationId: "deleteHuman",
111
+ "x-zuplo-route": {
112
+ corsPolicy: "none",
113
+ handler: {
114
+ export: "urlForwardHandler",
115
+ module: "$import(@zuplo/runtime)",
116
+ options: {
117
+ baseUrl: "https://echo.zuplo.io",
118
+ },
119
+ },
120
+ },
121
+ },
122
+ },
123
+ "/humans/{id}": {
124
+ parameters: [
125
+ {
126
+ name: "id",
127
+ in: "path",
128
+ required: true,
129
+ schema: {
130
+ type: "string",
131
+ },
132
+ },
133
+ ],
134
+ get: {
135
+ operationId: "getHuman",
136
+ "x-zuplo-route": {
137
+ corsPolicy: "none",
138
+ handler: {
139
+ export: "urlForwardHandler",
140
+ module: "$import(@zuplo/runtime)",
141
+ options: {
142
+ baseUrl: "https://echo.zuplo.io",
143
+ },
144
+ },
145
+ },
146
+ },
147
+ },
148
+ },
149
+ };
150
+ const newOpenApiWithSomePathsAndMethods = {
151
+ openapi: "3.0.0",
152
+ info: {
153
+ title: "Test",
154
+ version: "1.0.0",
155
+ },
156
+ paths: {
157
+ "/test": {
158
+ get: {
159
+ operationId: "getTest",
160
+ deprecated: false, // Changed deprecated to false
161
+ },
162
+ post: {
163
+ operationId: "postTest",
164
+ summary: "Create a new test", // Added summary
165
+ // route definition is missing
166
+ },
167
+ },
168
+ "/humans": {
169
+ post: {
170
+ operationId: "createHuman",
171
+ },
172
+ delete: {
173
+ operationId: "deleteHuman",
174
+ },
175
+ },
176
+ "/humans/{humanId}": {
177
+ // Changed path parameter name
178
+ parameters: [
179
+ {
180
+ name: "humanId",
181
+ in: "path",
182
+ required: true,
183
+ schema: {
184
+ type: "string",
185
+ },
186
+ },
187
+ ],
188
+ get: {
189
+ operationId: "getHuman",
190
+ },
191
+ },
192
+ },
193
+ };
194
+ describe("OpenAPI OperationID Merge Tests", function () {
195
+ it("Doesn't change the original document when merging two empty OpenAPI files", async function () {
196
+ const { mergedDocument, created, merged, retained } = mergeOpenApiDocumentOnOperationId(emptyOpenApi, emptyOpenApi);
197
+ assert.isEmpty(created, "No operations should be created");
198
+ assert.isEmpty(merged, "No operations should be merged");
199
+ assert.isEmpty(retained, "No operations should be retained");
200
+ assert.deepEqual(mergedDocument, emptyOpenApi, "The original document should not be changed");
201
+ });
202
+ it("Retains existing operations when merging in an empty OpenAPI file", async function () {
203
+ const { mergedDocument, created, merged, retained } = mergeOpenApiDocumentOnOperationId(basicOpenApi, emptyOpenApi);
204
+ assert.isEmpty(created, "No operations should be created");
205
+ assert.isEmpty(merged, "No operations should be merged");
206
+ assert.deepEqual(retained, new Set(["getTest"]), "The existing operation should be retained");
207
+ assert.deepEqual(mergedDocument, basicOpenApi, "The original document should not be changed");
208
+ });
209
+ it("Creates new operations when merging into an empty OpenAPI file", async function () {
210
+ const { mergedDocument, created, merged, retained } = mergeOpenApiDocumentOnOperationId(emptyOpenApi, basicOpenApi);
211
+ assert.isEmpty(merged, "No operations should be merged");
212
+ assert.isEmpty(retained, "No operations should be retained");
213
+ assert.deepEqual(created, new Set(["getTest"]), "The new operation should be created");
214
+ assert.deepEqual(mergedDocument, basicOpenApi, "The merged document should match the new document");
215
+ });
216
+ it("Throws when operations are missing operationId", async function () {
217
+ assert.throws(() => {
218
+ mergeOpenApiDocumentOnOperationId(basicOpenApi, openApiWithOperationIdsMissing);
219
+ }, `OperationId is required for all operations. OperationId missing on ${getOperationKey("get", "/test")}. Please add an operationId to all operations before merging.`);
220
+ });
221
+ it("Throws when operation already exists at path+method and operationIds do not match", async function () {
222
+ assert.throws(() => {
223
+ mergeOpenApiDocumentOnOperationId(basicOpenApi, openApiWithMatchingPathMethodButDifferentOperationId);
224
+ }, `Operation 'get_test' has a matching path/method to an existing operation at ${getOperationKey("get", "/test")}, but a different operationId. Either update the operationId on the existing operation or remove it entirely.`);
225
+ });
226
+ it("Creates new operations when merging into an OpenAPI file with operations", async function () {
227
+ const { mergedDocument, created } = mergeOpenApiDocumentOnOperationId(openApiWithSomePathsAndMethods, newOpenApiWithSomePathsAndMethods);
228
+ assert.deepEqual(created, new Set(["createHuman"]), "The new operations should be created");
229
+ assert.deepEqual(mergedDocument?.paths?.["/humans"]?.post, { operationId: "createHuman" }, "The new operation should be created");
230
+ });
231
+ it("Retains old operations when new document does not include those operations", async function () {
232
+ const { mergedDocument, retained } = mergeOpenApiDocumentOnOperationId(openApiWithSomePathsAndMethods, newOpenApiWithSomePathsAndMethods);
233
+ assert.deepEqual(retained, new Set(["deleteTest"]), "The existing operations should be retained");
234
+ assert.deepEqual(mergedDocument?.paths?.["/test"]?.delete, openApiWithSomePathsAndMethods?.paths?.["/test"]?.delete, "The existing operation should be retained");
235
+ });
236
+ it("Merges operations and updates properties", async function () {
237
+ const { mergedDocument, merged } = mergeOpenApiDocumentOnOperationId(openApiWithSomePathsAndMethods, newOpenApiWithSomePathsAndMethods);
238
+ assert.deepEqual(merged, new Set(["getTest", "postTest", "deleteHuman", "getHuman"]), "The operations should be merged");
239
+ assert.isFalse(mergedDocument?.paths?.["/test"]?.get?.deprecated, "The operation's 'deprecated' property should be updated");
240
+ assert.deepEqual(mergedDocument?.paths?.["/test"]?.post?.summary, "Create a new test", "The operation's 'summary' property should be updated");
241
+ assert.deepEqual(mergedDocument?.paths?.["/humans"]?.delete?.[ZUPLO_OPEN_API_ROUTE_KEY], openApiWithSomePathsAndMethods?.paths?.["/humans"]?.delete?.[ZUPLO_OPEN_API_ROUTE_KEY], "Merged operation with no changes should be the same");
242
+ assert.notExists(mergedDocument?.paths?.["/humans/{id}"]?.get, "The old operation should not exist in the merged document");
243
+ // NOTE: Parameters at the path level are not merged since operationID
244
+ // merging implies only operations are merged
245
+ assert.deepEqual(mergedDocument?.paths?.["/humans/{humanId}"], {
246
+ get: {
247
+ operationId: "getHuman",
248
+ "x-zuplo-route": {
249
+ corsPolicy: "none",
250
+ handler: {
251
+ export: "urlForwardHandler",
252
+ module: "$import(@zuplo/runtime)",
253
+ options: {
254
+ baseUrl: "https://echo.zuplo.io",
255
+ },
256
+ },
257
+ },
258
+ },
259
+ }, "The new operation should exist in the merged document");
260
+ });
261
+ it("Retains zuplo config when merging operations", async function () {
262
+ const { mergedDocument, merged } = mergeOpenApiDocumentOnOperationId(openApiWithSomePathsAndMethods, newOpenApiWithSomePathsAndMethods);
263
+ assert.deepEqual(merged, new Set(["getTest", "postTest", "deleteHuman", "getHuman"]), "The operations should be merged");
264
+ assert.deepEqual(mergedDocument?.paths?.["/test"]?.get?.[ZUPLO_OPEN_API_ROUTE_KEY], openApiWithSomePathsAndMethods?.paths?.["/test"]?.get?.[ZUPLO_OPEN_API_ROUTE_KEY], "The existing zuplo config should be retained");
265
+ assert.deepEqual(mergedDocument?.paths?.["/test"]?.post?.[ZUPLO_OPEN_API_ROUTE_KEY], openApiWithSomePathsAndMethods?.paths?.["/test"]?.post?.[ZUPLO_OPEN_API_ROUTE_KEY], "The existing zuplo config should be retained");
266
+ assert.deepEqual(mergedDocument?.paths?.["/humans"]?.delete?.[ZUPLO_OPEN_API_ROUTE_KEY], openApiWithSomePathsAndMethods?.paths?.["/humans"]?.delete?.[ZUPLO_OPEN_API_ROUTE_KEY], "The existing zuplo config should be retained");
267
+ assert.deepEqual(mergedDocument?.paths?.["/humans/{humanId}"]?.get?.[ZUPLO_OPEN_API_ROUTE_KEY], openApiWithSomePathsAndMethods?.paths?.["/humans/{id}"]?.get?.[ZUPLO_OPEN_API_ROUTE_KEY], "The existing zuplo config should be retained");
268
+ });
269
+ });
270
+ //# sourceMappingURL=index.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EACL,eAAe,EACf,iCAAiC,GAClC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,wBAAwB,GAEzB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,OAAO;KACjB;IACD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MAAM,CAAC,SAAS,CACd,cAAc,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,wBAAwB,CAAC,EACjE,8BAA8B,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CACrD,wBAAwB,CACzB,EACD,8CAA8C,CAC/C,CAAC;QACF,MAAM,CAAC,SAAS,CACd,cAAc,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,wBAAwB,CAAC,EAClE,8BAA8B,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CACtD,wBAAwB,CACzB,EACD,8CAA8C,CAC/C,CAAC;QACF,MAAM,CAAC,SAAS,CACd,cAAc,EAAE,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,wBAAwB,CAAC,EACtE,8BAA8B,EAAE,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAC1D,wBAAwB,CACzB,EACD,8CAA8C,CAC/C,CAAC;QACF,MAAM,CAAC,SAAS,CACd,cAAc,EAAE,KAAK,EAAE,CAAC,mBAAmB,CAAC,EAAE,GAAG,EAAE,CACjD,wBAAwB,CACzB,EACD,8BAA8B,EAAE,KAAK,EAAE,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,CAC5D,wBAAwB,CACzB,EACD,8CAA8C,CAC/C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,40 +1,45 @@
1
- type DeploymentStageName = "api" | "dev-portal";
2
- export type LogLevel = keyof Pick<Logger, "debug" | "info" | "warn" | "error">;
3
- interface LogFunction {
4
- (obj: unknown, msg?: string, ...args: any[]): void;
5
- (msg: string, ...args: any[]): void;
1
+ import { RouteConfiguration } from "@zuplo/runtime";
2
+ import { ErrorObject } from "ajv";
3
+ import { OpenAPIV3_1 } from "openapi-types";
4
+ export interface ValidationResult {
5
+ isValid: boolean;
6
+ errors: ErrorObject[];
7
+ warnings: ErrorObject[];
6
8
  }
7
- export interface Logger {
8
- debug: LogFunction;
9
- info: LogFunction;
10
- warn: LogFunction;
11
- error: LogFunction;
12
- child?(bindings: Record<string, any>): Logger;
9
+ type Modify<T, R> = Omit<T, keyof R> & R;
10
+ export type ZuploHttpMethods = OpenAPIV3_1.HttpMethods | string;
11
+ export declare const ZUPLO_OPEN_API_VENDOR_PREFIX = "x-zuplo";
12
+ export declare const OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG = "x-internal";
13
+ export declare const ZUPLO_OPEN_API_PATH_KEY: "x-zuplo-path";
14
+ export declare const ZUPLO_OPEN_API_ROUTE_KEY: "x-zuplo-route";
15
+ export type ZuploOpenApiDocument = Modify<OpenAPIV3_1.Document<ZuploOpenApiOperationExtension>, {
16
+ paths: ZuploOpenApiPathsObject | undefined;
17
+ }>;
18
+ export type ZuploOpenApiPathsObject = Record<string, ZuploOpenApiPathItemObject | undefined>;
19
+ export type ZuploOpenApiPathItemObject = Modify<OpenAPIV3_1.PathItemObject<ZuploOpenApiOperationExtension> & ZuploOpenApiPathItemExtension, {
20
+ get?: ZuploOpenApiOperationObject;
21
+ put?: ZuploOpenApiOperationObject;
22
+ post?: ZuploOpenApiOperationObject;
23
+ delete?: ZuploOpenApiOperationObject;
24
+ options?: ZuploOpenApiOperationObject;
25
+ head?: ZuploOpenApiOperationObject;
26
+ patch?: ZuploOpenApiOperationObject;
27
+ trace?: ZuploOpenApiOperationObject;
28
+ }>;
29
+ export interface ZuploOpenApiPathItemExtension {
30
+ [ZUPLO_OPEN_API_PATH_KEY]?: ZuploOpenApiPathItemProperties;
13
31
  }
14
- export interface BuildLogFn {
15
- (message: string): void;
32
+ export interface ZuploOpenApiPathItemProperties {
33
+ pathMode: PathMode;
16
34
  }
17
- export type BuildLogLine = [
18
- timestamp: string,
19
- severity: string,
20
- message: string,
21
- status: string,
22
- logId: string
23
- ];
24
- export interface StageOutputLogger {
25
- info: BuildLogFn;
26
- warn: BuildLogFn;
27
- error: BuildLogFn;
28
- }
29
- export interface OutputLogger {
30
- child(name: DeploymentStageName): StageOutputLogger;
31
- }
32
- export declare class SilentOutput implements OutputLogger {
33
- child: () => {
34
- info: () => void;
35
- warn: () => void;
36
- error: () => void;
37
- };
35
+ export type PathMode = "open-api" | "url-pattern";
36
+ export type ZuploOpenApiOperationObject = Modify<OpenAPIV3_1.OperationObject<ZuploOpenApiOperationExtension>, {
37
+ operationId: string;
38
+ }>;
39
+ export type ZuploOpenApiOperationProperties = Omit<RouteConfiguration, "operationId" | "path" | "methods" | "label" | "key" | "summary" | "description" | "parameters" | "responses" | "tags" | "version" | "raw">;
40
+ export interface ZuploOpenApiOperationExtension {
41
+ [ZUPLO_OPEN_API_ROUTE_KEY]?: ZuploOpenApiOperationProperties;
42
+ [OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG]?: boolean;
38
43
  }
39
44
  export {};
40
45
  //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAIA,KAAK,mBAAmB,GAAG,KAAK,GAAG,YAAY,CAAC;AAEhD,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAE/E,UAAU,WAAW;IACnB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACnD,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CACrC;AACD,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,WAAW,CAAC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,GACX,MAAM,GACN,SAAS,GACT,KAAK,CACR,CAAC;AACF,MAAM,WAAW,8BAA8B;IAC7C,CAAC,wBAAwB,CAAC,CAAC,EAAE,+BAA+B,CAAC;IAC7D,CAAC,qCAAqC,CAAC,CAAC,EAAE,OAAO,CAAC;CACnD"}
@@ -1,12 +1,6 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable no-console */
3
- export class SilentOutput {
4
- child = () => ({
5
- /* eslint-disable @typescript-eslint/no-empty-function */
6
- info: () => { },
7
- warn: () => { },
8
- error: () => { },
9
- /* eslint-enable @typescript-eslint/no-empty-function */
10
- });
11
- }
1
+ // TODO: This should all be moved to the backend eventually
2
+ export const ZUPLO_OPEN_API_VENDOR_PREFIX = "x-zuplo";
3
+ export const OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG = "x-internal";
4
+ export const ZUPLO_OPEN_API_PATH_KEY = `${ZUPLO_OPEN_API_VENDOR_PREFIX}-path`;
5
+ export const ZUPLO_OPEN_API_ROUTE_KEY = `${ZUPLO_OPEN_API_VENDOR_PREFIX}-route`;
12
6
  //# sourceMappingURL=interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,+BAA+B;AAyC/B,MAAM,OAAO,YAAY;IACvB,KAAK,GAAG,GAAG,EAAE,CAAC,CAAC;QACb,yDAAyD;QACzD,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;QACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;QACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;QACf,wDAAwD;KACzD,CAAC,CAAC;CACJ"}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAaA,2DAA2D;AAC3D,MAAM,CAAC,MAAM,4BAA4B,GAAG,SAAS,CAAC;AACtD,MAAM,CAAC,MAAM,qCAAqC,GAAG,YAAY,CAAC;AAClE,MAAM,CAAC,MAAM,uBAAuB,GAClC,GAAG,4BAA4B,OAAgB,CAAC;AAClD,MAAM,CAAC,MAAM,wBAAwB,GACnC,GAAG,4BAA4B,QAAiB,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { OpenAPIV3_1 } from "openapi-types";
2
+ import { ZuploOpenApiDocument } from "./interfaces.js";
3
+ export type MergeMode = "operation-id" | "path-method";
4
+ export declare const OPERATION_PATH_MERGE_DELIMITER = ">";
5
+ export declare const parseOpenApiFile: (file: File) => Promise<ZuploOpenApiDocument | OpenAPIV3_1.Document<{}>>;
6
+ export declare const mergeOpenApiDocuments: (originalDocument: ZuploOpenApiDocument, newDocument: OpenAPIV3_1.Document | ZuploOpenApiDocument, mergeMode: MergeMode) => {
7
+ mergedDocument: ZuploOpenApiDocument;
8
+ created: Set<string>;
9
+ merged: Set<string>;
10
+ retained: Set<string>;
11
+ };
12
+ export declare const mergeOpenApiDocumentOnOperationId: (originalDocument: ZuploOpenApiDocument, newDocument: ZuploOpenApiDocument | OpenAPIV3_1.Document) => {
13
+ mergedDocument: ZuploOpenApiDocument;
14
+ created: Set<string>;
15
+ merged: Set<string>;
16
+ retained: Set<string>;
17
+ };
18
+ export declare const mergeOpenApiDocumentOnPathMethod: (originalDocument: ZuploOpenApiDocument, newDocument: ZuploOpenApiDocument | OpenAPIV3_1.Document) => {
19
+ mergedDocument: ZuploOpenApiDocument;
20
+ created: Set<string>;
21
+ merged: Set<string>;
22
+ retained: Set<string>;
23
+ };
24
+ export declare const getOperationKey: (method: string, path: string) => string;
25
+ /**
26
+ * Add operation ID to any operations that don't have one, this makes
27
+ * onboarding smoother for new users
28
+ */
29
+ export declare const addOperationIdsAsNecessary: (openApi: OpenAPIV3_1.Document | ZuploOpenApiDocument) => ZuploOpenApiDocument;
30
+ /**
31
+ *
32
+ */
33
+ export declare const removeOperationsWithoutAnId: (openApi: OpenAPIV3_1.Document | ZuploOpenApiDocument) => ZuploOpen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AyCtD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,YAC5B,WAAW,CAAC,QAAQ,GAAG,oBAAoB,KACnD,oBA4BF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,YAC7B,WAAW,CAAC,QAAQ,GAAG,oBAAoB,KACnD,oBAmBF,CAAC"}
@@ -0,0 +1,454 @@
1
+ import yaml from "js-yaml";
2
+ import { v4 } from "uuid";
3
+ import { OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG, ZUPLO_OPEN_API_PATH_KEY, ZUPLO_OPEN_API_ROUTE_KEY, } from "./interfaces.js";
4
+ const METHODS = [
5
+ "get",
6
+ "put",
7
+ "post",
8
+ "delete",
9
+ "options",
10
+ "head",
11
+ "patch",
12
+ "trace",
13
+ ];
14
+ export const OPERATION_PATH_MERGE_DELIMITER = ">";
15
+ export const parseOpenApiFile = async (file) => {
16
+ const fileText = await file.text();
17
+ const fileName = file.name;
18
+ if (fileName.endsWith(".json")) {
19
+ return JSON.parse(fileText);
20
+ }
21
+ return yaml.load(fileText);
22
+ };
23
+ export const mergeOpenApiDocuments = (originalDocument, newDocument, mergeMode) => {
24
+ if (mergeMode === "operation-id") {
25
+ return mergeOpenApiDocumentOnOperationId(originalDocument, newDocument);
26
+ }
27
+ return mergeOpenApiDocumentOnPathMethod(originalDocument, newDocument);
28
+ };
29
+ export const mergeOpenApiDocumentOnOperationId = (originalDocument, newDocument) => {
30
+ // Index the original operations by operationId
31
+ const originalIndex = indexOperationsById(originalDocument);
32
+ const originalPaths = originalDocument.paths || {};
33
+ // All original paths are retained by default
34
+ const mergedPaths = structuredClone(originalPaths);
35
+ const newPaths = newDocument.paths || {};
36
+ const created = new Set();
37
+ const merged = new Set();
38
+ const retained = new Set();
39
+ // Traverse each (path, method) in the new spec
40
+ for (const newPath of Object.keys(newPaths)) {
41
+ const newPathItemObject = newPaths[newPath];
42
+ METHODS.forEach((newMethod) => {
43
+ const newOperationObject = newPathItemObject[newMethod];
44
+ if (!newOperationObject) {
45
+ // If this method doesn't exist in the new spec, we can skip it
46
+ return;
47
+ }
48
+ const newOperationId = newOperationObject?.operationId;
49
+ if (!newOperationId) {
50
+ throw new Error(`OperationId is required for all operations. OperationId missing on ${getOperationKey(newMethod, newPath)}. Please add an operationId to all operations before merging.`);
51
+ }
52
+ const operationWithMatchingOperationId = originalIndex[newOperationId];
53
+ const operationAtMatchingPathMethod = originalPaths[newPath]?.[newMethod];
54
+ // Check if the operationId exists in the original spec
55
+ if (!operationWithMatchingOperationId) {
56
+ // If there's already an operation at the path + method, throw exception
57
+ if (operationAtMatchingPathMethod) {
58
+ throw new Error(`Operation '${newOperationId}' has a matching path/method to an existing operation at ${getOperationKey(newMethod, newPath)}, but a different operationId. Either update the operationId on the existing operation or remove it entirely.`);
59
+ }
60
+ // If there is no operation with the same operationId and nothing at the
61
+ // new path/method, we can safely add the new operation
62
+ if (!mergedPaths[newPath]) {
63
+ mergedPaths[newPath] = {};
64
+ }
65
+ mergedPaths[newPath] = updatePathItemForOperationIdMerge(mergedPaths[newPath], newOperationObject, newMethod);
66
+ created.add(newOperationId);
67
+ return;
68
+ }
69
+ // If the operationID exists in the original spec and there is not
70
+ // an operation at the new path/method, we remove the old operation
71
+ // and add the new one
72
+ if (!operationAtMatchingPathMethod) {
73
+ const { path: oldPath, method: oldMethod } = operationWithMatchingOperationId;
74
+ const oldOperationObject = originalPaths[oldPath]?.[oldMethod];
75
+ if (!mergedPaths[newPath]) {
76
+ mergedPaths[newPath] = {};
77
+ }
78
+ mergedPaths[newPath] = updatePathItemForOperationIdMerge(mergedPaths[newPath], newOperationObject, newMethod, {
79
+ [ZUPLO_OPEN_API_ROUTE_KEY]: oldOperationObject?.[ZUPLO_OPEN_API_ROUTE_KEY],
80
+ [OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG]: oldOperationObject?.[OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG],
81
+ });
82
+ // The operation must have been moved to a new path or the method was
83
+ // changed (otherwise operationAtMatchingPathMethod would not be
84
+ // undefined). Remove the old operation to avoid duplicates.
85
+ // @ts-expect-error - We know this operation exists
86
+ delete mergedPaths[oldPath][oldMethod];
87
+ merged.add(newOperationId);
88
+ return;
89
+ }
90
+ const operationAtMatchingPathMethodOperationId = operationAtMatchingPathMethod?.operationId;
91
+ // If the operation at the new path/method has the same operationId then
92
+ // its a merge
93
+ if (operationAtMatchingPathMethodOperationId === newOperationId) {
94
+ const { path: oldPath, method: oldMethod } = operationWithMatchingOperationId;
95
+ const oldOperationObject = originalPaths[oldPath]?.[oldMethod];
96
+ if (!mergedPaths[newPath]) {
97
+ mergedPaths[newPath] = {};
98
+ }
99
+ mergedPaths[newPath] = updatePathItemForOperationIdMerge(mergedPaths[newPath], newOperationObject, newMethod, {
100
+ [ZUPLO_OPEN_API_ROUTE_KEY]: oldOperationObject?.[ZUPLO_OPEN_API_ROUTE_KEY],
101
+ [OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG]: oldOperationObject?.[OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG],
102
+ });
103
+ merged.add(newOperationId);
104
+ return;
105
+ }
106
+ throw new Error(`Operation '${newOperationId}' has a matching path/method to an existing operation at ${getOperationKey(newMethod, newPath)}, but a different operationId. Either update the operationId on the existing operation or remove it entirely.`);
107
+ });
108
+ }
109
+ // Every existing operation that wasn't merged is retained
110
+ Object.entries(originalIndex).forEach(([operationId]) => {
111
+ if (!merged.has(operationId) && !created.has(operationId)) {
112
+ retained.add(operationId);
113
+ }
114
+ });
115
+ // NOTE: Technically we don't need to merge metadata like info, servers, etc.
116
+ // since the operationId merge is purely about the operations themselves. Some
117
+ // of these properties can be referenced by the merged operations
118
+ // (ex. components) so we just merge all the high level properties
119
+ const mergedDocument = {
120
+ ...originalDocument,
121
+ info: newDocument.info,
122
+ openapi: mergeOpenApiVersion(originalDocument.openapi, newDocument.openapi),
123
+ paths: mergedPaths,
124
+ };
125
+ const mergedComponents = mergeComponents(originalDocument.components, newDocument.components);
126
+ if (mergedComponents) {
127
+ mergedDocument.components = mergedComponents;
128
+ }
129
+ if (newDocument.servers) {
130
+ mergedDocument.servers = newDocument.servers;
131
+ }
132
+ if (newDocument.security) {
133
+ mergedDocument.security = newDocument.security;
134
+ }
135
+ if (newDocument.tags) {
136
+ mergedDocument.tags = newDocument.tags;
137
+ }
138
+ if (newDocument.externalDocs) {
139
+ mergedDocument.externalDocs = newDocument.externalDocs;
140
+ }
141
+ if (newDocument.jsonSchemaDialect) {
142
+ mergedDocument.jsonSchemaDialect = newDocument.jsonSchemaDialect;
143
+ }
144
+ return {
145
+ mergedDocument,
146
+ created,
147
+ merged,
148
+ retained,
149
+ };
150
+ };
151
+ /**
152
+ * @description Merges the operation into the path item. The old operation's
153
+ * Zuplo configuration may need to be retained through the merge process.
154
+ * @param currentPathItem Mid-merge path item. Can be the original, or could
155
+ * have been modified during the merge process
156
+ * @param newOperationObject The operation object we are merging in
157
+ * @returns
158
+ */
159
+ const updatePathItemForOperationIdMerge = (currentPathItem, newOperationObject, method, zuploExtensionsToRetain) => {
160
+ // Need to do some funky type casting to make TS happy
161
+ const newZuploOperationObject = structuredClone(newOperationObject);
162
+ // Retain the zuplo extensions if they exist
163
+ if (zuploExtensionsToRetain) {
164
+ const newZuploOperationProperties = ZUPLO_OPEN_API_ROUTE_KEY in newOperationObject
165
+ ? newOperationObject[ZUPLO_OPEN_API_ROUTE_KEY]
166
+ : undefined;
167
+ if (newZuploOperationProperties) {
168
+ newZuploOperationObject[ZUPLO_OPEN_API_ROUTE_KEY] =
169
+ newZuploOperationProperties;
170
+ }
171
+ else if (zuploExtensionsToRetain[ZUPLO_OPEN_API_ROUTE_KEY]) {
172
+ newZuploOperationObject[ZUPLO_OPEN_API_ROUTE_KEY] =
173
+ zuploExtensionsToRetain[ZUPLO_OPEN_API_ROUTE_KEY];
174
+ }
175
+ const newOpenApiInternalProperty = OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG in newOperationObject
176
+ ? newOperationObject[OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG]
177
+ : undefined;
178
+ if (newOpenApiInternalProperty) {
179
+ newZuploOperationObject[OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG] =
180
+ newOpenApiInternalProperty;
181
+ }
182
+ else if (zuploExtensionsToRetain[OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG]) {
183
+ newZuploOperationObject[OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG] =
184
+ zuploExtensionsToRetain[OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG];
185
+ }
186
+ }
187
+ // NOTE: Unlike the path-method merge, we don't update the path item's
188
+ // metadata (ex. summary, description) since this is purely an operation-based
189
+ // merge
190
+ return {
191
+ ...currentPathItem,
192
+ [method]: newZuploOperationObject,
193
+ };
194
+ };
195
+ export const mergeOpenApiDocumentOnPathMethod = (originalDocument, newDocument) => {
196
+ const created = new Set();
197
+ const merged = new Set();
198
+ let paths = structuredClone(originalDocument.paths);
199
+ if (newDocument.paths) {
200
+ paths = Object.entries(newDocument.paths).reduce((mergedPaths, [path, pathObject]) => {
201
+ const existingEntry = mergedPaths[path];
202
+ if (!existingEntry) {
203
+ mergedPaths[path] = pathObject;
204
+ METHODS.forEach((method) => {
205
+ const operation = pathObject[method];
206
+ if (operation) {
207
+ created.add(getOperationKey(method, path));
208
+ }
209
+ });
210
+ }
211
+ else {
212
+ mergedPaths[path] = mergePathItems(existingEntry, pathObject);
213
+ METHODS.forEach((method) => {
214
+ const newOperation = pathObject[method];
215
+ const existingOperation = existingEntry[method];
216
+ if (!existingOperation && !newOperation) {
217
+ // Nothing changed
218
+ return;
219
+ }
220
+ if (existingOperation && newOperation) {
221
+ // If there is a newOperation it will be merged into
222
+ // existingOperation
223
+ merged.add(getOperationKey(method, path));
224
+ return;
225
+ }
226
+ if (newOperation) {
227
+ // If there is no existing operation, we add the new one
228
+ created.add(getOperationKey(method, path));
229
+ }
230
+ });
231
+ }
232
+ return mergedPaths;
233
+ }, originalDocument.paths ?? {});
234
+ }
235
+ const retained = new Set(getAllOperationKeys(originalDocument.paths ?? {}).filter((operationKey) => !created.has(operationKey) && !merged.has(operationKey)));
236
+ const mergedDocument = {
237
+ info: newDocument.info,
238
+ openapi: mergeOpenApiVersion(originalDocument.openapi, newDocument.openapi),
239
+ components: mergeComponents(originalDocument.components, newDocument.components),
240
+ jsonSchemaDialect: newDocument.jsonSchemaDialect ?? originalDocument.jsonSchemaDialect,
241
+ servers: newDocument.servers ?? originalDocument.servers,
242
+ security: newDocument.security ?? originalDocument.security,
243
+ tags: newDocument.tags ?? originalDocument.tags,
244
+ externalDocs: newDocument.externalDocs ?? originalDocument.externalDocs,
245
+ paths,
246
+ };
247
+ return {
248
+ mergedDocument,
249
+ created,
250
+ merged,
251
+ retained,
252
+ };
253
+ };
254
+ const mergeComponents = (originalComponents, newComponents) => {
255
+ if (!originalComponents) {
256
+ return newComponents;
257
+ }
258
+ if (!newComponents) {
259
+ return originalComponents;
260
+ }
261
+ // We have to merge each component property to make sure old ones don't get
262
+ // get deleted
263
+ const { schemas, responses, parameters, examples, requestBodies, headers, securitySchemes, links, callbacks, pathItems, } = originalComponents;
264
+ const { schemas: newSchemas, responses: newResponses, parameters: newParameters, examples: newExamples, requestBodies: newRequestBodies, headers: newHeaders, securitySchemes: newSecuritySchemes, links: newLinks, callbacks: newCallbacks, pathItems: newPathItems, } = newComponents;
265
+ return {
266
+ schemas: schemas ? { ...schemas, ...newSchemas } : newSchemas,
267
+ responses: responses ? { ...responses, ...newResponses } : newResponses,
268
+ parameters: parameters
269
+ ? { ...parameters, ...newParameters }
270
+ : newParameters,
271
+ examples: examples ? { ...examples, ...newExamples } : newExamples,
272
+ requestBodies: requestBodies
273
+ ? { ...requestBodies, ...newRequestBodies }
274
+ : newRequestBodies,
275
+ headers: headers ? { ...headers, ...newHeaders } : newHeaders,
276
+ securitySchemes: securitySchemes
277
+ ? { ...securitySchemes, ...newSecuritySchemes }
278
+ : newSecuritySchemes,
279
+ links: links ? { ...links, ...newLinks } : newLinks,
280
+ callbacks: callbacks ? { ...callbacks, ...newCallbacks } : newCallbacks,
281
+ pathItems: pathItems ? { ...pathItems, ...newPathItems } : newPathItems,
282
+ };
283
+ };
284
+ /**
285
+ * @description OpenAPI 3.1.0 is a superset of 3.0 so we should keep the
286
+ * document as 3.1 if it already is, or upgrade it to 3.1 if the new document is
287
+ */
288
+ const mergeOpenApiVersion = (originalVersion, newDocumentVersion) => {
289
+ if (originalVersion.startsWith("3.1.")) {
290
+ return originalVersion;
291
+ }
292
+ if (newDocumentVersion.startsWith("3.1.")) {
293
+ return newDocumentVersion;
294
+ }
295
+ return originalVersion;
296
+ };
297
+ const mergePathItems = (originalPathItem, newPathItem) => {
298
+ const { summary, description, get, put, post, delete: deleteOperation, options, head, patch, trace, servers, parameters, } = originalPathItem;
299
+ const zuploPathProperties = originalPathItem[ZUPLO_OPEN_API_PATH_KEY];
300
+ const newZuploPathProperty = typeof newPathItem === "object" &&
301
+ newPathItem !== null &&
302
+ ZUPLO_OPEN_API_PATH_KEY in newPathItem
303
+ ? newPathItem[ZUPLO_OPEN_API_PATH_KEY]
304
+ : undefined;
305
+ const { summary: newSummary, description: newDescription, get: newGetOperation, put: newPutOperation, post: newPostOperation, delete: newDeleteOperation, options: newOptionsOperation, head: newHeadOperation, patch: newPatchOperation, trace: newTraceOperation, servers: newServers, parameters: newParameters, } = newPathItem;
306
+ return {
307
+ summary: newSummary ?? summary,
308
+ description: newDescription ?? description,
309
+ [ZUPLO_OPEN_API_PATH_KEY]: newZuploPathProperty ?? zuploPathProperties,
310
+ servers: newServers ?? servers,
311
+ parameters: newParameters ?? parameters,
312
+ get: mergeOperationObjects(get, newGetOperation),
313
+ put: mergeOperationObjects(put, newPutOperation),
314
+ post: mergeOperationObjects(post, newPostOperation),
315
+ delete: mergeOperationObjects(deleteOperation, newDeleteOperation),
316
+ options: mergeOperationObjects(options, newOptionsOperation),
317
+ head: mergeOperationObjects(head, newHeadOperation),
318
+ patch: mergeOperationObjects(patch, newPatchOperation),
319
+ trace: mergeOperationObjects(trace, newTraceOperation),
320
+ };
321
+ };
322
+ const mergeOperationObjects = (originalOperationObject, newOperationObject) => {
323
+ if (!newOperationObject) {
324
+ // If it stopped existing in the new version, we leave the original untouched
325
+ return originalOperationObject;
326
+ }
327
+ // We preserve the gateway's behavior unless explicitly overridden
328
+ const originalZuploProperties = originalOperationObject?.[ZUPLO_OPEN_API_ROUTE_KEY];
329
+ const originalHiddenSetting = originalOperationObject?.[OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG];
330
+ return {
331
+ operationId: v4(),
332
+ [ZUPLO_OPEN_API_ROUTE_KEY]: originalZuploProperties,
333
+ [OPEN_API_INTERNAL_PROPERTY_VENDOR_TAG]: originalHiddenSetting,
334
+ ...newOperationObject,
335
+ };
336
+ };
337
+ const getAllOperationKeys = (pathsObject) => {
338
+ return Object.entries(pathsObject)
339
+ .map(([path, pathObject]) => {
340
+ const pathItemObject = pathObject;
341
+ const { get, put, post, delete: deleteOperation, options, head, patch, trace, } = pathItemObject;
342
+ const methods = [];
343
+ if (get) {
344
+ methods.push("get");
345
+ }
346
+ if (put) {
347
+ methods.push("put");
348
+ }
349
+ if (post) {
350
+ methods.push("post");
351
+ }
352
+ if (deleteOperation) {
353
+ methods.push("delete");
354
+ }
355
+ if (options) {
356
+ methods.push("options");
357
+ }
358
+ if (head) {
359
+ methods.push("head");
360
+ }
361
+ if (patch) {
362
+ methods.push("patch");
363
+ }
364
+ if (trace) {
365
+ methods.push("trace");
366
+ }
367
+ return methods.map((method) => getOperationKey(method, path));
368
+ })
369
+ .flat();
370
+ };
371
+ export const getOperationKey = (method, path) => `${method}${OPERATION_PATH_MERGE_DELIMITER}${path}`;
372
+ /**
373
+ * Create an index of operations by their operationId
374
+ *
375
+ * @param openapiSpec The OpenAPI specification object
376
+ * @returns A map of operationId -> { path, method }
377
+ */
378
+ const indexOperationsById = (openapiSpec) => {
379
+ const operationsIndex = {};
380
+ const paths = openapiSpec.paths;
381
+ if (paths) {
382
+ Object.entries(paths).forEach(([path, pathItem]) => {
383
+ if (pathItem) {
384
+ METHODS.forEach((method) => {
385
+ const operation = pathItem[method];
386
+ if (operation?.operationId) {
387
+ operationsIndex[operation.operationId] = {
388
+ path,
389
+ method,
390
+ };
391
+ }
392
+ });
393
+ }
394
+ });
395
+ }
396
+ return operationsIndex;
397
+ };
398
+ /**
399
+ * Add operation ID to any operations that don't have one, this makes
400
+ * onboarding smoother for new users
401
+ */
402
+ export const addOperationIdsAsNecessary = (openApi) => {
403
+ const paths = openApi.paths;
404
+ if (!paths) {
405
+ return openApi;
406
+ }
407
+ for (const path of Object.keys(paths)) {
408
+ const pathItem = paths[path];
409
+ if (!pathItem) {
410
+ continue;
411
+ }
412
+ const methods = [
413
+ "get",
414
+ "put",
415
+ "post",
416
+ "delete",
417
+ "options",
418
+ "head",
419
+ "patch",
420
+ "trace",
421
+ ];
422
+ for (const method of methods) {
423
+ const operation = pathItem[method];
424
+ if (operation && !operation.operationId) {
425
+ operation.operationId = v4();
426
+ }
427
+ }
428
+ }
429
+ return openApi;
430
+ };
431
+ /**
432
+ *
433
+ */
434
+ export const removeOperationsWithoutAnId = (openApi) => {
435
+ const newDocument = { ...openApi };
436
+ const paths = newDocument.paths;
437
+ if (!paths) {
438
+ return openApi;
439
+ }
440
+ for (const path of Object.keys(paths)) {
441
+ const pathItem = paths[path];
442
+ if (!pathItem) {
443
+ continue;
444
+ }
445
+ for (const method of METHODS) {
446
+ const operation = pathItem[method];
447
+ if (operation && !operation.operationId) {
448
+ delete pathItem[method];
449
+ }
450
+ }
451
+ }
452
+ return openApi;
453
+ };
454
+ //# sourceMappingURL=openapi-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi-utils.js","sourceRoot":"","sources":["../src/openapi-utils.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EACL,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C;AACzC,CAAC,CAAC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@zuplo/openapi-tools",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.0.0",
5
+ "version": "6.40.11",
6
6
  "description": "Tooling for OpenAPI files",
7
7
  "repository": {
8
8
  "type": "git",
@@ -22,7 +22,16 @@
22
22
  "author": "Zuplo",
23
23
  "license": "Copyright 2021",
24
24
  "scripts": {
25
- "build": "tsc --build"
25
+ "build": "tsc --build",
26
+ "test": "mocha",
27
+ "test:debug": "mocha --timeout 0 --parallel=false"
28
+ },
29
+ "dependencies": {
30
+ "@zuplo/runtime": "^6.40.11",
31
+ "ajv": "^8.17.1",
32
+ "js-yaml": "^4.1.0",
33
+ "openapi-types": "^12.1.3",
34
+ "uuid": "^11.1.0"
26
35
  },
27
36
  "devDependencies": {
28
37
  "@types/chai": "^5.0.0",
@@ -32,4 +41,4 @@
32
41
  "mocha": "^10.7.3",
33
42
  "typescript": "^5.6.2"
34
43
  }
35
- }
44
+ }