Skip to content

Commit

Permalink
enhance: openapi3: enhance error reporting for `OperationMore.Reque…
Browse files Browse the repository at this point in the history
…stMediaTypes()`
  • Loading branch information
grokify committed Dec 16, 2022
1 parent 83a180c commit 3b3a46a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openapi3/operation_more.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ func (om *OperationMore) PathMethod() string {

// RequestMediaTypes returns a sorted slice of request media types.
func (om *OperationMore) RequestMediaTypes(spec *Spec) ([]string, error) {
if om.Operation == nil {
return []string{}, ErrOperationNotSet
}
op := om.Operation
if op == nil || op.RequestBody == nil {
if op.RequestBody == nil {
return []string{}, nil
}
if len(strings.TrimSpace(op.RequestBody.Ref)) == 0 {
Expand Down

0 comments on commit 3b3a46a

Please sign in to comment.