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
ValueByDiscriminator() generates incorrect method call when union type is referenced via external ref in allOf #2470
When a schema is defined as allOf: [ExternalUnion, LocalObject] where ExternalUnion is a discriminated oneOf from another file, ValueByDiscriminator() is generated with incorrect syntax.
case"GitDiffFile":
returnt.AsExternalRef0GitDiffFile() // matches the actually generated As* method
Root cause
In union.tmpl, ValueByDiscriminator() uses $type from $discriminator.Mapping directly:
return t.As{{$type}}()
For external refs, $type = "externalRef0.GitDiffFile" which produces invalid Go (t.AsexternalRef0.GitDiffFile()).
The As* / From* / Merge* methods correctly use {{ .Method }} from the union element, which produces ExternalRef0GitDiffFile. ValueByDiscriminator() should do the same.
Activity
Fix ValueByDiscriminator() with external refs
Fix ValueByDiscriminator() with external refs
Fix ValueByDiscriminator() with external refs (oapi-codegen#2474)
Preserve recursive schema shape via back-ref substitution
Prevent stack overflow on recursive schemas (#2543)
feat(v3): allOf can only annotate external and x-go-type schemas (#2568)