You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JSONSchema, even from ye olden days, always had a proper null type.
OpenAPI 3.0 dialect of JSONSchema forbids the use of null type and introduces nullable attribute instead.
OpenAPI 3.1 dialect aligns with JSONSchema more closely, deprecating the nullable attribute, and bringing back the null type.
Library used by Taxios to convert JSONSchema to TypeScript knows nothing about the dialect and happily ignores nullable attribute. Thus, Taxios generates wrong TypeScript for faithful OpenAPI 3.0 documents.
This could be mitigated by using hybrid documents, which are declared as OpenAPI 3.0 but actually use standard JSONSchema instead of the dialect. Although such hybrid documents do not pass validation, and have issues with the authoring tools (e.g. Stoplight reads hybrid documents properly, but converts edited sections back to the dialect).
OpenAPI 3.1 is still quite new, and is not supported yet in many places, so Taxios users may be forced to stick with OpenAPI 3.0.
The issue can be fixed by doing yet another pre-pass on the schema before feeding it to TS generator, to convert every nullable attribute into proper JSONSchema null type.
The text was updated successfully, but these errors were encountered:
Current state:
The issue can be fixed by doing yet another pre-pass on the schema before feeding it to TS generator, to convert every nullable attribute into proper JSONSchema null type.
The text was updated successfully, but these errors were encountered: