We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"nullable": true
Description
When a JSON API spec has "nullable": true for an empty object, the resulting TS type does not include null.
null
Reproduction
Copy the following into a JSON API spec:
"NullableEmptyObject": { "nullable": true, "properties": {}, "title": "NullableEmptyObject", "type": "object" }, "NullableObject": { "nullable": true, "properties": { "name": { "type": "string" } }, "title": "NullableObject", "type": "object" }, "NullableString": { "nullable": true, "title": "NullableString", "type": "string" },
The generated TS types are
/** NullableEmptyObject */ NullableEmptyObject: Record<string, never>; /** NullableObject */ NullableObject: { name?: string; } | null; /** NullableString */ NullableString: string | null;
Expected result
NullableEmptyObject should be typed as Record<string, never> | null.
NullableEmptyObject
Record<string, never> | null
Checklist
npx @redocly/cli@latest lint
I could open a PR in a few weeks, but I'm not able to do so right now!
The text was updated successfully, but these errors were encountered:
It is a duplicate of #1821
Sorry, something went wrong.
drwpow
No branches or pull requests
Description
When a JSON API spec has
"nullable": true
for an empty object, the resulting TS type does not includenull
.Reproduction
Copy the following into a JSON API spec:
The generated TS types are
Expected result
NullableEmptyObject
should be typed asRecord<string, never> | null
.Checklist
npx @redocly/cli@latest lint
)I could open a PR in a few weeks, but I'm not able to do so right now!
The text was updated successfully, but these errors were encountered: