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
{{ message }}
Repository navigation
[BUG][TYPESCRIPT] Non-nullable type is generated as nullable #23340
Could you provide us with a minimal spec file that reproduces the issue? The declaration file you shared is quite lengthy, so a smaller example would make it easier to review.
Both should be ContentType (no | null). No custom templates are involved — the default templates reproduce it.
Trigger conditions
The bug only appears when all three of these are present at once. Removing any single one makes it disappear:
A query parameter named content_type whose schema is a nullable enum ref — oneOf: [ {type: null}, {$ref: ContentType} ]. Dropping it, or making it a plain non-nullable $ref, fixes the output.
An operation whose response is an inline object the generator extracts into a synthetic model (GetHome200Response here, from { data: $ref HomePage }). A direct $ref response (no inline wrapper) fixes the output.
A schema with a property named content_type (plain $ref to the enum) and at least one other property (id). A schema whose only property is content_type is generated correctly.
Analysis (from Claude)
It looks like the nullability of the enum used in the content_typeparameter leaks onto unrelated schema properties that share the name content_type and reference the same enum — and it only surfaces once inline-model extraction runs for another operation.
This was reduced from my full spec: the nullable parameter comes from GET /api/search/title-groups/lite (a content_type: Option<ContentType> query param), the inline response wrapper from GET /api/home, and the poisoned property is TitleGroupHierarchyLite.content_type.
Activity
KannaKim commentedon Jul 18, 2026
Could you provide us with a minimal spec file that reproduces the issue? The declaration file you shared is quite lengthy, so a smaller example would make it easier to review.
FrenchGithubUser commentedon Jul 19, 2026
this reproduces the bug 7.23.0:
{ "openapi": "3.1.0", "info": { "title": "repro-23340", "version": "1.0.0" }, "paths": { "/home": { "get": { "operationId": "getHome", "responses": { "200": { "description": "ok", "content": { "application/json": { "schema": { "type": "object", "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/HomePage" } } } } } } } } }, "/search": { "get": { "operationId": "search", "parameters": [ { "name": "content_type", "in": "query", "required": false, "schema": { "oneOf": [ { "type": "null" }, { "$ref": "#/components/schemas/ContentType" } ] } } ], "responses": { "200": { "description": "ok" } } } } }, "components": { "schemas": { "ContentType": { "type": "string", "enum": ["movie"] }, "TitleGroupLite": { "type": "object", "required": ["content_type"], "properties": { "content_type": { "$ref": "#/components/schemas/ContentType" } } }, "HomePage": { "type": "object", "required": ["latest_uploads"], "properties": { "latest_uploads": { "type": "array", "items": { "$ref": "#/components/schemas/TitleGroupLite" } } } }, "TitleGroupHierarchyLite": { "type": "object", "required": ["id", "content_type"], "properties": { "id": { "type": "integer", "format": "int32" }, "content_type": { "$ref": "#/components/schemas/ContentType" } } } } } }Generate with:
Actual vs expected
Two schemas have an identical
content_typeproperty (required, plain$refto theContentTypeenum), but only one comes out nullable:Both should be
ContentType(no| null). No custom templates are involved — the default templates reproduce it.Trigger conditions
The bug only appears when all three of these are present at once. Removing any single one makes it disappear:
content_typewhose schema is a nullable enum ref —oneOf: [ {type: null}, {$ref: ContentType} ]. Dropping it, or making it a plain non-nullable$ref, fixes the output.GetHome200Responsehere, from{ data: $ref HomePage }). A direct$refresponse (no inline wrapper) fixes the output.content_type(plain$refto the enum) and at least one other property (id). A schema whose only property iscontent_typeis generated correctly.Analysis (from Claude)
It looks like the nullability of the enum used in the
content_typeparameter leaks onto unrelated schema properties that share the namecontent_typeand reference the same enum — and it only surfaces once inline-model extraction runs for another operation.This was reduced from my full spec: the nullable parameter comes from
GET /api/search/title-groups/lite(acontent_type: Option<ContentType>query param), the inline response wrapper fromGET /api/home, and the poisoned property isTitleGroupHierarchyLite.content_type.