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 ef10a56 commit b7aa07e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions protoc-gen-http-swagger/generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,10 @@ func (g *OpenAPIGenerator) getResponseForMessage(d *openapi.Document, message *p

if len(bodySchema.Properties.AdditionalProperties) > 0 {
refSchema := &openapi.NamedSchemaOrReference{
Name: g.reflect.formatMessageName(message.Desc),
Name: g.reflect.formatMessageName(message.Desc) + "Body",
Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: bodySchema}},
}
ref := "#/components/schemas/" + g.reflect.formatMessageName(message.Desc)
ref := "#/components/schemas/" + g.reflect.formatMessageName(message.Desc) + "Body"
g.addSchemaToDocument(d, refSchema)
additionalProperties = append(additionalProperties, &openapi.NamedMediaType{
Name: "application/json",
Expand All @@ -628,10 +628,10 @@ func (g *OpenAPIGenerator) getResponseForMessage(d *openapi.Document, message *p

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

0 comments on commit b7aa07e

Please sign in to comment.