Skip to content

Commit

Permalink
Merge pull request #1195 from tdakkota/fix/use-json-schema-names
Browse files Browse the repository at this point in the history
fix(gen): use spec names instead of Go names to infer discriminator
  • Loading branch information
ernado authored Mar 11, 2024
2 parents 761c50b + adbac42 commit 5e7d8f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gen/schema_gen_sum.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func (g *schemaGen) oneOf(name string, schema *jsonschema.Schema, side bool) (*i
)
}
for _, f := range s.JSON().Fields() {
uniq[s.Name][f.Name] = struct{}{}
uniq[s.Name][f.Tag.JSON] = struct{}{}
}
}
{
Expand Down Expand Up @@ -485,7 +485,7 @@ func (g *schemaGen) oneOf(name string, schema *jsonschema.Schema, side bool) (*i
continue
}
for _, f := range s.JSON().Fields() {
if !slices.Contains(v.Unique, f.Name) {
if !slices.Contains(v.Unique, f.Tag.JSON) {
continue
}
s.SumSpec.Unique = append(s.SumSpec.Unique, f)
Expand Down

0 comments on commit 5e7d8f9

Please sign in to comment.