@kubb/adapter-oas 5.0.0-alpha.26 → 5.0.0-alpha.28
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 +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/parser.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/adapter-oas",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.28",
|
|
4
4
|
"description": "OpenAPI / Swagger adapter for Kubb — converts OAS input into a @kubb/ast RootNode.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openapi",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"openapi-types": "^12.1.3",
|
|
47
47
|
"remeda": "^2.33.7",
|
|
48
48
|
"swagger2openapi": "^7.0.8",
|
|
49
|
-
"@kubb/ast": "5.0.0-alpha.
|
|
50
|
-
"@kubb/core": "5.0.0-alpha.
|
|
49
|
+
"@kubb/ast": "5.0.0-alpha.28",
|
|
50
|
+
"@kubb/core": "5.0.0-alpha.28"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/swagger2openapi": "^7.0.4",
|
package/src/parser.ts
CHANGED
|
@@ -748,12 +748,21 @@ function createSchemaParser(ctx: OasParserContext) {
|
|
|
748
748
|
? (operation.schema.requestBody as { required?: boolean }).required === true
|
|
749
749
|
: false
|
|
750
750
|
|
|
751
|
+
const requestBodyContentType = (() => {
|
|
752
|
+
if (!operation.schema.requestBody || isReference(operation.schema.requestBody)) {
|
|
753
|
+
return undefined
|
|
754
|
+
}
|
|
755
|
+
const content = (operation.schema.requestBody as { content?: Record<string, unknown> }).content
|
|
756
|
+
return content ? Object.keys(content)[0] : undefined
|
|
757
|
+
})()
|
|
758
|
+
|
|
751
759
|
const requestBody = requestBodySchemaNode
|
|
752
760
|
? {
|
|
753
761
|
description: requestBodyDescription,
|
|
754
762
|
schema: syncOptionality(requestBodySchemaNode, requestBodyRequired),
|
|
755
763
|
keysToOmit: requestBodyKeysToOmit?.length ? requestBodyKeysToOmit : undefined,
|
|
756
764
|
required: requestBodyRequired || undefined,
|
|
765
|
+
contentType: requestBodyContentType,
|
|
757
766
|
}
|
|
758
767
|
: undefined
|
|
759
768
|
|