Skip to content

Commit 3ecfa65

Browse files
authored
Handle empty application/json request bodies (oapi-codegen#1043)
1 parent 66a1c50 commit 3ecfa65

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pkg/codegen/operations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ func GenerateBodyDefinitions(operationID string, bodyOrRef *openapi3.RequestBody
661661
}
662662

663663
// If the body is a pre-defined type
664-
if IsGoTypeReference(content.Schema.Ref) {
664+
if content.Schema != nil && IsGoTypeReference(content.Schema.Ref) {
665665
// Convert the reference path to Go type
666666
refType, err := RefPathToGoType(content.Schema.Ref)
667667
if err != nil {

0 commit comments

Comments
 (0)