@kubb/adapter-oas 5.0.0-alpha.13 → 5.0.0-alpha.14
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 +8 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -10
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/oas/utils.ts +7 -8
- package/src/parser.ts +0 -3
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.14",
|
|
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.6",
|
|
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.14",
|
|
50
|
+
"@kubb/core": "5.0.0-alpha.14"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/swagger2openapi": "^7.0.4",
|
package/src/oas/utils.ts
CHANGED
|
@@ -323,15 +323,14 @@ export function extractSchemaFromContent(content: Record<string, unknown> | unde
|
|
|
323
323
|
* Returns the PascalCase suffix appended to a component name when resolving
|
|
324
324
|
* cross-source name collisions (schemas vs. responses vs. requestBodies).
|
|
325
325
|
*/
|
|
326
|
+
const semanticSuffixes: Record<SchemaSourceMode, string> = {
|
|
327
|
+
schemas: 'Schema',
|
|
328
|
+
responses: 'Response',
|
|
329
|
+
requestBodies: 'Request',
|
|
330
|
+
}
|
|
331
|
+
|
|
326
332
|
function getSemanticSuffix(source: SchemaSourceMode): string {
|
|
327
|
-
|
|
328
|
-
case 'schemas':
|
|
329
|
-
return 'Schema'
|
|
330
|
-
case 'responses':
|
|
331
|
-
return 'Response'
|
|
332
|
-
case 'requestBodies':
|
|
333
|
-
return 'Request'
|
|
334
|
-
}
|
|
333
|
+
return semanticSuffixes[source]
|
|
335
334
|
}
|
|
336
335
|
|
|
337
336
|
/**
|
package/src/parser.ts
CHANGED
|
@@ -804,8 +804,6 @@ export function createOasParser(oas: Oas, { contentType, collisionDetection }: O
|
|
|
804
804
|
schema: {
|
|
805
805
|
...schemaNode,
|
|
806
806
|
nullable: schemaNode.type === 'null' ? undefined : propNullable || undefined,
|
|
807
|
-
optional: !required && !propNullable ? true : undefined,
|
|
808
|
-
nullish: !required && propNullable ? true : undefined,
|
|
809
807
|
},
|
|
810
808
|
required,
|
|
811
809
|
})
|
|
@@ -1078,7 +1076,6 @@ export function createOasParser(oas: Oas, { contentType, collisionDetection }: O
|
|
|
1078
1076
|
schema: {
|
|
1079
1077
|
...schema,
|
|
1080
1078
|
description: (param['description'] as string | undefined) ?? schema.description,
|
|
1081
|
-
optional: !required || !!schema.optional ? true : undefined,
|
|
1082
1079
|
},
|
|
1083
1080
|
required,
|
|
1084
1081
|
})
|