Closed
Description
Description
Hello! When my OpenAPI v3.0 spec has something like this:
"foo": {
"allOf": [
{
"$ref": "#/components/schemas/Bar"
}
],
"nullable": true
},
And my transform is this:
transform(schemaObject) {
// Treat optional AND nullable fields as just optional (possibly undefined)
if (!schemaObject.required && schemaObject.nullable) {
schemaObject.nullable = false;
}
},
with v6 I was getting the following:
foo?: components["schemas"]["Bar"];
but with v7 I'm now getting:
foo?: components["schemas"]["Bar"] | null;
Is this expected behavior? What can I do to make v7 work like v6 did here? The logic appears to still work for primitive type fields, but no longer for object refs.
Name | Version |
---|---|
openapi-typescript |
7.0.2 |
Node.js | 20.15.1 |
OS + version | Windows 11 |
Checklist
- My OpenAPI schema passes the Redocly validator (
npx @redocly/cli@latest lint
) - I’m willing to open a PR (see CONTRIBUTING.md)