Description
openapi-typescript version
7.0.0-next.8
Node.js version
20
OS + version
macOS 15.2
Description
When separating out the required properties into its own schema, an additional type of Record<string, never> is generated onto the type which does not allow me to update the fields on the generated type. It also does not make the types required as specified in the OpenApi spec.
Reproduction
Hi, I was looking to follow this blog where ideally I can separate out properties to be reused in different methods(get/patch)
https://blog.stoplight.io/reuse-openapi-descriptions
So let's say I have the following schema
paths: '/customers': post: tags: - Customer requestBody: $ref: '#/components/requestBodies/CreateCustomer' responses: 201: description: Created content: application/json: schema: $ref: '#/components/schemas/CustomerId' components: schemas: Customer: allOf: - $ref: '#/components/schemas/CustomerProperties' - $ref: '#/components/schemas/CustomerRequiredProperties'
CustomerProperties:
type: object
properties:
FirstName:
type: string
LastName:
type: string
DOB:
type: string
format: date-time
Segment:
type: string
enum:
- Young
- MiddleAged
- Old
- Moribund
CustomerRequiredProperties:
type: object
required:
- FirstName
- LastName
- DOB`
Splitting out this into CustomerRequiredProperties generates Record<string, never> onto the type
Expected result
I would expect to have a Customer object that has the required properties of FirstName,LastName and DOB
Required
- My OpenAPI schema is valid and passes the Redocly validator (
npx @redocly/cli@latest lint
)
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)