openapi-fuzzer
openapi-fuzzer copied to clipboard
Fails to parse openapi schema
I have the following dummy openapi schema adapted from a json schema generated by a real API. This schema cannot be parsed by openapi-fuzzer 0.1.3 (built from master commit 7da1471)
Schema:
{
"openapi": "3.0.2",
"info": {
"title": "Example",
"description": "Example",
"version": "0.0.1"
},
"paths": {
"/foo": {
"get": {
"operationId": "getFoo",
"summary": "Get list of foo",
"description": "Returns all the foo",
"produces": [
"application/json"
]
}
}
}
}
Error:
$ openapi-fuzzer -s ~/code/openapi.json -u http://localhost
Error: Failed to parse schema
Caused by:
paths: data did not match any variant of untagged enum ReferenceOr at line 8 column 12
Hi, I checked the schema with https://editor.swagger.io/ and according to it, the schema is not valid.

Thanks. I stripped out the responses field because I got the same error with or without it. It appears that the produces field was the actual cause of the parse failure. Unfortunately, the error message does not give any hints as to the reason for the parse failure.
This modified example does work:
{
"openapi": "3.0.2",
"info": {
"title": "Example",
"description": "Example",
"version": "0.0.1"
},
"paths": {
"/foo": {
"get": {
"operationId": "getFoo",
"summary": "Get list of foo",
"description": "Returns all the foo",
"responses": {
"200": {
"description": "foo",
"headers": {},
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
}
}
}
}