Open
Description
Description
A brief description of the bug.
I have a nullable enum yaml file (Open API 3.1) defined like:
type:
- string
- 'null'
...
enum:
- VALUE1
- VALUE2
- null
which i have in my schema as
values:
$ref: <relative_path>/values.yaml
This will output in the TS schema output:
values: "VALUE1" | "VALUE2" | null
with no enum emitted
Name | Version |
---|---|
openapi-typescript |
7.3.0 |
Node.js | v18.20.4 |
OS + version | macOS 14.6.1 |
Reproduction
How can this be reproduced / when did the error occur?
- create a nullable enum similar to the above example, reference it in API
npx openapi-typescript ./openapi.yaml -o ./src/typings/schema.d.ts --enum --alphabetize --dedupe-enums
- check output schema.d.ts
Expected result
- It should output the enum for valid values (e.g.
export enum Values ...
- the output in the TS schema should be
values: Values | null
Checklist
- My OpenAPI schema passes the Redocly validator (
npx @redocly/cli@latest lint
) - I’m willing to open a PR (see CONTRIBUTING.md)
Metadata
Metadata
Assignees
Type
Projects
Status
No status