OpenAPI document unsupported
A refusal to import an OpenAPI document into a project’s OpenAPI contract, because it uses something MockHub does not import, even though it may be valid.
| Field | Value |
|---|---|
type |
https://mockhub.dev/problems/openapi-unsupported |
| Status | 422 |
What it means
Section titled “What it means”MockHub imports one self-contained OpenAPI 3.0, 3.1 or 3.2 document. Every problem with this one names something outside that: an older or newer version, a reference to another file, or examples that would generate more response bodies than an import holds. Nothing was stored. A document that also has mistakes is refused as OpenAPI document invalid instead.
Status
Section titled “Status”Always 422.
Where it comes from
Section titled “Where it comes from”From previewing or applying an OpenAPI import.
| When | First problem in issues |
|---|---|
| A Swagger 2.0 document | Swagger 2.0 is not supported; convert the document to OpenAPI 3 |
| An OpenAPI version other than 3.0 to 3.2 | OpenAPI <version> is not supported; MockHub imports 3.0, 3.1 and 3.2 |
| A reference to another file | References outside the document are not supported (<reference>); bundle it into one file, for example with `mockhub openapi bundle` |
A schema reference naming no $id here |
<reference> names no schema $id in this document, and references outside the document are not supported; bundle it into one file, for example with `mockhub openapi bundle` |
| A method name longer than 64 characters | A method name longer than 64 characters is not supported |
| More than 10,000 response examples | The document has more than 10000 response examples to catalogue |
| Examples that come to more than 4 MiB | The examples in this document generate more than 4 MiB of response bodies; reference large examples fewer times |
The detail is MockHub cannot import this document: followed by the first problem and where it is, (at <JSON Pointer>)., and ends <n> more problems are listed in issues. when there are more.
issues lists each problem, at most 50, in the shape OpenAPI document invalid describes.
{ "type": "https://mockhub.dev/problems/openapi-unsupported", "title": "OpenAPI document not supported", "status": 422, "detail": "MockHub cannot import this document: Swagger 2.0 is not supported; convert the document to OpenAPI 3 (at /swagger).", "issues": [ { "message": "Swagger 2.0 is not supported; convert the document to OpenAPI 3", "pointer": "/swagger", "line": null, "column": null } ]}What to do
Section titled “What to do”- Convert a Swagger 2.0 document to OpenAPI 3 with a converter, and import the result.
- Bundle a document split across local files into one:
mockhub openapi importdoes it before it sends the document, andmockhub openapi bundlewrites the bundle for an upload (Import a specification split across files). A reference to a URL is never followed; download that file and refer to it by its path. - In OpenAPI 3.1 and 3.2, a schema may name another schema of the same document by its
$idor$anchor. If a schema reference is refused, check that it spells an$idthe document declares. - Give a large example to fewer responses, or shorten it: every response that references a shared example counts its full body.