@@ -296,19 +296,6 @@ func GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error) {
296296 SkipOptionalPointer : skipOptionalPointer ,
297297 }
298298
299- // AllOf is interesting, and useful. It's the union of a number of other
300- // schemas. A common usage is to create a union of an object with an ID,
301- // so that in a RESTful paradigm, the Create operation can return
302- // (object, id), so that other operations can refer to (id)
303- if schema .AllOf != nil {
304- mergedSchema , err := MergeSchemas (schema , path )
305- if err != nil {
306- return Schema {}, fmt .Errorf ("error merging schemas: %w" , err )
307- }
308- mergedSchema .OAPISchema = schema
309- return mergedSchema , nil
310- }
311-
312299 // Check x-go-type, which will completely override the definition of this
313300 // schema with the provided type.
314301 if extension , ok := schema .Extensions [extPropGoType ]; ok {
@@ -333,6 +320,19 @@ func GenerateGoSchema(sref *openapi3.SchemaRef, path []string) (Schema, error) {
333320 return outSchema , nil
334321 }
335322 }
323+
324+ // AllOf is interesting, and useful. It's the union of a number of other
325+ // schemas. A common usage is to create a union of an object with an ID,
326+ // so that in a RESTful paradigm, the Create operation can return
327+ // (object, id), so that other operations can refer to (id)
328+ if schema .AllOf != nil {
329+ mergedSchema , err := MergeSchemas (schema , path )
330+ if err != nil {
331+ return Schema {}, fmt .Errorf ("error merging schemas: %w" , err )
332+ }
333+ mergedSchema .OAPISchema = schema
334+ return mergedSchema , nil
335+ }
336336
337337 // Schema type and format, eg. string / binary
338338 t := schema .Type
0 commit comments