Skip to content

Commit adbac42

Browse files
committed
fix(gen): use spec names instead of Go names to infer discriminator
1 parent 761c50b commit adbac42

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)