@kubb/adapter-oas 5.0.0-alpha.21 → 5.0.0-alpha.23
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 +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/parser.ts +11 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import * as _kubb_core0 from "@kubb/core";
|
|
2
|
+
import * as _$_kubb_core0 from "@kubb/core";
|
|
3
3
|
import { AdapterFactoryOptions } from "@kubb/core";
|
|
4
4
|
import { OASDocument } from "oas/types";
|
|
5
5
|
import { ParserOptions } from "@kubb/ast/types";
|
|
6
|
-
|
|
7
6
|
//#region src/types.d.ts
|
|
8
7
|
/**
|
|
9
8
|
* Content-type string used when selecting request/response schemas from a spec.
|
|
@@ -127,7 +126,7 @@ declare const adapterOasName = "oas";
|
|
|
127
126
|
* })
|
|
128
127
|
* ```
|
|
129
128
|
*/
|
|
130
|
-
declare const adapterOas: (options?: AdapterOasOptions | undefined) => _kubb_core0.Adapter<AdapterOas>;
|
|
129
|
+
declare const adapterOas: (options?: AdapterOasOptions | undefined) => _$_kubb_core0.Adapter<AdapterOas>;
|
|
131
130
|
//#endregion
|
|
132
131
|
export { type AdapterOas, adapterOas, adapterOasName };
|
|
133
132
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
|
-
import { childName, collectImports, createDiscriminantNode, createOperation, createParameter, createProperty, createResponse, createRoot, createSchema, enumPropName, extractRefName, findDiscriminator, mediaTypes, mergeAdjacentObjects, narrowSchema, schemaTypes, setDiscriminatorEnum, setEnumName, simplifyUnion, transform } from "@kubb/ast";
|
|
2
|
+
import { childName, collectImports, createDiscriminantNode, createOperation, createParameter, createProperty, createResponse, createRoot, createSchema, enumPropName, extractRefName, findDiscriminator, mediaTypes, mergeAdjacentObjects, narrowSchema, schemaTypes, setDiscriminatorEnum, setEnumName, simplifyUnion, syncOptionality, transform } from "@kubb/ast";
|
|
3
3
|
import { createAdapter } from "@kubb/core";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { bundle, loadConfig } from "@redocly/openapi-core";
|
|
@@ -1514,10 +1514,12 @@ function createSchemaParser(ctx) {
|
|
|
1514
1514
|
const requestBodySchemaNode = requestBodySchema ? parseSchema({ schema: requestBodySchema }, options) : void 0;
|
|
1515
1515
|
const requestBodyDescription = operation.schema.requestBody && !isReference(operation.schema.requestBody) ? operation.schema.requestBody.description : void 0;
|
|
1516
1516
|
const requestBodyKeysToOmit = requestBodySchema?.properties ? Object.entries(requestBodySchema.properties).filter(([, prop]) => !isReference(prop) && prop.readOnly).map(([key]) => key) : void 0;
|
|
1517
|
+
const requestBodyRequired = operation.schema.requestBody && !isReference(operation.schema.requestBody) ? operation.schema.requestBody.required === true : false;
|
|
1517
1518
|
const requestBody = requestBodySchemaNode ? {
|
|
1518
1519
|
description: requestBodyDescription,
|
|
1519
|
-
schema: requestBodySchemaNode,
|
|
1520
|
-
keysToOmit: requestBodyKeysToOmit?.length ? requestBodyKeysToOmit : void 0
|
|
1520
|
+
schema: syncOptionality(requestBodySchemaNode, requestBodyRequired),
|
|
1521
|
+
keysToOmit: requestBodyKeysToOmit?.length ? requestBodyKeysToOmit : void 0,
|
|
1522
|
+
required: requestBodyRequired || void 0
|
|
1521
1523
|
} : void 0;
|
|
1522
1524
|
const responses = operation.getResponseStatusCodes().map((statusCode) => {
|
|
1523
1525
|
const responseObj = operation.getResponseByStatusCode(statusCode);
|
|
@@ -1535,10 +1537,11 @@ function createSchemaParser(ctx) {
|
|
|
1535
1537
|
keysToOmit: keysToOmit?.length ? keysToOmit : void 0
|
|
1536
1538
|
});
|
|
1537
1539
|
});
|
|
1540
|
+
const urlPath = new URLPath(operation.path);
|
|
1538
1541
|
return createOperation({
|
|
1539
1542
|
operationId: operation.getOperationId(),
|
|
1540
1543
|
method: operation.method.toUpperCase(),
|
|
1541
|
-
path:
|
|
1544
|
+
path: urlPath.path,
|
|
1542
1545
|
tags: operation.getTags().map((tag) => tag.name),
|
|
1543
1546
|
summary: operation.getSummary() || void 0,
|
|
1544
1547
|
description: operation.getDescription() || void 0,
|