@skmtc/core 0.0.605 → 0.0.606
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/esm/oas/server/Server.d.ts +3 -0
- package/esm/oas/server/Server.d.ts.map +1 -1
- package/esm/oas/server/Server.js +9 -1
- package/esm/oas/server/toServerV3.d.ts.map +1 -1
- package/esm/oas/server/toServerV3.js +5 -4
- package/esm/oas/serverVariable/ServerVariable.d.ts +21 -0
- package/esm/oas/serverVariable/ServerVariable.d.ts.map +1 -0
- package/esm/oas/serverVariable/ServerVariable.js +54 -0
- package/esm/oas/serverVariable/toServerVariableV3.d.ts +20 -0
- package/esm/oas/serverVariable/toServerVariableV3.d.ts.map +1 -0
- package/esm/oas/serverVariable/toServerVariableV3.js +29 -0
- package/package.json +1 -1
- package/script/oas/server/Server.d.ts +3 -0
- package/script/oas/server/Server.d.ts.map +1 -1
- package/script/oas/server/Server.js +9 -1
- package/script/oas/server/toServerV3.d.ts.map +1 -1
- package/script/oas/server/toServerV3.js +5 -4
- package/script/oas/serverVariable/ServerVariable.d.ts +21 -0
- package/script/oas/serverVariable/ServerVariable.d.ts.map +1 -0
- package/script/oas/serverVariable/ServerVariable.js +58 -0
- package/script/oas/serverVariable/toServerVariableV3.d.ts +20 -0
- package/script/oas/serverVariable/toServerVariableV3.d.ts.map +1 -0
- package/script/oas/serverVariable/toServerVariableV3.js +35 -0
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import "../../_dnt.polyfills.js";
|
|
2
2
|
import type { ToJsonSchemaOptions } from '../schema/Schema.js';
|
|
3
3
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
|
+
import type { OasServerVariable } from '../serverVariable/ServerVariable.js';
|
|
4
5
|
export type ServerFields = {
|
|
5
6
|
description?: string | undefined;
|
|
6
7
|
url: string;
|
|
8
|
+
variables?: Record<string, OasServerVariable> | undefined;
|
|
7
9
|
extensionFields?: Record<string, unknown>;
|
|
8
10
|
};
|
|
9
11
|
export declare class OasServer {
|
|
10
12
|
oasType: 'server';
|
|
11
13
|
description: string | undefined;
|
|
12
14
|
url: string;
|
|
15
|
+
variables: Record<string, OasServerVariable> | undefined;
|
|
13
16
|
extensionFields: Record<string, unknown> | undefined;
|
|
14
17
|
constructor(fields: ServerFields);
|
|
15
18
|
isRef(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../../src/oas/server/Server.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../../src/oas/server/Server.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAE5E,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAAS,CAAA;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,qBAAa,SAAS;IACpB,OAAO,EAAE,QAAQ,CAAW;IAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAAS,CAAA;IACxD,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;gBACxC,MAAM,EAAE,YAAY;IAOhC,KAAK;IAIL,OAAO,IAAI,SAAS;IAIpB,WAAW,IAAI,SAAS;IAIxB,YAAY,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,CAAC,YAAY;CAOpE"}
|
package/esm/oas/server/Server.js
CHANGED
|
@@ -19,6 +19,12 @@ export class OasServer {
|
|
|
19
19
|
writable: true,
|
|
20
20
|
value: void 0
|
|
21
21
|
});
|
|
22
|
+
Object.defineProperty(this, "variables", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: void 0
|
|
27
|
+
});
|
|
22
28
|
Object.defineProperty(this, "extensionFields", {
|
|
23
29
|
enumerable: true,
|
|
24
30
|
configurable: true,
|
|
@@ -27,6 +33,7 @@ export class OasServer {
|
|
|
27
33
|
});
|
|
28
34
|
this.description = fields.description;
|
|
29
35
|
this.url = fields.url;
|
|
36
|
+
this.variables = fields.variables;
|
|
30
37
|
this.extensionFields = fields.extensionFields;
|
|
31
38
|
}
|
|
32
39
|
isRef() {
|
|
@@ -41,7 +48,8 @@ export class OasServer {
|
|
|
41
48
|
toJsonSchema(_options) {
|
|
42
49
|
return {
|
|
43
50
|
description: this.description,
|
|
44
|
-
url: this.url
|
|
51
|
+
url: this.url,
|
|
52
|
+
variables: this.variables
|
|
45
53
|
};
|
|
46
54
|
}
|
|
47
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toServerV3.d.ts","sourceRoot":"","sources":["../../../src/oas/server/toServerV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIvC,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE,CAAA;IACjC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,WAAW,yBAA0B,eAAe,KAAG,SAAS,EAI5E,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE,GAAG,SAAS,CAAA;IAC7C,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,mBAAmB,yBAG7B,uBAAuB,KAAG,SAAS,EAAE,GAAG,SAM1C,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,SAAS,CAAC,YAAY,CAAA;IAC9B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,UAAU,wBAAyB,cAAc,KAAG,
|
|
1
|
+
{"version":3,"file":"toServerV3.d.ts","sourceRoot":"","sources":["../../../src/oas/server/toServerV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIvC,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE,CAAA;IACjC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,WAAW,yBAA0B,eAAe,KAAG,SAAS,EAI5E,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE,GAAG,SAAS,CAAA;IAC7C,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,mBAAmB,yBAG7B,uBAAuB,KAAG,SAAS,EAAE,GAAG,SAM1C,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,SAAS,CAAC,YAAY,CAAA;IAC9B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,UAAU,wBAAyB,cAAc,KAAG,SAgBhE,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OasServer } from './Server.js';
|
|
2
2
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
3
|
+
import { toOptionalServerVariablesV3 } from '../serverVariable/toServerVariableV3.js';
|
|
3
4
|
export const toServersV3 = ({ servers, context }) => {
|
|
4
5
|
return servers.map((server, index) => {
|
|
5
6
|
return context.trace(server.url ?? index, () => toServerV3({ server, context }));
|
|
@@ -12,17 +13,17 @@ export const toOptionalServersV3 = ({ servers, context }) => {
|
|
|
12
13
|
return toServersV3({ servers, context });
|
|
13
14
|
};
|
|
14
15
|
export const toServerV3 = ({ server, context }) => {
|
|
15
|
-
const { description, url, ...skipped } = server;
|
|
16
|
+
const { description, url, variables, ...skipped } = server;
|
|
16
17
|
const extensionFields = toSpecificationExtensionsV3({
|
|
17
18
|
skipped,
|
|
18
19
|
parent: server,
|
|
19
20
|
context,
|
|
20
21
|
parentType: 'server'
|
|
21
22
|
});
|
|
22
|
-
|
|
23
|
+
return new OasServer({
|
|
23
24
|
description,
|
|
24
25
|
url,
|
|
26
|
+
variables: toOptionalServerVariablesV3({ serverVariables: variables, context }),
|
|
25
27
|
extensionFields
|
|
26
|
-
};
|
|
27
|
-
return new OasServer(fields);
|
|
28
|
+
});
|
|
28
29
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ToJsonSchemaOptions } from '../schema/Schema.js';
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
export type ServerVariableFields = {
|
|
4
|
+
description?: string | undefined;
|
|
5
|
+
default: string;
|
|
6
|
+
enums?: string[] | undefined;
|
|
7
|
+
extensionFields?: Record<string, unknown>;
|
|
8
|
+
};
|
|
9
|
+
export declare class OasServerVariable {
|
|
10
|
+
oasType: 'serverVariable';
|
|
11
|
+
description: string | undefined;
|
|
12
|
+
default: string;
|
|
13
|
+
enums?: string[] | undefined;
|
|
14
|
+
extensionFields: Record<string, unknown> | undefined;
|
|
15
|
+
constructor(fields: ServerVariableFields);
|
|
16
|
+
isRef(): boolean;
|
|
17
|
+
resolve(): OasServerVariable;
|
|
18
|
+
resolveOnce(): OasServerVariable;
|
|
19
|
+
toJsonSchema(_options: ToJsonSchemaOptions): OpenAPIV3.ServerVariableObject;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=ServerVariable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerVariable.d.ts","sourceRoot":"","sources":["../../../src/oas/serverVariable/ServerVariable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,qBAAa,iBAAiB;IAC5B,OAAO,EAAE,gBAAgB,CAAmB;IAC5C,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;gBACxC,MAAM,EAAE,oBAAoB;IAOxC,KAAK;IAIL,OAAO,IAAI,iBAAiB;IAI5B,WAAW,IAAI,iBAAiB;IAIhC,YAAY,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,CAAC,oBAAoB;CAO5E"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export class OasServerVariable {
|
|
2
|
+
constructor(fields) {
|
|
3
|
+
Object.defineProperty(this, "oasType", {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
configurable: true,
|
|
6
|
+
writable: true,
|
|
7
|
+
value: 'serverVariable'
|
|
8
|
+
});
|
|
9
|
+
Object.defineProperty(this, "description", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: void 0
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(this, "default", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: void 0
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(this, "enums", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: void 0
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(this, "extensionFields", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true,
|
|
31
|
+
value: void 0
|
|
32
|
+
});
|
|
33
|
+
this.description = fields.description;
|
|
34
|
+
this.default = fields.default;
|
|
35
|
+
this.enums = fields.enums;
|
|
36
|
+
this.extensionFields = fields.extensionFields;
|
|
37
|
+
}
|
|
38
|
+
isRef() {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
resolve() {
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
resolveOnce() {
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
toJsonSchema(_options) {
|
|
48
|
+
return {
|
|
49
|
+
description: this.description,
|
|
50
|
+
default: this.default,
|
|
51
|
+
enum: this.enums
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ParseContext } from '../../context/ParseContext.js';
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
import { OasServerVariable } from './ServerVariable.js';
|
|
4
|
+
type ToServerVariablesV3Args = {
|
|
5
|
+
serverVariables: Record<string, OpenAPIV3.ServerVariableObject>;
|
|
6
|
+
context: ParseContext;
|
|
7
|
+
};
|
|
8
|
+
export declare const toServerVariablesV3: ({ serverVariables, context }: ToServerVariablesV3Args) => Record<string, OasServerVariable>;
|
|
9
|
+
type ToOptionalServerVariablesV3Args = {
|
|
10
|
+
serverVariables: Record<string, OpenAPIV3.ServerVariableObject> | undefined;
|
|
11
|
+
context: ParseContext;
|
|
12
|
+
};
|
|
13
|
+
export declare const toOptionalServerVariablesV3: ({ serverVariables, context }: ToOptionalServerVariablesV3Args) => Record<string, OasServerVariable> | undefined;
|
|
14
|
+
type ToServerVariableV3Args = {
|
|
15
|
+
serverVariable: OpenAPIV3.ServerVariableObject;
|
|
16
|
+
context: ParseContext;
|
|
17
|
+
};
|
|
18
|
+
export declare const toServerVariableV3: ({ serverVariable, context }: ToServerVariableV3Args) => OasServerVariable;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=toServerVariableV3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toServerVariableV3.d.ts","sourceRoot":"","sources":["../../../src/oas/serverVariable/toServerVariableV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,KAAK,uBAAuB,GAAG;IAC7B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,oBAAoB,CAAC,CAAA;IAC/D,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,mBAAmB,iCAG7B,uBAAuB,KAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAO5D,CAAA;AAED,KAAK,+BAA+B,GAAG;IACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAAA;IAC3E,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,2BAA2B,iCAGrC,+BAA+B,KAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAMxE,CAAA;AAED,KAAK,sBAAsB,GAAG;IAC5B,cAAc,EAAE,SAAS,CAAC,oBAAoB,CAAA;IAC9C,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,kBAAkB,gCAG5B,sBAAsB,KAAG,iBAgB3B,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
2
|
+
import { OasServerVariable } from './ServerVariable.js';
|
|
3
|
+
export const toServerVariablesV3 = ({ serverVariables, context }) => {
|
|
4
|
+
return Object.fromEntries(Object.entries(serverVariables).map(([key, serverVariable]) => [
|
|
5
|
+
key,
|
|
6
|
+
toServerVariableV3({ serverVariable, context })
|
|
7
|
+
]));
|
|
8
|
+
};
|
|
9
|
+
export const toOptionalServerVariablesV3 = ({ serverVariables, context }) => {
|
|
10
|
+
if (!serverVariables) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
return toServerVariablesV3({ serverVariables, context });
|
|
14
|
+
};
|
|
15
|
+
export const toServerVariableV3 = ({ serverVariable, context }) => {
|
|
16
|
+
const { description, default: defaultValue, enum: enums, ...skipped } = serverVariable;
|
|
17
|
+
const extensionFields = toSpecificationExtensionsV3({
|
|
18
|
+
skipped,
|
|
19
|
+
parent: serverVariable,
|
|
20
|
+
context,
|
|
21
|
+
parentType: 'serverVariable'
|
|
22
|
+
});
|
|
23
|
+
return new OasServerVariable({
|
|
24
|
+
description,
|
|
25
|
+
default: defaultValue,
|
|
26
|
+
enums,
|
|
27
|
+
extensionFields
|
|
28
|
+
});
|
|
29
|
+
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import "../../_dnt.polyfills.js";
|
|
2
2
|
import type { ToJsonSchemaOptions } from '../schema/Schema.js';
|
|
3
3
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
|
+
import type { OasServerVariable } from '../serverVariable/ServerVariable.js';
|
|
4
5
|
export type ServerFields = {
|
|
5
6
|
description?: string | undefined;
|
|
6
7
|
url: string;
|
|
8
|
+
variables?: Record<string, OasServerVariable> | undefined;
|
|
7
9
|
extensionFields?: Record<string, unknown>;
|
|
8
10
|
};
|
|
9
11
|
export declare class OasServer {
|
|
10
12
|
oasType: 'server';
|
|
11
13
|
description: string | undefined;
|
|
12
14
|
url: string;
|
|
15
|
+
variables: Record<string, OasServerVariable> | undefined;
|
|
13
16
|
extensionFields: Record<string, unknown> | undefined;
|
|
14
17
|
constructor(fields: ServerFields);
|
|
15
18
|
isRef(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../../src/oas/server/Server.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../../src/oas/server/Server.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAE5E,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAAS,CAAA;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,qBAAa,SAAS;IACpB,OAAO,EAAE,QAAQ,CAAW;IAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAAS,CAAA;IACxD,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;gBACxC,MAAM,EAAE,YAAY;IAOhC,KAAK;IAIL,OAAO,IAAI,SAAS;IAIpB,WAAW,IAAI,SAAS;IAIxB,YAAY,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,CAAC,YAAY;CAOpE"}
|
|
@@ -22,6 +22,12 @@ class OasServer {
|
|
|
22
22
|
writable: true,
|
|
23
23
|
value: void 0
|
|
24
24
|
});
|
|
25
|
+
Object.defineProperty(this, "variables", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true,
|
|
29
|
+
value: void 0
|
|
30
|
+
});
|
|
25
31
|
Object.defineProperty(this, "extensionFields", {
|
|
26
32
|
enumerable: true,
|
|
27
33
|
configurable: true,
|
|
@@ -30,6 +36,7 @@ class OasServer {
|
|
|
30
36
|
});
|
|
31
37
|
this.description = fields.description;
|
|
32
38
|
this.url = fields.url;
|
|
39
|
+
this.variables = fields.variables;
|
|
33
40
|
this.extensionFields = fields.extensionFields;
|
|
34
41
|
}
|
|
35
42
|
isRef() {
|
|
@@ -44,7 +51,8 @@ class OasServer {
|
|
|
44
51
|
toJsonSchema(_options) {
|
|
45
52
|
return {
|
|
46
53
|
description: this.description,
|
|
47
|
-
url: this.url
|
|
54
|
+
url: this.url,
|
|
55
|
+
variables: this.variables
|
|
48
56
|
};
|
|
49
57
|
}
|
|
50
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toServerV3.d.ts","sourceRoot":"","sources":["../../../src/oas/server/toServerV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIvC,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE,CAAA;IACjC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,WAAW,yBAA0B,eAAe,KAAG,SAAS,EAI5E,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE,GAAG,SAAS,CAAA;IAC7C,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,mBAAmB,yBAG7B,uBAAuB,KAAG,SAAS,EAAE,GAAG,SAM1C,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,SAAS,CAAC,YAAY,CAAA;IAC9B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,UAAU,wBAAyB,cAAc,KAAG,
|
|
1
|
+
{"version":3,"file":"toServerV3.d.ts","sourceRoot":"","sources":["../../../src/oas/server/toServerV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIvC,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE,CAAA;IACjC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,WAAW,yBAA0B,eAAe,KAAG,SAAS,EAI5E,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE,GAAG,SAAS,CAAA;IAC7C,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,mBAAmB,yBAG7B,uBAAuB,KAAG,SAAS,EAAE,GAAG,SAM1C,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,MAAM,EAAE,SAAS,CAAC,YAAY,CAAA;IAC9B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,UAAU,wBAAyB,cAAc,KAAG,SAgBhE,CAAA"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toServerV3 = exports.toOptionalServersV3 = exports.toServersV3 = void 0;
|
|
4
4
|
const Server_js_1 = require("./Server.js");
|
|
5
5
|
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
6
|
+
const toServerVariableV3_js_1 = require("../serverVariable/toServerVariableV3.js");
|
|
6
7
|
const toServersV3 = ({ servers, context }) => {
|
|
7
8
|
return servers.map((server, index) => {
|
|
8
9
|
return context.trace(server.url ?? index, () => (0, exports.toServerV3)({ server, context }));
|
|
@@ -17,18 +18,18 @@ const toOptionalServersV3 = ({ servers, context }) => {
|
|
|
17
18
|
};
|
|
18
19
|
exports.toOptionalServersV3 = toOptionalServersV3;
|
|
19
20
|
const toServerV3 = ({ server, context }) => {
|
|
20
|
-
const { description, url, ...skipped } = server;
|
|
21
|
+
const { description, url, variables, ...skipped } = server;
|
|
21
22
|
const extensionFields = (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({
|
|
22
23
|
skipped,
|
|
23
24
|
parent: server,
|
|
24
25
|
context,
|
|
25
26
|
parentType: 'server'
|
|
26
27
|
});
|
|
27
|
-
|
|
28
|
+
return new Server_js_1.OasServer({
|
|
28
29
|
description,
|
|
29
30
|
url,
|
|
31
|
+
variables: (0, toServerVariableV3_js_1.toOptionalServerVariablesV3)({ serverVariables: variables, context }),
|
|
30
32
|
extensionFields
|
|
31
|
-
};
|
|
32
|
-
return new Server_js_1.OasServer(fields);
|
|
33
|
+
});
|
|
33
34
|
};
|
|
34
35
|
exports.toServerV3 = toServerV3;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ToJsonSchemaOptions } from '../schema/Schema.js';
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
export type ServerVariableFields = {
|
|
4
|
+
description?: string | undefined;
|
|
5
|
+
default: string;
|
|
6
|
+
enums?: string[] | undefined;
|
|
7
|
+
extensionFields?: Record<string, unknown>;
|
|
8
|
+
};
|
|
9
|
+
export declare class OasServerVariable {
|
|
10
|
+
oasType: 'serverVariable';
|
|
11
|
+
description: string | undefined;
|
|
12
|
+
default: string;
|
|
13
|
+
enums?: string[] | undefined;
|
|
14
|
+
extensionFields: Record<string, unknown> | undefined;
|
|
15
|
+
constructor(fields: ServerVariableFields);
|
|
16
|
+
isRef(): boolean;
|
|
17
|
+
resolve(): OasServerVariable;
|
|
18
|
+
resolveOnce(): OasServerVariable;
|
|
19
|
+
toJsonSchema(_options: ToJsonSchemaOptions): OpenAPIV3.ServerVariableObject;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=ServerVariable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServerVariable.d.ts","sourceRoot":"","sources":["../../../src/oas/serverVariable/ServerVariable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,qBAAa,iBAAiB;IAC5B,OAAO,EAAE,gBAAgB,CAAmB;IAC5C,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC5B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;gBACxC,MAAM,EAAE,oBAAoB;IAOxC,KAAK;IAIL,OAAO,IAAI,iBAAiB;IAI5B,WAAW,IAAI,iBAAiB;IAIhC,YAAY,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,CAAC,oBAAoB;CAO5E"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OasServerVariable = void 0;
|
|
4
|
+
class OasServerVariable {
|
|
5
|
+
constructor(fields) {
|
|
6
|
+
Object.defineProperty(this, "oasType", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: 'serverVariable'
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(this, "description", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: void 0
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "default", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: void 0
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(this, "enums", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: void 0
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(this, "extensionFields", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value: void 0
|
|
35
|
+
});
|
|
36
|
+
this.description = fields.description;
|
|
37
|
+
this.default = fields.default;
|
|
38
|
+
this.enums = fields.enums;
|
|
39
|
+
this.extensionFields = fields.extensionFields;
|
|
40
|
+
}
|
|
41
|
+
isRef() {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
resolve() {
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
resolveOnce() {
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
toJsonSchema(_options) {
|
|
51
|
+
return {
|
|
52
|
+
description: this.description,
|
|
53
|
+
default: this.default,
|
|
54
|
+
enum: this.enums
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.OasServerVariable = OasServerVariable;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ParseContext } from '../../context/ParseContext.js';
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
import { OasServerVariable } from './ServerVariable.js';
|
|
4
|
+
type ToServerVariablesV3Args = {
|
|
5
|
+
serverVariables: Record<string, OpenAPIV3.ServerVariableObject>;
|
|
6
|
+
context: ParseContext;
|
|
7
|
+
};
|
|
8
|
+
export declare const toServerVariablesV3: ({ serverVariables, context }: ToServerVariablesV3Args) => Record<string, OasServerVariable>;
|
|
9
|
+
type ToOptionalServerVariablesV3Args = {
|
|
10
|
+
serverVariables: Record<string, OpenAPIV3.ServerVariableObject> | undefined;
|
|
11
|
+
context: ParseContext;
|
|
12
|
+
};
|
|
13
|
+
export declare const toOptionalServerVariablesV3: ({ serverVariables, context }: ToOptionalServerVariablesV3Args) => Record<string, OasServerVariable> | undefined;
|
|
14
|
+
type ToServerVariableV3Args = {
|
|
15
|
+
serverVariable: OpenAPIV3.ServerVariableObject;
|
|
16
|
+
context: ParseContext;
|
|
17
|
+
};
|
|
18
|
+
export declare const toServerVariableV3: ({ serverVariable, context }: ToServerVariableV3Args) => OasServerVariable;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=toServerVariableV3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toServerVariableV3.d.ts","sourceRoot":"","sources":["../../../src/oas/serverVariable/toServerVariableV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,KAAK,uBAAuB,GAAG;IAC7B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,oBAAoB,CAAC,CAAA;IAC/D,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,mBAAmB,iCAG7B,uBAAuB,KAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAO5D,CAAA;AAED,KAAK,+BAA+B,GAAG;IACrC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAAA;IAC3E,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,2BAA2B,iCAGrC,+BAA+B,KAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAMxE,CAAA;AAED,KAAK,sBAAsB,GAAG;IAC5B,cAAc,EAAE,SAAS,CAAC,oBAAoB,CAAA;IAC9C,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,kBAAkB,gCAG5B,sBAAsB,KAAG,iBAgB3B,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toServerVariableV3 = exports.toOptionalServerVariablesV3 = exports.toServerVariablesV3 = void 0;
|
|
4
|
+
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
5
|
+
const ServerVariable_js_1 = require("./ServerVariable.js");
|
|
6
|
+
const toServerVariablesV3 = ({ serverVariables, context }) => {
|
|
7
|
+
return Object.fromEntries(Object.entries(serverVariables).map(([key, serverVariable]) => [
|
|
8
|
+
key,
|
|
9
|
+
(0, exports.toServerVariableV3)({ serverVariable, context })
|
|
10
|
+
]));
|
|
11
|
+
};
|
|
12
|
+
exports.toServerVariablesV3 = toServerVariablesV3;
|
|
13
|
+
const toOptionalServerVariablesV3 = ({ serverVariables, context }) => {
|
|
14
|
+
if (!serverVariables) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
return (0, exports.toServerVariablesV3)({ serverVariables, context });
|
|
18
|
+
};
|
|
19
|
+
exports.toOptionalServerVariablesV3 = toOptionalServerVariablesV3;
|
|
20
|
+
const toServerVariableV3 = ({ serverVariable, context }) => {
|
|
21
|
+
const { description, default: defaultValue, enum: enums, ...skipped } = serverVariable;
|
|
22
|
+
const extensionFields = (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({
|
|
23
|
+
skipped,
|
|
24
|
+
parent: serverVariable,
|
|
25
|
+
context,
|
|
26
|
+
parentType: 'serverVariable'
|
|
27
|
+
});
|
|
28
|
+
return new ServerVariable_js_1.OasServerVariable({
|
|
29
|
+
description,
|
|
30
|
+
default: defaultValue,
|
|
31
|
+
enums,
|
|
32
|
+
extensionFields
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
exports.toServerVariableV3 = toServerVariableV3;
|