Skip to content

Commit aa0c094

Browse files
committed
skip operations with a request body with no supported MIME type
Signed-off-by: Grant Linville <[email protected]>
1 parent fbf688e commit aa0c094

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/loader/openapi.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func getOpenAPITools(t *openapi3.T, defaultHost string) ([]types.Tool, error) {
5151
}
5252
}
5353

54+
operations:
5455
for method, operation := range pathObj.Operations() {
5556
// Handle operation-level server override, if one exists
5657
operationServer := pathServer
@@ -147,6 +148,11 @@ func getOpenAPITools(t *openapi3.T, defaultHost string) ([]types.Tool, error) {
147148
tool.Parameters.Arguments.Properties["requestBodyContent"] = &openapi3.SchemaRef{Value: arg}
148149
break
149150
}
151+
152+
if bodyMIME == "" {
153+
// No supported MIME types found, so just skip this operation and move on.
154+
continue operations
155+
}
150156
}
151157

152158
// OpenAI will get upset if we have an object schema with no properties,

0 commit comments

Comments
 (0)