Skip to content

Commit

Permalink
fix: generate different response schema name
Browse files Browse the repository at this point in the history
  • Loading branch information
EZ4Jam1n committed Aug 8, 2024
1 parent 8c2436d commit 97ee259
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions thrift-gen-http-swagger/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,10 @@ func (g *OpenAPIGenerator) getResponseForStruct(d *openapi.Document, desc *thrif

if len(bodySchema.Properties.AdditionalProperties) > 0 {
refSchema := &openapi.NamedSchemaOrReference{
Name: desc.GetName(),
Name: desc.GetName() + "Body",
Value: &openapi.SchemaOrReference{Schema: bodySchema},
}
ref := "#/components/schemas/" + desc.GetName()
ref := "#/components/schemas/" + desc.GetName() + "Body"
g.addSchemaToDocument(d, refSchema)
additionalProperties = append(additionalProperties, &openapi.NamedMediaType{
Name: "application/json",
Expand All @@ -588,10 +588,10 @@ func (g *OpenAPIGenerator) getResponseForStruct(d *openapi.Document, desc *thrif

if len(rawBodySchema.Properties.AdditionalProperties) > 0 {
refSchema := &openapi.NamedSchemaOrReference{
Name: desc.GetName(),
Name: desc.GetName() + "RawBody",
Value: &openapi.SchemaOrReference{Schema: rawBodySchema},
}
ref := "#/components/schemas/" + desc.GetName()
ref := "#/components/schemas/" + desc.GetName() + "RawBody"
g.addSchemaToDocument(d, refSchema)
additionalProperties = append(additionalProperties, &openapi.NamedMediaType{
Name: "application/octet-stream",
Expand Down

0 comments on commit 97ee259

Please sign in to comment.