Skip to content

Commit

Permalink
openapi3gen: Fix issue with separate component generated for time.Tim…
Browse files Browse the repository at this point in the history
…e fields, when ExportComponentSchemas opt provided
  • Loading branch information
d1vbyz3r0 committed Feb 9, 2025
1 parent 72fb819 commit 1b981d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions openapi3gen/openapi3gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ func (g *Generator) generateWithoutSaving(parents []*theTypeInfo, t reflect.Type

// For structs we add the schemas to the component schemas
if len(parents) > 1 || g.opts.exportComponentSchemas.ExportTopLevelSchema {
// If struct is a time.Time instance, separate component shouldn't be generated
if t == timeType {
return openapi3.NewSchemaRef(t.Name(), schema), nil
}

typeName := g.generateTypeName(t)

g.componentSchemaRefs[typeName] = struct{}{}
Expand Down

0 comments on commit 1b981d7

Please sign in to comment.