From 1c1f8cf11e0f38f86bf22686cce01b09997b611a Mon Sep 17 00:00:00 2001 From: tdakkota Date: Wed, 16 Nov 2022 09:34:00 +0300 Subject: [PATCH] fix(gen): update generator due to schema parser changes --- gen/schema_gen_sum.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gen/schema_gen_sum.go b/gen/schema_gen_sum.go index fde354e6a..1f9c804fb 100644 --- a/gen/schema_gen_sum.go +++ b/gen/schema_gen_sum.go @@ -220,14 +220,12 @@ func (g *schemaGen) oneOf(name string, schema *jsonschema.Schema) (*ir.Type, err if !s.Is(ir.KindStruct, ir.KindMap) { return nil, errors.Wrapf(&ErrNotImplemented{"unsupported sum type variant"}, "%q", s.Kind) } - var ref string - if s.Schema != nil { - ref = s.Schema.Ref - } else { - ref = schema.OneOf[i].Ref + vschema := s.Schema + if vschema == nil { + vschema = schema.OneOf[i] } - if ref == v || path.Base(ref) == v { + if vschema == v { found = true sum.SumSpec.Mapping = append(sum.SumSpec.Mapping, ir.SumSpecMap{ Key: k,