-
Notifications
You must be signed in to change notification settings - Fork 317
Open
Labels
bugSomething isn't workingSomething isn't workingneeds-areaopenapi3:converterIssues for @typespec/openapi3 openapi to typespec converterIssues for @typespec/openapi3 openapi to typespec convertertriaged:core
Milestone
Description
Discussed in #7723
Originally posted by joprice June 24, 2025
When generating typespec from an openapi schema, with a component definition like
"ComposerStep": {
"oneOf": [
{
"$ref": "#/components/schemas/ComposerStepInit"
},
{
"$ref": "#/components/schemas/ComposerStepContinue"
},
{
"$ref": "#/components/schemas/ComposerStepSuggestions"
}
],
"discriminator": {
"propertyName": "tag",
"mapping": {
"init": "#/components/schemas/ComposerStepInit",
"continue": "#/components/schemas/ComposerStepContinue",
"suggestions": "#/components/schemas/ComposerStepSuggestions"
}
}
}The union case name "init" is not escaped with backticks, resulting in a syntax error:
@discriminated(#{ envelope: "none", discriminatorPropertyName: "tag" })
@oneOf
union ComposerStep {
init: ComposerStepInit
continue: ComposerStepContinue
suggestions: ComposerStepSuggestions
}
I found a test checking for keyword escapes, but perhaps it's not hitting this node in the ast, or "init" is not included in the reserved word list.</div>Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds-areaopenapi3:converterIssues for @typespec/openapi3 openapi to typespec converterIssues for @typespec/openapi3 openapi to typespec convertertriaged:core