Skip to content

Commit acd137c

Browse files
authored
Merge pull request #24 from padiazg/fix-ref-along-with-other-properties
References should not be present along with other properties
2 parents 003349e + 4324f3b commit acd137c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

build.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,18 @@ func makeComponentSchemasMap(schemas *Schemas) map[string]interface{} {
247247

248248
for _, s := range *schemas {
249249
scheme := make(map[string]interface{})
250-
scheme[keyType] = s.Type
251-
scheme[keyProperties] = makePropertiesMap(&s.Properties)
252-
scheme[keyRef] = s.Ref
253250

254-
if s.XML.Name != "" {
255-
scheme[keyXML] = s.XML
256-
}
251+
if s.Ref != "" {
252+
scheme[keyRef] = s.Ref
253+
} else {
254+
scheme[keyType] = s.Type
255+
schemesMap[s.Name] = scheme
256+
scheme[keyProperties] = makePropertiesMap(&s.Properties)
257257

258-
schemesMap[s.Name] = scheme
258+
if s.XML.Name != "" {
259+
scheme[keyXML] = s.XML
260+
}
261+
}
259262
}
260263

261264
return schemesMap

0 commit comments

Comments
 (0)