@kubb/ast 5.0.0-alpha.52 → 5.0.0-alpha.54
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.cjs +9 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +28 -13
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/mocks.ts +1 -1
- package/src/nodes/operation.ts +28 -13
- package/src/utils.ts +1 -1
- package/src/visitor.ts +5 -2
package/dist/index.cjs
CHANGED
|
@@ -454,7 +454,7 @@ function createOperationParams(node, options) {
|
|
|
454
454
|
const pathParams = casedParams.filter((p) => p.in === "path");
|
|
455
455
|
const queryParams = casedParams.filter((p) => p.in === "query");
|
|
456
456
|
const headerParams = casedParams.filter((p) => p.in === "header");
|
|
457
|
-
const bodyType = node.requestBody?.schema ? wrapType(resolver?.resolveDataName(node) ?? "unknown") : void 0;
|
|
457
|
+
const bodyType = node.requestBody?.content?.[0]?.schema ? wrapType(resolver?.resolveDataName(node) ?? "unknown") : void 0;
|
|
458
458
|
const bodyRequired = node.requestBody?.required ?? false;
|
|
459
459
|
const queryGroupType = resolver ? resolveGroupType({
|
|
460
460
|
node,
|
|
@@ -1536,7 +1536,7 @@ function getChildren(node, recurse) {
|
|
|
1536
1536
|
case "Output": return [];
|
|
1537
1537
|
case "Operation": return [
|
|
1538
1538
|
...node.parameters,
|
|
1539
|
-
...node.requestBody?.schema ? [
|
|
1539
|
+
...node.requestBody?.content?.flatMap((c) => c.schema ? [c.schema] : []) ?? [],
|
|
1540
1540
|
...node.responses
|
|
1541
1541
|
];
|
|
1542
1542
|
case "Schema": {
|
|
@@ -1649,10 +1649,13 @@ function transform(node, options) {
|
|
|
1649
1649
|
})),
|
|
1650
1650
|
requestBody: op.requestBody ? {
|
|
1651
1651
|
...op.requestBody,
|
|
1652
|
-
|
|
1653
|
-
...
|
|
1654
|
-
|
|
1655
|
-
|
|
1652
|
+
content: op.requestBody.content?.map((c) => ({
|
|
1653
|
+
...c,
|
|
1654
|
+
schema: c.schema ? transform(c.schema, {
|
|
1655
|
+
...options,
|
|
1656
|
+
parent: op
|
|
1657
|
+
}) : void 0
|
|
1658
|
+
}))
|
|
1656
1659
|
} : void 0,
|
|
1657
1660
|
responses: op.responses.map((r) => transform(r, {
|
|
1658
1661
|
...options,
|