@skmtc/core 0.31.0 → 0.32.0
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/pathItem/PathItem.d.ts +5 -0
- package/esm/oas/pathItem/PathItem.js +8 -0
- package/esm/parse/v3-0/parameter/toParameterV3.d.ts +3 -2
- package/esm/parse/v3-0/parameter/toParameterV3.js +3 -2
- package/esm/parse/v3-0/pathItem/toPathItemV3.js +11 -1
- package/esm/parse/v3-1/parameter/toParameterV3.d.ts +3 -2
- package/esm/parse/v3-1/parameter/toParameterV3.js +3 -2
- package/esm/parse/v3-1/pathItem/toPathItemV3.js +11 -1
- package/esm/parse/v3-2/parameter/toParameterV3.d.ts +2 -2
- package/esm/parse/v3-2/parameter/toParameterV3.js +3 -2
- package/esm/parse/v3-2/pathItem/toPathItemV3.js +11 -1
- package/package.json +1 -1
- package/script/oas/pathItem/PathItem.d.ts +5 -0
- package/script/oas/pathItem/PathItem.js +8 -0
- package/script/parse/v3-0/parameter/toParameterV3.d.ts +3 -2
- package/script/parse/v3-0/parameter/toParameterV3.js +3 -2
- package/script/parse/v3-0/pathItem/toPathItemV3.js +11 -1
- package/script/parse/v3-1/parameter/toParameterV3.d.ts +3 -2
- package/script/parse/v3-1/parameter/toParameterV3.js +3 -2
- package/script/parse/v3-1/pathItem/toPathItemV3.js +11 -1
- package/script/parse/v3-2/parameter/toParameterV3.d.ts +2 -2
- package/script/parse/v3-2/parameter/toParameterV3.js +3 -2
- package/script/parse/v3-2/pathItem/toPathItemV3.js +11 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { OasParameter } from '../parameter/Parameter.js';
|
|
2
2
|
import type { OasRef } from '../ref/Ref.js';
|
|
3
|
+
import type { OasServer } from '../server/Server.js';
|
|
3
4
|
/**
|
|
4
5
|
* Constructor fields for {@link OasPathItem}.
|
|
5
6
|
*/
|
|
@@ -10,6 +11,8 @@ export type PathItemFields = {
|
|
|
10
11
|
description?: string | undefined;
|
|
11
12
|
/** Parameters that are applicable for all operations on this path */
|
|
12
13
|
parameters?: (OasParameter | OasRef<'parameter'>)[] | undefined;
|
|
14
|
+
/** Servers that replace the document's servers for all operations on this path */
|
|
15
|
+
servers?: OasServer[] | undefined;
|
|
13
16
|
/** Custom extension fields (x-* properties) */
|
|
14
17
|
extensionFields?: Record<string, unknown>;
|
|
15
18
|
};
|
|
@@ -103,6 +106,8 @@ export declare class OasPathItem {
|
|
|
103
106
|
summary: string | undefined;
|
|
104
107
|
description: string | undefined;
|
|
105
108
|
parameters: (OasParameter | OasRef<'parameter'>)[] | undefined;
|
|
109
|
+
/** Servers that replace the document's servers for all operations on this path */
|
|
110
|
+
servers: OasServer[] | undefined;
|
|
106
111
|
extensionFields: Record<string, unknown> | undefined;
|
|
107
112
|
constructor(fields?: PathItemFields);
|
|
108
113
|
}
|
|
@@ -109,6 +109,13 @@ export class OasPathItem {
|
|
|
109
109
|
writable: true,
|
|
110
110
|
value: void 0
|
|
111
111
|
});
|
|
112
|
+
/** Servers that replace the document's servers for all operations on this path */
|
|
113
|
+
Object.defineProperty(this, "servers", {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
configurable: true,
|
|
116
|
+
writable: true,
|
|
117
|
+
value: void 0
|
|
118
|
+
});
|
|
112
119
|
Object.defineProperty(this, "extensionFields", {
|
|
113
120
|
enumerable: true,
|
|
114
121
|
configurable: true,
|
|
@@ -118,6 +125,7 @@ export class OasPathItem {
|
|
|
118
125
|
this.summary = fields.summary;
|
|
119
126
|
this.description = fields.description;
|
|
120
127
|
this.parameters = fields.parameters;
|
|
128
|
+
this.servers = fields.servers;
|
|
121
129
|
this.extensionFields = fields.extensionFields;
|
|
122
130
|
}
|
|
123
131
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
-
import type { OasParameterLocation } from '../../../oas/parameter/parameter-types.js';
|
|
2
|
+
import type { OasParameterLocation, OasParameterStyle } from '../../../oas/parameter/parameter-types.js';
|
|
3
3
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
4
|
import { OasParameter } from '../../../oas/parameter/Parameter.js';
|
|
5
5
|
import type { OasRef } from '../../../oas/ref/Ref.js';
|
|
6
6
|
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
7
7
|
type ParameterLocation = Exclude<OasParameterLocation, 'querystring'>;
|
|
8
|
+
type ParameterStyle = Exclude<OasParameterStyle, 'cookie'>;
|
|
8
9
|
export type ToParameterListV3Args = {
|
|
9
10
|
parameters: (OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject)[] | undefined;
|
|
10
11
|
stackTrail: StackTrail;
|
|
@@ -35,7 +36,7 @@ export type ToStyleArgs = {
|
|
|
35
36
|
};
|
|
36
37
|
export type ToExplodeArgs = {
|
|
37
38
|
explode: boolean | undefined;
|
|
38
|
-
style:
|
|
39
|
+
style: ParameterStyle;
|
|
39
40
|
stackTrail: StackTrail;
|
|
40
41
|
};
|
|
41
42
|
export {};
|
|
@@ -72,14 +72,15 @@ const toParameterV3 = ({ parameter, stackTrail, context }) => {
|
|
|
72
72
|
}
|
|
73
73
|
// Set missing 'required' to true for path parameters and false for others
|
|
74
74
|
const defaultRequired = typeof required === 'undefined' ? (parsedLocation === 'path' ? true : false) : required;
|
|
75
|
+
const parsedStyle = stackTrail.trace('style', st => toStyle({ style, location: parsedLocation, stackTrail: st }));
|
|
75
76
|
const fields = {
|
|
76
77
|
name,
|
|
77
78
|
location: parsedLocation,
|
|
78
79
|
description,
|
|
79
80
|
required: defaultRequired,
|
|
80
81
|
deprecated,
|
|
81
|
-
style:
|
|
82
|
-
explode: stackTrail.trace('explode', st => toExplode({ explode, style, stackTrail: st })),
|
|
82
|
+
style: parsedStyle,
|
|
83
|
+
explode: stackTrail.trace('explode', st => toExplode({ explode, style: parsedStyle, stackTrail: st })),
|
|
83
84
|
allowEmptyValue,
|
|
84
85
|
allowReserved,
|
|
85
86
|
schema: stackTrail.trace('schema', st => toOptionalSchemaV3({ schema, stackTrail: st, context })),
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { toParameterListV3 } from '../parameter/toParameterV3.js';
|
|
2
2
|
import { OasPathItem } from '../../../oas/pathItem/PathItem.js';
|
|
3
|
+
import { toOptionalServersV3 } from '../server/toServerV3.js';
|
|
4
|
+
import { tryParseAt } from '../../../context/tryParseAt.js';
|
|
3
5
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
4
6
|
export const toPathItemV3 = ({ pathItem, stackTrail, context }) => {
|
|
5
|
-
const { summary, description, parameters, ...skipped } = pathItem;
|
|
7
|
+
const { summary, description, parameters, servers, ...skipped } = pathItem;
|
|
6
8
|
return new OasPathItem({
|
|
7
9
|
summary,
|
|
8
10
|
description,
|
|
9
11
|
parameters: stackTrail.trace('parameters', st => toParameterListV3({ parameters, stackTrail: st, context })),
|
|
12
|
+
servers: tryParseAt({
|
|
13
|
+
stackTrail,
|
|
14
|
+
key: 'servers',
|
|
15
|
+
context,
|
|
16
|
+
type: 'INVALID_OPERATION',
|
|
17
|
+
parent: pathItem,
|
|
18
|
+
fn: st => toOptionalServersV3({ servers, stackTrail: st, context })
|
|
19
|
+
}),
|
|
10
20
|
extensionFields: toSpecificationExtensionsV3({
|
|
11
21
|
skipped,
|
|
12
22
|
parent: pathItem,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
-
import type { OasParameterLocation } from '../../../oas/parameter/parameter-types.js';
|
|
2
|
+
import type { OasParameterLocation, OasParameterStyle } from '../../../oas/parameter/parameter-types.js';
|
|
3
3
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
4
|
import { OasParameter } from '../../../oas/parameter/Parameter.js';
|
|
5
5
|
import type { OasRef } from '../../../oas/ref/Ref.js';
|
|
6
6
|
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
7
7
|
type ParameterLocation = Exclude<OasParameterLocation, 'querystring'>;
|
|
8
|
+
type ParameterStyle = Exclude<OasParameterStyle, 'cookie'>;
|
|
8
9
|
export type ToParameterListV3Args = {
|
|
9
10
|
parameters: (OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject)[] | undefined;
|
|
10
11
|
stackTrail: StackTrail;
|
|
@@ -35,7 +36,7 @@ export type ToStyleArgs = {
|
|
|
35
36
|
};
|
|
36
37
|
export type ToExplodeArgs = {
|
|
37
38
|
explode: boolean | undefined;
|
|
38
|
-
style:
|
|
39
|
+
style: ParameterStyle;
|
|
39
40
|
stackTrail: StackTrail;
|
|
40
41
|
};
|
|
41
42
|
export {};
|
|
@@ -72,14 +72,15 @@ const toParameterV3 = ({ parameter, stackTrail, context }) => {
|
|
|
72
72
|
}
|
|
73
73
|
// Set missing 'required' to true for path parameters and false for others
|
|
74
74
|
const defaultRequired = typeof required === 'undefined' ? (parsedLocation === 'path' ? true : false) : required;
|
|
75
|
+
const parsedStyle = stackTrail.trace('style', st => toStyle({ style, location: parsedLocation, stackTrail: st }));
|
|
75
76
|
const fields = {
|
|
76
77
|
name,
|
|
77
78
|
location: parsedLocation,
|
|
78
79
|
description,
|
|
79
80
|
required: defaultRequired,
|
|
80
81
|
deprecated,
|
|
81
|
-
style:
|
|
82
|
-
explode: stackTrail.trace('explode', st => toExplode({ explode, style, stackTrail: st })),
|
|
82
|
+
style: parsedStyle,
|
|
83
|
+
explode: stackTrail.trace('explode', st => toExplode({ explode, style: parsedStyle, stackTrail: st })),
|
|
83
84
|
allowEmptyValue,
|
|
84
85
|
allowReserved,
|
|
85
86
|
schema: stackTrail.trace('schema', st => toOptionalSchemaV3({ schema, stackTrail: st, context })),
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { toParameterListV3 } from '../parameter/toParameterV3.js';
|
|
2
2
|
import { OasPathItem } from '../../../oas/pathItem/PathItem.js';
|
|
3
|
+
import { toOptionalServersV3 } from '../server/toServerV3.js';
|
|
4
|
+
import { tryParseAt } from '../../../context/tryParseAt.js';
|
|
3
5
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
4
6
|
export const toPathItemV3 = ({ pathItem, stackTrail, context }) => {
|
|
5
|
-
const { summary, description, parameters, ...skipped } = pathItem;
|
|
7
|
+
const { summary, description, parameters, servers, ...skipped } = pathItem;
|
|
6
8
|
return new OasPathItem({
|
|
7
9
|
summary,
|
|
8
10
|
description,
|
|
9
11
|
parameters: stackTrail.trace('parameters', st => toParameterListV3({ parameters, stackTrail: st, context })),
|
|
12
|
+
servers: tryParseAt({
|
|
13
|
+
stackTrail,
|
|
14
|
+
key: 'servers',
|
|
15
|
+
context,
|
|
16
|
+
type: 'INVALID_OPERATION',
|
|
17
|
+
parent: pathItem,
|
|
18
|
+
fn: st => toOptionalServersV3({ servers, stackTrail: st, context })
|
|
19
|
+
}),
|
|
10
20
|
extensionFields: toSpecificationExtensionsV3({
|
|
11
21
|
skipped,
|
|
12
22
|
parent: pathItem,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
-
import { type OasParameterLocation } from '../../../oas/parameter/parameter-types.js';
|
|
2
|
+
import { type OasParameterLocation, type OasParameterStyle } from '../../../oas/parameter/parameter-types.js';
|
|
3
3
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
4
|
import { OasParameter } from '../../../oas/parameter/Parameter.js';
|
|
5
5
|
import type { OasRef } from '../../../oas/ref/Ref.js';
|
|
@@ -34,6 +34,6 @@ export type ToStyleArgs = {
|
|
|
34
34
|
};
|
|
35
35
|
export type ToExplodeArgs = {
|
|
36
36
|
explode: boolean | undefined;
|
|
37
|
-
style:
|
|
37
|
+
style: OasParameterStyle | undefined;
|
|
38
38
|
stackTrail: StackTrail;
|
|
39
39
|
};
|
|
@@ -91,14 +91,15 @@ const toParameterV3 = ({ parameter, stackTrail, context }) => {
|
|
|
91
91
|
}
|
|
92
92
|
// Set missing 'required' to true for path parameters and false for others
|
|
93
93
|
const defaultRequired = typeof required === 'undefined' ? (parsedLocation === 'path' ? true : false) : required;
|
|
94
|
+
const parsedStyle = stackTrail.trace('style', st => toStyle({ style, location: parsedLocation, stackTrail: st }));
|
|
94
95
|
const fields = {
|
|
95
96
|
name,
|
|
96
97
|
location: parsedLocation,
|
|
97
98
|
description,
|
|
98
99
|
required: defaultRequired,
|
|
99
100
|
deprecated,
|
|
100
|
-
style:
|
|
101
|
-
explode: stackTrail.trace('explode', st => toExplode({ explode, style, stackTrail: st })),
|
|
101
|
+
style: parsedStyle,
|
|
102
|
+
explode: stackTrail.trace('explode', st => toExplode({ explode, style: parsedStyle, stackTrail: st })),
|
|
102
103
|
allowEmptyValue,
|
|
103
104
|
allowReserved,
|
|
104
105
|
schema: stackTrail.trace('schema', st => toOptionalSchemaV3({ schema, stackTrail: st, context })),
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { toParameterListV3 } from '../parameter/toParameterV3.js';
|
|
2
2
|
import { OasPathItem } from '../../../oas/pathItem/PathItem.js';
|
|
3
|
+
import { toOptionalServersV3 } from '../server/toServerV3.js';
|
|
4
|
+
import { tryParseAt } from '../../../context/tryParseAt.js';
|
|
3
5
|
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
4
6
|
import { isEmpty } from '../../../helpers/isEmpty.js';
|
|
5
7
|
export const toPathItemV3 = ({ pathItem, stackTrail, context }) => {
|
|
6
|
-
const { summary, description, parameters, ...skipped } = pathItem;
|
|
8
|
+
const { summary, description, parameters, servers, ...skipped } = pathItem;
|
|
7
9
|
return new OasPathItem({
|
|
8
10
|
summary,
|
|
9
11
|
description,
|
|
10
12
|
parameters: stackTrail.trace('parameters', st => toParameterListV3({ parameters, stackTrail: st, context })),
|
|
13
|
+
servers: tryParseAt({
|
|
14
|
+
stackTrail,
|
|
15
|
+
key: 'servers',
|
|
16
|
+
context,
|
|
17
|
+
type: 'INVALID_OPERATION',
|
|
18
|
+
parent: pathItem,
|
|
19
|
+
fn: st => toOptionalServersV3({ servers, stackTrail: st, context })
|
|
20
|
+
}),
|
|
11
21
|
extensionFields: toSpecificationExtensionsV3({
|
|
12
22
|
skipped,
|
|
13
23
|
parent: pathItem,
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { OasParameter } from '../parameter/Parameter.js';
|
|
2
2
|
import type { OasRef } from '../ref/Ref.js';
|
|
3
|
+
import type { OasServer } from '../server/Server.js';
|
|
3
4
|
/**
|
|
4
5
|
* Constructor fields for {@link OasPathItem}.
|
|
5
6
|
*/
|
|
@@ -10,6 +11,8 @@ export type PathItemFields = {
|
|
|
10
11
|
description?: string | undefined;
|
|
11
12
|
/** Parameters that are applicable for all operations on this path */
|
|
12
13
|
parameters?: (OasParameter | OasRef<'parameter'>)[] | undefined;
|
|
14
|
+
/** Servers that replace the document's servers for all operations on this path */
|
|
15
|
+
servers?: OasServer[] | undefined;
|
|
13
16
|
/** Custom extension fields (x-* properties) */
|
|
14
17
|
extensionFields?: Record<string, unknown>;
|
|
15
18
|
};
|
|
@@ -103,6 +106,8 @@ export declare class OasPathItem {
|
|
|
103
106
|
summary: string | undefined;
|
|
104
107
|
description: string | undefined;
|
|
105
108
|
parameters: (OasParameter | OasRef<'parameter'>)[] | undefined;
|
|
109
|
+
/** Servers that replace the document's servers for all operations on this path */
|
|
110
|
+
servers: OasServer[] | undefined;
|
|
106
111
|
extensionFields: Record<string, unknown> | undefined;
|
|
107
112
|
constructor(fields?: PathItemFields);
|
|
108
113
|
}
|
|
@@ -112,6 +112,13 @@ class OasPathItem {
|
|
|
112
112
|
writable: true,
|
|
113
113
|
value: void 0
|
|
114
114
|
});
|
|
115
|
+
/** Servers that replace the document's servers for all operations on this path */
|
|
116
|
+
Object.defineProperty(this, "servers", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
configurable: true,
|
|
119
|
+
writable: true,
|
|
120
|
+
value: void 0
|
|
121
|
+
});
|
|
115
122
|
Object.defineProperty(this, "extensionFields", {
|
|
116
123
|
enumerable: true,
|
|
117
124
|
configurable: true,
|
|
@@ -121,6 +128,7 @@ class OasPathItem {
|
|
|
121
128
|
this.summary = fields.summary;
|
|
122
129
|
this.description = fields.description;
|
|
123
130
|
this.parameters = fields.parameters;
|
|
131
|
+
this.servers = fields.servers;
|
|
124
132
|
this.extensionFields = fields.extensionFields;
|
|
125
133
|
}
|
|
126
134
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
-
import type { OasParameterLocation } from '../../../oas/parameter/parameter-types.js';
|
|
2
|
+
import type { OasParameterLocation, OasParameterStyle } from '../../../oas/parameter/parameter-types.js';
|
|
3
3
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
4
|
import { OasParameter } from '../../../oas/parameter/Parameter.js';
|
|
5
5
|
import type { OasRef } from '../../../oas/ref/Ref.js';
|
|
6
6
|
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
7
7
|
type ParameterLocation = Exclude<OasParameterLocation, 'querystring'>;
|
|
8
|
+
type ParameterStyle = Exclude<OasParameterStyle, 'cookie'>;
|
|
8
9
|
export type ToParameterListV3Args = {
|
|
9
10
|
parameters: (OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject)[] | undefined;
|
|
10
11
|
stackTrail: StackTrail;
|
|
@@ -35,7 +36,7 @@ export type ToStyleArgs = {
|
|
|
35
36
|
};
|
|
36
37
|
export type ToExplodeArgs = {
|
|
37
38
|
explode: boolean | undefined;
|
|
38
|
-
style:
|
|
39
|
+
style: ParameterStyle;
|
|
39
40
|
stackTrail: StackTrail;
|
|
40
41
|
};
|
|
41
42
|
export {};
|
|
@@ -111,14 +111,15 @@ const toParameterV3 = ({ parameter, stackTrail, context }) => {
|
|
|
111
111
|
}
|
|
112
112
|
// Set missing 'required' to true for path parameters and false for others
|
|
113
113
|
const defaultRequired = typeof required === 'undefined' ? (parsedLocation === 'path' ? true : false) : required;
|
|
114
|
+
const parsedStyle = stackTrail.trace('style', st => toStyle({ style, location: parsedLocation, stackTrail: st }));
|
|
114
115
|
const fields = {
|
|
115
116
|
name,
|
|
116
117
|
location: parsedLocation,
|
|
117
118
|
description,
|
|
118
119
|
required: defaultRequired,
|
|
119
120
|
deprecated,
|
|
120
|
-
style:
|
|
121
|
-
explode: stackTrail.trace('explode', st => toExplode({ explode, style, stackTrail: st })),
|
|
121
|
+
style: parsedStyle,
|
|
122
|
+
explode: stackTrail.trace('explode', st => toExplode({ explode, style: parsedStyle, stackTrail: st })),
|
|
122
123
|
allowEmptyValue,
|
|
123
124
|
allowReserved,
|
|
124
125
|
schema: stackTrail.trace('schema', st => (0, toSchemasV3_js_1.toOptionalSchemaV3)({ schema, stackTrail: st, context })),
|
|
@@ -3,13 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toPathItemV3 = void 0;
|
|
4
4
|
const toParameterV3_js_1 = require("../parameter/toParameterV3.js");
|
|
5
5
|
const PathItem_js_1 = require("../../../oas/pathItem/PathItem.js");
|
|
6
|
+
const toServerV3_js_1 = require("../server/toServerV3.js");
|
|
7
|
+
const tryParseAt_js_1 = require("../../../context/tryParseAt.js");
|
|
6
8
|
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
7
9
|
const toPathItemV3 = ({ pathItem, stackTrail, context }) => {
|
|
8
|
-
const { summary, description, parameters, ...skipped } = pathItem;
|
|
10
|
+
const { summary, description, parameters, servers, ...skipped } = pathItem;
|
|
9
11
|
return new PathItem_js_1.OasPathItem({
|
|
10
12
|
summary,
|
|
11
13
|
description,
|
|
12
14
|
parameters: stackTrail.trace('parameters', st => (0, toParameterV3_js_1.toParameterListV3)({ parameters, stackTrail: st, context })),
|
|
15
|
+
servers: (0, tryParseAt_js_1.tryParseAt)({
|
|
16
|
+
stackTrail,
|
|
17
|
+
key: 'servers',
|
|
18
|
+
context,
|
|
19
|
+
type: 'INVALID_OPERATION',
|
|
20
|
+
parent: pathItem,
|
|
21
|
+
fn: st => (0, toServerV3_js_1.toOptionalServersV3)({ servers, stackTrail: st, context })
|
|
22
|
+
}),
|
|
13
23
|
extensionFields: (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({
|
|
14
24
|
skipped,
|
|
15
25
|
parent: pathItem,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
-
import type { OasParameterLocation } from '../../../oas/parameter/parameter-types.js';
|
|
2
|
+
import type { OasParameterLocation, OasParameterStyle } from '../../../oas/parameter/parameter-types.js';
|
|
3
3
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
4
|
import { OasParameter } from '../../../oas/parameter/Parameter.js';
|
|
5
5
|
import type { OasRef } from '../../../oas/ref/Ref.js';
|
|
6
6
|
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
7
7
|
type ParameterLocation = Exclude<OasParameterLocation, 'querystring'>;
|
|
8
|
+
type ParameterStyle = Exclude<OasParameterStyle, 'cookie'>;
|
|
8
9
|
export type ToParameterListV3Args = {
|
|
9
10
|
parameters: (OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject)[] | undefined;
|
|
10
11
|
stackTrail: StackTrail;
|
|
@@ -35,7 +36,7 @@ export type ToStyleArgs = {
|
|
|
35
36
|
};
|
|
36
37
|
export type ToExplodeArgs = {
|
|
37
38
|
explode: boolean | undefined;
|
|
38
|
-
style:
|
|
39
|
+
style: ParameterStyle;
|
|
39
40
|
stackTrail: StackTrail;
|
|
40
41
|
};
|
|
41
42
|
export {};
|
|
@@ -111,14 +111,15 @@ const toParameterV3 = ({ parameter, stackTrail, context }) => {
|
|
|
111
111
|
}
|
|
112
112
|
// Set missing 'required' to true for path parameters and false for others
|
|
113
113
|
const defaultRequired = typeof required === 'undefined' ? (parsedLocation === 'path' ? true : false) : required;
|
|
114
|
+
const parsedStyle = stackTrail.trace('style', st => toStyle({ style, location: parsedLocation, stackTrail: st }));
|
|
114
115
|
const fields = {
|
|
115
116
|
name,
|
|
116
117
|
location: parsedLocation,
|
|
117
118
|
description,
|
|
118
119
|
required: defaultRequired,
|
|
119
120
|
deprecated,
|
|
120
|
-
style:
|
|
121
|
-
explode: stackTrail.trace('explode', st => toExplode({ explode, style, stackTrail: st })),
|
|
121
|
+
style: parsedStyle,
|
|
122
|
+
explode: stackTrail.trace('explode', st => toExplode({ explode, style: parsedStyle, stackTrail: st })),
|
|
122
123
|
allowEmptyValue,
|
|
123
124
|
allowReserved,
|
|
124
125
|
schema: stackTrail.trace('schema', st => (0, toSchemasV3_js_1.toOptionalSchemaV3)({ schema, stackTrail: st, context })),
|
|
@@ -3,13 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toPathItemV3 = void 0;
|
|
4
4
|
const toParameterV3_js_1 = require("../parameter/toParameterV3.js");
|
|
5
5
|
const PathItem_js_1 = require("../../../oas/pathItem/PathItem.js");
|
|
6
|
+
const toServerV3_js_1 = require("../server/toServerV3.js");
|
|
7
|
+
const tryParseAt_js_1 = require("../../../context/tryParseAt.js");
|
|
6
8
|
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
7
9
|
const toPathItemV3 = ({ pathItem, stackTrail, context }) => {
|
|
8
|
-
const { summary, description, parameters, ...skipped } = pathItem;
|
|
10
|
+
const { summary, description, parameters, servers, ...skipped } = pathItem;
|
|
9
11
|
return new PathItem_js_1.OasPathItem({
|
|
10
12
|
summary,
|
|
11
13
|
description,
|
|
12
14
|
parameters: stackTrail.trace('parameters', st => (0, toParameterV3_js_1.toParameterListV3)({ parameters, stackTrail: st, context })),
|
|
15
|
+
servers: (0, tryParseAt_js_1.tryParseAt)({
|
|
16
|
+
stackTrail,
|
|
17
|
+
key: 'servers',
|
|
18
|
+
context,
|
|
19
|
+
type: 'INVALID_OPERATION',
|
|
20
|
+
parent: pathItem,
|
|
21
|
+
fn: st => (0, toServerV3_js_1.toOptionalServersV3)({ servers, stackTrail: st, context })
|
|
22
|
+
}),
|
|
13
23
|
extensionFields: (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({
|
|
14
24
|
skipped,
|
|
15
25
|
parent: pathItem,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
-
import { type OasParameterLocation } from '../../../oas/parameter/parameter-types.js';
|
|
2
|
+
import { type OasParameterLocation, type OasParameterStyle } from '../../../oas/parameter/parameter-types.js';
|
|
3
3
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
4
|
import { OasParameter } from '../../../oas/parameter/Parameter.js';
|
|
5
5
|
import type { OasRef } from '../../../oas/ref/Ref.js';
|
|
@@ -34,6 +34,6 @@ export type ToStyleArgs = {
|
|
|
34
34
|
};
|
|
35
35
|
export type ToExplodeArgs = {
|
|
36
36
|
explode: boolean | undefined;
|
|
37
|
-
style:
|
|
37
|
+
style: OasParameterStyle | undefined;
|
|
38
38
|
stackTrail: StackTrail;
|
|
39
39
|
};
|
|
@@ -130,14 +130,15 @@ const toParameterV3 = ({ parameter, stackTrail, context }) => {
|
|
|
130
130
|
}
|
|
131
131
|
// Set missing 'required' to true for path parameters and false for others
|
|
132
132
|
const defaultRequired = typeof required === 'undefined' ? (parsedLocation === 'path' ? true : false) : required;
|
|
133
|
+
const parsedStyle = stackTrail.trace('style', st => toStyle({ style, location: parsedLocation, stackTrail: st }));
|
|
133
134
|
const fields = {
|
|
134
135
|
name,
|
|
135
136
|
location: parsedLocation,
|
|
136
137
|
description,
|
|
137
138
|
required: defaultRequired,
|
|
138
139
|
deprecated,
|
|
139
|
-
style:
|
|
140
|
-
explode: stackTrail.trace('explode', st => toExplode({ explode, style, stackTrail: st })),
|
|
140
|
+
style: parsedStyle,
|
|
141
|
+
explode: stackTrail.trace('explode', st => toExplode({ explode, style: parsedStyle, stackTrail: st })),
|
|
141
142
|
allowEmptyValue,
|
|
142
143
|
allowReserved,
|
|
143
144
|
schema: stackTrail.trace('schema', st => (0, toSchemasV3_js_1.toOptionalSchemaV3)({ schema, stackTrail: st, context })),
|
|
@@ -3,14 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toPathItemResultV3 = exports.toPathItemV3 = void 0;
|
|
4
4
|
const toParameterV3_js_1 = require("../parameter/toParameterV3.js");
|
|
5
5
|
const PathItem_js_1 = require("../../../oas/pathItem/PathItem.js");
|
|
6
|
+
const toServerV3_js_1 = require("../server/toServerV3.js");
|
|
7
|
+
const tryParseAt_js_1 = require("../../../context/tryParseAt.js");
|
|
6
8
|
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
7
9
|
const isEmpty_js_1 = require("../../../helpers/isEmpty.js");
|
|
8
10
|
const toPathItemV3 = ({ pathItem, stackTrail, context }) => {
|
|
9
|
-
const { summary, description, parameters, ...skipped } = pathItem;
|
|
11
|
+
const { summary, description, parameters, servers, ...skipped } = pathItem;
|
|
10
12
|
return new PathItem_js_1.OasPathItem({
|
|
11
13
|
summary,
|
|
12
14
|
description,
|
|
13
15
|
parameters: stackTrail.trace('parameters', st => (0, toParameterV3_js_1.toParameterListV3)({ parameters, stackTrail: st, context })),
|
|
16
|
+
servers: (0, tryParseAt_js_1.tryParseAt)({
|
|
17
|
+
stackTrail,
|
|
18
|
+
key: 'servers',
|
|
19
|
+
context,
|
|
20
|
+
type: 'INVALID_OPERATION',
|
|
21
|
+
parent: pathItem,
|
|
22
|
+
fn: st => (0, toServerV3_js_1.toOptionalServersV3)({ servers, stackTrail: st, context })
|
|
23
|
+
}),
|
|
14
24
|
extensionFields: (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({
|
|
15
25
|
skipped,
|
|
16
26
|
parent: pathItem,
|