I am trying to import an openapi.json
into Insomnia to generate a collection, but Insomnia says it is not valid.
Is there a difference in rulesets between FastAPI/Swagger and Insomnia? If not, what causes this difference in compatibility?
Here's a trimmed down example of an automatically generated OpenAPI specification:
{
"openapi": "3.0.2",
"info": {
"title": "Test API",
"description": "description",
"contact": {
"name": "example",
"url": "https://example.com/contact-us/",
"email": "example@example.com"
},
"license": {
"name": "Copyright 2023 example"
},
"version": "0.0.1"
},
"paths": {
"/test_build": {
"get": {
"tags": [
"Test endpoints"
],
"summary": "Test",
"description": "",
"operationId": "test_build_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/api/search_something": {
"get": {
"tags": [
"Main endpoints"
],
"summary": "Search something",
"description": "",
"operationId": "search_something_get",
"parameters": [
{
"required": false,
"schema": {
"title": "something",
"maximum": 50.0,
"exclusiveMinimum": 0.0,
"type": "integer",
"default": 50
},
"name": "something",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {}
}
}
}
}
}
}
This is rejected by Insomnia for many reasons, but here are some examples of errors and warnings:
- oas3-api-servers OpenAPI "servers" must be present and non-empty array.
- operation-tag-defined Operation tags must be defined in global tags.
- oas3-schema "exclusiveMinimum" property type must be boolean.
- oas3-valid-schema-example schema is invalid: data must have property minimum when property exclusiveMinimum is present
Is there a way to make FastAPI's openapi.json file conform with Insomnia's ruleset?