Skip to content

Commit 5e7d8f9

Browse files
authored
Merge pull request #1195 from tdakkota/fix/use-json-schema-names
fix(gen): use spec names instead of Go names to infer discriminator
2 parents 761c50b + adbac42 commit 5e7d8f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gen/schema_gen_sum.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ func (g *schemaGen) oneOf(name string, schema *jsonschema.Schema, side bool) (*i
371371
)
372372
}
373373
for _, f := range s.JSON().Fields() {
374-
uniq[s.Name][f.Name] = struct{}{}
374+
uniq[s.Name][f.Tag.JSON] = struct{}{}
375375
}
376376
}
377377
{
@@ -485,7 +485,7 @@ func (g *schemaGen) oneOf(name string, schema *jsonschema.Schema, side bool) (*i
485485
continue
486486
}
487487
for _, f := range s.JSON().Fields() {
488-
if !slices.Contains(v.Unique, f.Name) {
488+
if !slices.Contains(v.Unique, f.Tag.JSON) {
489489
continue
490490
}
491491
s.SumSpec.Unique = append(s.SumSpec.Unique, f)

0 commit comments

Comments
 (0)