@skmtc/core 0.58.2 → 0.58.4
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/context/BuiltOnRead.d.ts +37 -0
- package/esm/context/BuiltOnRead.js +199 -0
- package/esm/context/CoreContext.js +11 -5
- package/esm/context/GenerateContext.d.ts +3 -3
- package/esm/context/GenerateContext.js +13 -6
- package/esm/context/ParseContext.js +116 -11
- package/esm/context/Subject.d.ts +29 -2
- package/esm/context/Subject.js +67 -6
- package/esm/context/generateTypes.d.ts +2 -2
- package/esm/dsl/model/ModelDriver.js +2 -2
- package/esm/dsl/operation/gql/GqlOperationDriver.js +2 -2
- package/esm/dsl/operation/oas/OasOperationDriver.js +2 -2
- package/esm/dsl/webhook/WebhookDriver.js +2 -2
- package/esm/helpers/getPath.d.ts +6 -0
- package/esm/helpers/getPath.js +6 -0
- package/esm/helpers/isDeepEqual.d.ts +17 -0
- package/esm/helpers/isDeepEqual.js +93 -0
- package/esm/helpers/parseModuleName.d.ts +8 -8
- package/esm/helpers/parseModuleName.js +8 -8
- package/esm/helpers/toVariantList.d.ts +1 -1
- package/esm/oas/document/Document.d.ts +5 -1
- package/esm/oas/document/Document.js +10 -1
- package/esm/oas/document/documentSource.d.ts +37 -0
- package/esm/oas/document/documentSource.js +27 -0
- package/esm/oas/schema/siblings.js +6 -4
- package/esm/parse/v3-0/operation/toOperationsV3.d.ts +14 -0
- package/esm/parse/v3-0/operation/toOperationsV3.js +68 -67
- package/esm/parse/v3-1/operation/toOperationsV3.d.ts +14 -0
- package/esm/parse/v3-1/operation/toOperationsV3.js +68 -67
- package/esm/parse/v3-2/operation/toOperationsV3.d.ts +14 -0
- package/esm/parse/v3-2/operation/toOperationsV3.js +69 -68
- package/package.json +1 -4
- package/script/context/BuiltOnRead.d.ts +37 -0
- package/script/context/BuiltOnRead.js +203 -0
- package/script/context/CoreContext.js +11 -5
- package/script/context/GenerateContext.d.ts +3 -3
- package/script/context/GenerateContext.js +13 -6
- package/script/context/ParseContext.js +116 -11
- package/script/context/Subject.d.ts +29 -2
- package/script/context/Subject.js +67 -6
- package/script/context/generateTypes.d.ts +2 -2
- package/script/dsl/model/ModelDriver.js +2 -5
- package/script/dsl/operation/gql/GqlOperationDriver.js +2 -5
- package/script/dsl/operation/oas/OasOperationDriver.js +2 -2
- package/script/dsl/webhook/WebhookDriver.js +2 -5
- package/script/helpers/getPath.d.ts +6 -0
- package/script/helpers/getPath.js +10 -0
- package/script/helpers/isDeepEqual.d.ts +17 -0
- package/script/helpers/isDeepEqual.js +97 -0
- package/script/helpers/parseModuleName.d.ts +8 -8
- package/script/helpers/parseModuleName.js +8 -8
- package/script/helpers/toVariantList.d.ts +1 -1
- package/script/oas/document/Document.d.ts +5 -1
- package/script/oas/document/Document.js +10 -1
- package/script/oas/document/documentSource.d.ts +37 -0
- package/script/oas/document/documentSource.js +36 -0
- package/script/oas/schema/siblings.js +6 -7
- package/script/parse/v3-0/operation/toOperationsV3.d.ts +14 -0
- package/script/parse/v3-0/operation/toOperationsV3.js +71 -69
- package/script/parse/v3-1/operation/toOperationsV3.d.ts +14 -0
- package/script/parse/v3-1/operation/toOperationsV3.js +71 -69
- package/script/parse/v3-2/operation/toOperationsV3.d.ts +14 -0
- package/script/parse/v3-2/operation/toOperationsV3.js +72 -70
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toOperationsV3 = exports.toOperationV3 = void 0;
|
|
3
|
+
exports.toPathOperationsV3 = exports.toOperationsV3 = exports.toOperationV3 = void 0;
|
|
4
4
|
const toRequestBodiesV3_js_1 = require("../requestBody/toRequestBodiesV3.js");
|
|
5
5
|
const toResponseV3_js_1 = require("../response/toResponseV3.js");
|
|
6
6
|
const toParameterV3_js_1 = require("../parameter/toParameterV3.js");
|
|
@@ -53,75 +53,77 @@ const toOperationV3 = ({ operation, operationInfo, stackTrail, context }) => {
|
|
|
53
53
|
};
|
|
54
54
|
exports.toOperationV3 = toOperationV3;
|
|
55
55
|
const toOperationsV3 = ({ paths, stackTrail, context }) => {
|
|
56
|
-
return Object.entries(paths).flatMap(([path, pathItem]) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
return Object.entries(paths).flatMap(([path, pathItem]) => stackTrail.trace(path, pathStack => pathItem ? (0, exports.toPathOperationsV3)({ path, pathItem, stackTrail: pathStack, context }) : []));
|
|
57
|
+
};
|
|
58
|
+
exports.toOperationsV3 = toOperationsV3;
|
|
59
|
+
/**
|
|
60
|
+
* The operations of the path item at `path`. They share one parsed path
|
|
61
|
+
* item. With `method`, only the operation at that method is parsed.
|
|
62
|
+
*/
|
|
63
|
+
const toPathOperationsV3 = ({ path, pathItem, stackTrail: pathStack, context, method: only }) => {
|
|
64
|
+
const cleaned = Object.entries(pathItem).reduce(({ rest, methodObject }, [key, operation]) => {
|
|
65
|
+
const method = (0, methods_js_1.toPathItemMethod)(key);
|
|
66
|
+
if (method) {
|
|
67
|
+
const { [method]: _deleted, ...remaining } = rest;
|
|
68
|
+
return {
|
|
69
|
+
rest: remaining,
|
|
70
|
+
methodObject: {
|
|
71
|
+
...methodObject,
|
|
72
|
+
[method]: operation
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
111
|
-
context.logIssueNoKey({
|
|
112
|
-
parent: operation,
|
|
113
|
-
level: 'error',
|
|
114
|
-
message: normalized.message,
|
|
115
|
-
cause: normalized,
|
|
116
|
-
stackTrail: st,
|
|
117
|
-
type: 'INVALID_OPERATION'
|
|
118
|
-
});
|
|
119
|
-
return undefined;
|
|
120
|
-
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return { rest, methodObject };
|
|
77
|
+
}, {
|
|
78
|
+
rest: pathItem,
|
|
79
|
+
methodObject: {}
|
|
80
|
+
});
|
|
81
|
+
const pathItemResult = !(0, isEmpty_js_1.isEmpty)(cleaned.rest)
|
|
82
|
+
? (0, toPathItemV3_js_1.toPathItemV3)({ pathItem: cleaned.rest, stackTrail: pathStack, context })
|
|
83
|
+
: undefined;
|
|
84
|
+
const pathItemObject = pathItemResult?.pathItem;
|
|
85
|
+
const brokenParameters = pathItemResult?.brokenParameters ?? [];
|
|
86
|
+
return Object.entries(cleaned.methodObject)
|
|
87
|
+
.filter(([method]) => only === undefined || method === only)
|
|
88
|
+
.map(([method, operation]) => {
|
|
89
|
+
// Use `pathStack` (the trail with `path` already pushed),
|
|
90
|
+
// not the outer `stackTrail` — otherwise downstream traces
|
|
91
|
+
// record paths:<method>:... and lose the actual path
|
|
92
|
+
// segment, which breaks `OasDocument.removeItem` and the
|
|
93
|
+
// dependency-ref invalidation it backs.
|
|
94
|
+
return pathStack.trace(method, st => {
|
|
95
|
+
if (!operation) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if ((0, pathParameters_js_1.isDroppedByPathParameter)({ brokenParameters, operation, stackTrail: st, context })) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
return (0, exports.toOperationV3)({
|
|
103
|
+
operation,
|
|
104
|
+
operationInfo: {
|
|
105
|
+
method: method,
|
|
106
|
+
path,
|
|
107
|
+
pathItem: pathItemObject
|
|
108
|
+
},
|
|
109
|
+
stackTrail: st,
|
|
110
|
+
context
|
|
121
111
|
});
|
|
122
|
-
}
|
|
123
|
-
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
115
|
+
context.logIssueNoKey({
|
|
116
|
+
parent: operation,
|
|
117
|
+
level: 'error',
|
|
118
|
+
message: normalized.message,
|
|
119
|
+
cause: normalized,
|
|
120
|
+
stackTrail: st,
|
|
121
|
+
type: 'INVALID_OPERATION'
|
|
122
|
+
});
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
124
125
|
});
|
|
125
|
-
})
|
|
126
|
+
})
|
|
127
|
+
.filter((item) => Boolean(item));
|
|
126
128
|
};
|
|
127
|
-
exports.
|
|
129
|
+
exports.toPathOperationsV3 = toPathOperationsV3;
|
|
@@ -22,4 +22,18 @@ export type ToOperationsV3Args = {
|
|
|
22
22
|
context: ParseContextType;
|
|
23
23
|
};
|
|
24
24
|
export declare const toOperationsV3: ({ paths, stackTrail, context }: ToOperationsV3Args) => OasOperation[];
|
|
25
|
+
export type ToPathOperationsV3Args = {
|
|
26
|
+
path: string;
|
|
27
|
+
pathItem: OpenAPIV3.PathItemObject;
|
|
28
|
+
/** The trail of the path item, with `path` already pushed. */
|
|
29
|
+
stackTrail: StackTrail;
|
|
30
|
+
context: ParseContextType;
|
|
31
|
+
/** Parses only the operation at this method. */
|
|
32
|
+
method?: Method;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The operations of the path item at `path`. They share one parsed path
|
|
36
|
+
* item. With `method`, only the operation at that method is parsed.
|
|
37
|
+
*/
|
|
38
|
+
export declare const toPathOperationsV3: ({ path, pathItem, stackTrail: pathStack, context, method: only }: ToPathOperationsV3Args) => OasOperation[];
|
|
25
39
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toOperationsV3 = exports.toOperationV3 = void 0;
|
|
3
|
+
exports.toPathOperationsV3 = exports.toOperationsV3 = exports.toOperationV3 = void 0;
|
|
4
4
|
const toRequestBodiesV3_js_1 = require("../requestBody/toRequestBodiesV3.js");
|
|
5
5
|
const toResponseV3_js_1 = require("../response/toResponseV3.js");
|
|
6
6
|
const toParameterV3_js_1 = require("../parameter/toParameterV3.js");
|
|
@@ -56,75 +56,77 @@ const toOperationsV3 = ({ paths, stackTrail, context }) => {
|
|
|
56
56
|
if (!paths) {
|
|
57
57
|
return [];
|
|
58
58
|
}
|
|
59
|
-
return Object.entries(paths).flatMap(([path, pathItem]) => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
59
|
+
return Object.entries(paths).flatMap(([path, pathItem]) => stackTrail.trace(path, pathStack => pathItem ? (0, exports.toPathOperationsV3)({ path, pathItem, stackTrail: pathStack, context }) : []));
|
|
60
|
+
};
|
|
61
|
+
exports.toOperationsV3 = toOperationsV3;
|
|
62
|
+
/**
|
|
63
|
+
* The operations of the path item at `path`. They share one parsed path
|
|
64
|
+
* item. With `method`, only the operation at that method is parsed.
|
|
65
|
+
*/
|
|
66
|
+
const toPathOperationsV3 = ({ path, pathItem, stackTrail: pathStack, context, method: only }) => {
|
|
67
|
+
const cleaned = Object.entries(pathItem).reduce(({ rest, methodObject }, [key, operation]) => {
|
|
68
|
+
const method = (0, methods_js_1.toPathItemMethod)(key);
|
|
69
|
+
if (method) {
|
|
70
|
+
const { [method]: _deleted, ...remaining } = rest;
|
|
71
|
+
return {
|
|
72
|
+
rest: remaining,
|
|
73
|
+
methodObject: {
|
|
74
|
+
...methodObject,
|
|
75
|
+
[method]: operation
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
114
|
-
context.logIssueNoKey({
|
|
115
|
-
parent: operation,
|
|
116
|
-
level: 'error',
|
|
117
|
-
message: normalized.message,
|
|
118
|
-
cause: normalized,
|
|
119
|
-
stackTrail: st,
|
|
120
|
-
type: 'INVALID_OPERATION'
|
|
121
|
-
});
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return { rest, methodObject };
|
|
80
|
+
}, {
|
|
81
|
+
rest: pathItem,
|
|
82
|
+
methodObject: {}
|
|
83
|
+
});
|
|
84
|
+
const pathItemResult = !(0, isEmpty_js_1.isEmpty)(cleaned.rest)
|
|
85
|
+
? (0, toPathItemV3_js_1.toPathItemV3)({ pathItem: cleaned.rest, stackTrail: pathStack, context })
|
|
86
|
+
: undefined;
|
|
87
|
+
const pathItemObject = pathItemResult?.pathItem;
|
|
88
|
+
const brokenParameters = pathItemResult?.brokenParameters ?? [];
|
|
89
|
+
return Object.entries(cleaned.methodObject)
|
|
90
|
+
.filter(([method]) => only === undefined || method === only)
|
|
91
|
+
.map(([method, operation]) => {
|
|
92
|
+
// Use `pathStack` (the trail with `path` already pushed),
|
|
93
|
+
// not the outer `stackTrail` — otherwise downstream traces
|
|
94
|
+
// record paths:<method>:... and lose the actual path
|
|
95
|
+
// segment, which breaks `OasDocument.removeItem` and the
|
|
96
|
+
// dependency-ref invalidation it backs.
|
|
97
|
+
return pathStack.trace(method, st => {
|
|
98
|
+
if (!operation) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if ((0, pathParameters_js_1.isDroppedByPathParameter)({ brokenParameters, operation, stackTrail: st, context })) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
return (0, exports.toOperationV3)({
|
|
106
|
+
operation,
|
|
107
|
+
operationInfo: {
|
|
108
|
+
method: method,
|
|
109
|
+
path,
|
|
110
|
+
pathItem: pathItemObject
|
|
111
|
+
},
|
|
112
|
+
stackTrail: st,
|
|
113
|
+
context
|
|
124
114
|
});
|
|
125
|
-
}
|
|
126
|
-
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
118
|
+
context.logIssueNoKey({
|
|
119
|
+
parent: operation,
|
|
120
|
+
level: 'error',
|
|
121
|
+
message: normalized.message,
|
|
122
|
+
cause: normalized,
|
|
123
|
+
stackTrail: st,
|
|
124
|
+
type: 'INVALID_OPERATION'
|
|
125
|
+
});
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
127
128
|
});
|
|
128
|
-
})
|
|
129
|
+
})
|
|
130
|
+
.filter((item) => Boolean(item));
|
|
129
131
|
};
|
|
130
|
-
exports.
|
|
132
|
+
exports.toPathOperationsV3 = toPathOperationsV3;
|
|
@@ -22,4 +22,18 @@ export type ToOperationsV3Args = {
|
|
|
22
22
|
context: ParseContextType;
|
|
23
23
|
};
|
|
24
24
|
export declare const toOperationsV3: ({ paths, stackTrail, context }: ToOperationsV3Args) => OasOperation[];
|
|
25
|
+
export type ToPathOperationsV3Args = {
|
|
26
|
+
path: string;
|
|
27
|
+
pathItem: OpenAPIV3.PathItemObject;
|
|
28
|
+
/** The trail of the path item, with `path` already pushed. */
|
|
29
|
+
stackTrail: StackTrail;
|
|
30
|
+
context: ParseContextType;
|
|
31
|
+
/** Parses only the operation at this method. */
|
|
32
|
+
method?: Method;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The operations of the path item at `path`. They share one parsed path
|
|
36
|
+
* item. With `method`, only the operation at that method is parsed.
|
|
37
|
+
*/
|
|
38
|
+
export declare const toPathOperationsV3: ({ path, pathItem, stackTrail: pathStack, context, method: only }: ToPathOperationsV3Args) => OasOperation[];
|
|
25
39
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toOperationsV3 = exports.toOperationV3 = void 0;
|
|
3
|
+
exports.toPathOperationsV3 = exports.toOperationsV3 = exports.toOperationV3 = void 0;
|
|
4
4
|
const toRequestBodiesV3_js_1 = require("../requestBody/toRequestBodiesV3.js");
|
|
5
5
|
const toResponseV3_js_1 = require("../response/toResponseV3.js");
|
|
6
6
|
const toParameterV3_js_1 = require("../parameter/toParameterV3.js");
|
|
@@ -59,76 +59,78 @@ const toOperationsV3 = ({ paths, stackTrail, context }) => {
|
|
|
59
59
|
if (!paths) {
|
|
60
60
|
return [];
|
|
61
61
|
}
|
|
62
|
-
return Object.entries(paths).flatMap(([path, pathItem]) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
62
|
+
return Object.entries(paths).flatMap(([path, pathItem]) => stackTrail.trace(path, pathStack => pathItem ? (0, exports.toPathOperationsV3)({ path, pathItem, stackTrail: pathStack, context }) : []));
|
|
63
|
+
};
|
|
64
|
+
exports.toOperationsV3 = toOperationsV3;
|
|
65
|
+
/**
|
|
66
|
+
* The operations of the path item at `path`. They share one parsed path
|
|
67
|
+
* item. With `method`, only the operation at that method is parsed.
|
|
68
|
+
*/
|
|
69
|
+
const toPathOperationsV3 = ({ path, pathItem, stackTrail: pathStack, context, method: only }) => {
|
|
70
|
+
const fixedFields = (0, dropAdditionalOperationsV3_js_1.dropAdditionalOperationsV3)({ pathItem, stackTrail: pathStack, context });
|
|
71
|
+
const cleaned = Object.entries(fixedFields).reduce(({ rest, methodObject }, [key, operation]) => {
|
|
72
|
+
const method = (0, methods_js_1.toPathItemMethod)(key);
|
|
73
|
+
if (method) {
|
|
74
|
+
const { [method]: _deleted, ...remaining } = rest;
|
|
75
|
+
return {
|
|
76
|
+
rest: remaining,
|
|
77
|
+
methodObject: {
|
|
78
|
+
...methodObject,
|
|
79
|
+
[method]: operation
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
118
|
-
context.logIssueNoKey({
|
|
119
|
-
parent: operation,
|
|
120
|
-
level: 'error',
|
|
121
|
-
message: normalized.message,
|
|
122
|
-
cause: normalized,
|
|
123
|
-
stackTrail: st,
|
|
124
|
-
type: 'INVALID_OPERATION'
|
|
125
|
-
});
|
|
126
|
-
return undefined;
|
|
127
|
-
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return { rest, methodObject };
|
|
84
|
+
}, {
|
|
85
|
+
rest: fixedFields,
|
|
86
|
+
methodObject: {}
|
|
87
|
+
});
|
|
88
|
+
const pathItemResult = !(0, isEmpty_js_1.isEmpty)(cleaned.rest)
|
|
89
|
+
? (0, toPathItemV3_js_1.toPathItemV3)({ pathItem: cleaned.rest, stackTrail: pathStack, context })
|
|
90
|
+
: undefined;
|
|
91
|
+
const pathItemObject = pathItemResult?.pathItem;
|
|
92
|
+
const brokenParameters = pathItemResult?.brokenParameters ?? [];
|
|
93
|
+
return Object.entries(cleaned.methodObject)
|
|
94
|
+
.filter(([method]) => only === undefined || method === only)
|
|
95
|
+
.map(([method, operation]) => {
|
|
96
|
+
// Use `pathStack` (the trail with `path` already pushed),
|
|
97
|
+
// not the outer `stackTrail` — otherwise downstream traces
|
|
98
|
+
// record paths:<method>:... and lose the actual path
|
|
99
|
+
// segment, which breaks `OasDocument.removeItem` and the
|
|
100
|
+
// dependency-ref invalidation it backs.
|
|
101
|
+
return pathStack.trace(method, st => {
|
|
102
|
+
if (!operation) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if ((0, pathParameters_js_1.isDroppedByPathParameter)({ brokenParameters, operation, stackTrail: st, context })) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
return (0, exports.toOperationV3)({
|
|
110
|
+
operation,
|
|
111
|
+
operationInfo: {
|
|
112
|
+
method: method,
|
|
113
|
+
path,
|
|
114
|
+
pathItem: pathItemObject
|
|
115
|
+
},
|
|
116
|
+
stackTrail: st,
|
|
117
|
+
context
|
|
128
118
|
});
|
|
129
|
-
}
|
|
130
|
-
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
122
|
+
context.logIssueNoKey({
|
|
123
|
+
parent: operation,
|
|
124
|
+
level: 'error',
|
|
125
|
+
message: normalized.message,
|
|
126
|
+
cause: normalized,
|
|
127
|
+
stackTrail: st,
|
|
128
|
+
type: 'INVALID_OPERATION'
|
|
129
|
+
});
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
131
132
|
});
|
|
132
|
-
})
|
|
133
|
+
})
|
|
134
|
+
.filter((item) => Boolean(item));
|
|
133
135
|
};
|
|
134
|
-
exports.
|
|
136
|
+
exports.toPathOperationsV3 = toPathOperationsV3;
|