API versioning
Before the public beta
Section titled “Before the public beta”- The API changes without a deprecation period. Endpoints and fields are
added, changed, renamed and removed as the product needs. There is no
notice period and no
DeprecationorSunsetheader. The dashboard and opdns’s own clients change with the API in the same release. - Every change is versioned and listed. The version of the specification changes with every change to it. Every response names the version that it uses. The changelog says what changed in each version, removals included.
If you write scripts against the API before the beta, do not depend on
anything that you cannot change quickly. When the version in
X-Opdns-Api-Version changes, read the changelog.
The contract of the API is its OpenAPI document,
/v1/openapi.yaml. The
reference is generated from this document. The
policy on this page is the policy in the info.description of that
document.
Writing a tolerant client
Section titled “Writing a tolerant client”Every route is under /v1. Most changes add something: new endpoints, new
optional request fields, new response fields, new enum values and new
columns in query results. So that these additions never break your client,
it must:
- Ignore response fields that it does not know.
- Treat an enum value that it does not know as “other”.
- Read query results by column name, never by position.
Which version a server speaks
Section titled “Which version a server speaks”The info.version of the document is the version of the contract. It
changes with every change to the document. The minor version changes for
any change to the contract: an addition, a change or a removal. The patch
version changes for changes to descriptions, summaries and examples only.
A few early additions shipped as patch versions (0.5.2, 0.6.1, 0.6.2).
That no longer happens. The current version is 0.57.0.
Every API response carries it:
X-Opdns-Api-Version: 0.57.0
It is also the api_version field of GET /v1/meta. The header always
names the document that the server was built with. A changed document
cannot ship without a new version. The release is refused if a contract
change ships as a patch version, or if a wording change ships as a minor
version.
The spec lint
Section titled “The spec lint”Every change to the document is checked against a strict set of OpenAPI rules:
- Every operation has an
operationIdand a description. - Every tag has a description.
- Every error response is an
application/problem+jsonProblemwith an example. - Every example is valid against its schema.
This is why the reference has a description for every operation and an example for every error.
API changelog
Section titled “API changelog”The API changelog lists every version of the document, newest first. Each entry has a summary of what a client needs to know. It also has the list of what changed in the document: operations, who can call them, fields, parameters, responses, enum values and problem codes. This list is generated from the history of the document, so nothing is left out. The changelog calls out removals and other changes that need a change in the client.