Closed
Description
Thanks everyone for the new updates of openapi-typescript
! I have found an issue which I believe might be related to the new major version (7).
Description
In version 7.3.0
and OpenAPI version 3.0.3
, combining type: object
and nullable: true
does not produce the expected union type.
Reproduction
Run the CLI with default options on the following schema:
openapi: "3.0.3"
info: { title: "Test", version: "0" }
servers:
- url: "example.com"
components:
schemas:
obj1:
type: object
nullable: true
paths: {}
Expected result
schemas: {
obj1: Record<string, never> | null;
};
Actual Result
schemas: {
obj1: Record<string, never>;
};
Checklist
- My OpenAPI schema passes the Redocly validator (
npx @redocly/cli@latest lint
) - I’m willing to open a PR (see CONTRIBUTING.md)
The example given above works fine with type: string
and nullable: true
. It also works in openapi-typescript
version 6.7.6
.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done