Skip to content

Commit 3b3a46a

Browse files
committed
enhance: openapi3: enhance error reporting for OperationMore.RequestMediaTypes()
1 parent 83a180c commit 3b3a46a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

openapi3/operation_more.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ func (om *OperationMore) PathMethod() string {
6969

7070
// RequestMediaTypes returns a sorted slice of request media types.
7171
func (om *OperationMore) RequestMediaTypes(spec *Spec) ([]string, error) {
72+
if om.Operation == nil {
73+
return []string{}, ErrOperationNotSet
74+
}
7275
op := om.Operation
73-
if op == nil || op.RequestBody == nil {
76+
if op.RequestBody == nil {
7477
return []string{}, nil
7578
}
7679
if len(strings.TrimSpace(op.RequestBody.Ref)) == 0 {

0 commit comments

Comments
 (0)