@kubb/adapter-oas 5.0.0-alpha.55 → 5.0.0-alpha.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/adapter-oas",
3
- "version": "5.0.0-alpha.55",
3
+ "version": "5.0.0-alpha.57",
4
4
  "description": "OpenAPI / Swagger adapter for Kubb converts OAS input into a @kubb/ast RootNode.",
5
5
  "keywords": [
6
6
  "adapter",
@@ -46,7 +46,7 @@
46
46
  "oas": "^32.1.15",
47
47
  "oas-normalize": "^16.0.4",
48
48
  "swagger2openapi": "^7.0.8",
49
- "@kubb/core": "5.0.0-alpha.55"
49
+ "@kubb/core": "5.0.0-alpha.57"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/swagger2openapi": "^7.0.4",
package/src/parser.ts CHANGED
@@ -797,17 +797,14 @@ function createSchemaParser(ctx: OasParserContext) {
797
797
  description?: string
798
798
  required: boolean
799
799
  } {
800
- const body = operation.schema.requestBody
801
- if (!body || isReference(body)) return { required: false }
802
-
803
- const inline = body as {
804
- description?: string
805
- required?: boolean
806
- }
800
+ const body = operation.schema.requestBody as { description?: string; required?: boolean } | undefined
801
+ if (!body) return { required: false }
807
802
 
803
+ // After getRequestBodyContentTypes has run, body may still carry $ref but the
804
+ // resolved fields (description, required, content) are already spread onto it.
808
805
  return {
809
- description: inline.description,
810
- required: inline.required === true,
806
+ description: body.description,
807
+ required: body.required === true,
811
808
  }
812
809
  }
813
810
 
package/src/resolvers.ts CHANGED
@@ -543,9 +543,10 @@ export function getRequestBodyContentTypes(document: Document, operation: Operat
543
543
  operation.schema.requestBody = dereferenceWithRef(document, operation.schema.requestBody)
544
544
  }
545
545
 
546
- const body = operation.schema.requestBody
547
- if (!body || isReference(body)) return []
546
+ const body = operation.schema.requestBody as { content?: Record<string, unknown> } | undefined
547
+ if (!body) return []
548
548
 
549
- const inline = body as { content?: Record<string, unknown> }
550
- return inline.content ? Object.keys(inline.content) : []
549
+ // dereferenceWithRef keeps $ref but spreads all resolved fields (including `content`).
550
+ // Do not bail out on isReference — the content is already present on the merged object.
551
+ return body.content ? Object.keys(body.content) : []
551
552
  }