Skip to content

OpenAPI document invalid

A refusal to import an OpenAPI document into a project’s OpenAPI contract, because the document is not valid OpenAPI.

Field Value
type https://mockhub.dev/problems/openapi-invalid
Status 422

The document does not parse as JSON or YAML, or breaks a rule of its declared OpenAPI version, or a rule a schema cannot state: every reference names something in the document, every {parameter} in a path is declared, and no two operations share an operationId. Nothing was stored. When some problems are mistakes and others name something MockHub does not import, the type is this one: fix the mistakes first. A document whose every problem is of the second kind is OpenAPI document unsupported.

Always 422.

From previewing or applying an OpenAPI import.

When detail
The first problem is in the text This is not a valid OpenAPI document: <the first problem> (line <n>).
The first problem is in the content This is not a valid OpenAPI document: <the first problem> (at <JSON Pointer>).

When there is more than one problem, the detail ends <n> more problems are listed in issues.

issues lists each problem, at most 50. A problem in the text has a line and column; a problem in the content has a pointer, the JSON Pointer of where it is in the document. The others are null.

{
"type": "https://mockhub.dev/problems/openapi-invalid",
"title": "OpenAPI document is invalid",
"status": 422,
"detail": "This is not a valid OpenAPI document: #/components/schemas/Gone names nothing in this document (at /paths/~1a/get/responses/200/content/application~1json/schema/$ref).",
"issues": [
{
"message": "#/components/schemas/Gone names nothing in this document",
"pointer": "/paths/~1a/get/responses/200/content/application~1json/schema/$ref",
"line": null,
"column": null
}
]
}

Fix each problem in issues and import the document again. In a pointer, ~1 stands for / and ~0 for ~, so /paths/~1a/get is the get operation of the path /a.

Report a problem with this page