OpenAPI reference by example
One keyword or pattern per page: what it means, an example that validates, and what tools do with it. Each page comes with the output of the tools that read the example, and says when it was last checked.
- $ref with a description next to it: OpenAPI 3.0 against 3.1
In OpenAPI 3.0 anything written next to a $ref is ignored, and linters report it. OpenAPI 3.1 allows keywords next to $ref in schemas, and summary and description next to other references. What changes, with the lint result for both versions.
- additionalProperties in OpenAPI: closed objects and maps
additionalProperties decides what happens to properties a schema does not name. false closes the object, a schema turns it into a map. Examples that validate, with a mock server's answers, and the allOf trap.
- allOf and parameters in OpenAPI: what works and what to write instead
allOf combines schemas, not parameters. It is valid inside a parameter's schema, and invalid as a way to merge a list of parameters. How to reuse a set of parameters, with the lint error the wrong form produces.
- enum in OpenAPI: allowed values, null, and adding one later
enum lists the values a field may take. How to write it, how to allow null, how to describe each value, and why adding a value to a response enum can break clients. With a mock server's answers.
- Error responses in OpenAPI: describing 4xx and 5xx with problem details
An operation that documents only its 200 leaves clients guessing what failure looks like. How to describe error responses once and reuse them, with the application/problem+json format of RFC 9457, a mock server's answers and the effect on a readiness score.
- example vs examples in OpenAPI: where each goes and which one tools use
example is one value, examples is a set. Their form depends on the place: a named map on a media type or parameter, a plain list in a 3.1 schema. Where each is allowed, which is deprecated, and which one a mock server answers with.
- nullable in OpenAPI 3.0 and 3.1: how to say a value may be null
OpenAPI 3.0 uses nullable: true. OpenAPI 3.1 removed it: write type: [string, "null"]. What to write in each version, what a linter and a breaking-change check say, and how to migrate.
- oneOf vs anyOf in OpenAPI: the one payload that tells them apart
oneOf needs exactly one schema to match, anyOf at least one. The difference only shows on a payload that fits two schemas: oneOf refuses it, anyOf accepts it. The same request sent to both, with a mock server's answers.
- operationId in OpenAPI: what it is for and how to name it
operationId is an optional, unique name for an operation. Code generators turn it into method names, documentation into links, tools into selectors. Naming rules that keep generated names predictable, with the linter's findings for the usual mistakes.
- readOnly and writeOnly in OpenAPI: one schema for requests and responses
readOnly marks a property the server sends and a client should not, writeOnly the reverse. They let one schema serve both directions. What the specification requires, and what a mock server actually does with each.
- The OpenAPI discriminator: what it does and what it does not
discriminator names the property that tells which oneOf schema a payload is. It helps code generators and documentation; it does not validate anything by itself. An example that validates, with a mock server's answers.
Try it with your own API
Create a free workspace, add your API files, and publish their documentation and a mock server from the same repository.
Free for individuals. No credit card.
$ npm install -g @apigit/cli$ apigit auth login$ apigit doc publish