Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/codegen/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,17 @@ func GenerateBodyDefinitions(operationID string, bodyOrRef *openapi3.RequestBody
// type under #/components, we'll define a type for it, so
// that we have an easy to use type for marshaling.
if bodySchema.RefType == "" {
if contentType == "application/x-www-form-urlencoded" {
// Apply the appropriate structure tag if the request
// schema was defined under the operations' section.
for i := range bodySchema.Properties {
bodySchema.Properties[i].NeedsFormTag = true
}

// Regenerate the Golang struct adding the new form tag.
bodySchema.GoType = GenStructFromSchema(bodySchema)
}

td := TypeDefinition{
TypeName: bodyTypeName,
Schema: bodySchema,
Expand Down