Versioning
A CommonGrants API can serve more than one protocol version. A client asks for the version it was built for with the CommonGrants version request header, CG-Version, and every response produced after a version is selected reports the version it was served in with the CommonGrants served-version response header, CG-Version-Served. A server lists the versions it serves at a discovery route, and announces retirement with the standard Deprecation, Sunset, and Link headers.
This page summarizes the model for clients and implementers. The normative rules are in the Versions section of the specification, and the rationale and the options considered are in ADR 0032. Version negotiation was added in protocol version v0.6.0.
Finding the supported versions
Section titled “Finding the supported versions”Call GET /common-grants/versions, relative to the API’s base URL. You don’t need to send CG-Version, and the route never returns a version error. Here’s a server whose baseline is 0.4.0, which also serves form detail in 0.5.0 and serves its form list only in 0.5.0:
{ "status": 200, "message": "Success", "data": { "versions": ["0.4.0"], "defaultVersion": "0.4.0", "operations": { "GET /common-grants/forms": { "versions": ["0.5.0"], "defaultVersion": "0.5.0" }, "GET /common-grants/forms/{formId}": { "versions": ["0.4.0", "0.5.0"], "defaultVersion": "0.4.0" } } }}versions and defaultVersion are the baseline: every route without an entry under operations serves them. A route listed under operations uses its own entry instead. A route is identified by its HTTP method and its path as published in the protocol, and path parameter names are ignored when matching, so {id} and {formId} in the same position identify the same route.
Version values are strings in the 0.5.0 format, not a closed list, so accept versions published after your client was built. Ignore fields you don’t recognize: fields are only ever added to this response.
If discovery returns 404, treat the server as serving one version it doesn’t advertise. If its responses also lack CG-Version-Served, that version is unknown and every response is unconfirmed.
The route is optional, but a server that serves more than one version must implement it. It should be readable without authentication.
Asking for a version
Section titled “Asking for a version”Send the full version in the CG-Version request header:
GET /common-grants/opportunities/123 HTTP/1.1CG-Version: 0.5.0
HTTP/1.1 200 OKCG-Version-Served: 0.5.1Vary: CG-VersionSend one value per request. The value is three dot-separated numbers with no leading zeros. A v prefix, a short form such as 0.5, ranges, and aliases are malformed. The header only means something on routes under /common-grants/, and a version in the path or query string is never read as a selector.
Servers match on major and minor version, so a request for 0.5.0 is served by a server hosting 0.5.1. A server never substitutes a different major or minor version, even if it serves only one.
The value is always a CommonGrants protocol version, never a plugin’s package version (ADR 0022).
If you don’t ask
Section titled “If you don’t ask”You’re served in the server’s default: the baseline default, or the route’s own default when the route has an entry in discovery. The default doesn’t change when the server adds versions. It changes only after an announced default change (see Learning that the default is changing). If you need a fixed contract, send a version. Before 1.0, a new default may not be compatible with the old one.
Confirming the version you got
Section titled “Confirming the version you got”Read CG-Version-Served. It reports the full version served, so it can differ from your request in the patch number only.
- A successful response without it is unconfirmed: the server may predate version negotiation, or something in between dropped your header. Don’t read it as the version you asked for.
- A served version whose major or minor number differs from the one you asked for wasn’t served as requested. Don’t treat it as your version.
Browser clients on another origin can read CG-Version-Served, because cross-origin servers must expose it.
Version errors
Section titled “Version errors”| Case | code |
Status |
|---|---|---|
Malformed version, such as banana or 0.5 |
version.malformed |
400 |
| More than one version value, as two header lines or one comma-separated line, even the same value twice | version.conflict |
400 |
| Version this server doesn’t serve | version.unsupported, scope deployment |
406 |
| Version this route doesn’t serve | version.unsupported, scope operation |
406 |
| Version retired from this server or this route | version.retired, scope deployment or operation |
406 |
Details are entries in the standard error response envelope. supported and defaultVersion always describe the route you called, so retry with a listed version:
{ "status": 406, "message": "The requested CommonGrants version is not available for this route", "errors": [ { "field": "CG-Version", "code": "version.unsupported", "message": "Version 0.4.0 is not served by GET /common-grants/forms. Supported versions: 0.5.0", "requested": "0.4.0", "supported": ["0.5.0"], "scope": "operation", "defaultVersion": "0.5.0", "discovery": "https://grants.example.org/common-grants/versions" } ]}version.retired also carries sunset, in RFC 3339 format. version.conflict omits requested, and its message names the values received. code values are stable; branch on them. A version problem never returns 404 or 410, so a 404 still means a missing route or record. Version errors don’t carry CG-Version-Served, because no version was selected.
A request body is validated against the version it’s served in, so a 0.4.0 search that uses a filter that exists only in 0.5.0 gets an ordinary 400 validation error, with CG-Version-Served: 0.4.0. A rejected write changes nothing, and the server never retries it under another version.
Learning that a version is retiring
Section titled “Learning that a version is retiring”Responses served in a retiring version carry Deprecation, then Sunset once a date is set, with Link headers to migration documentation and to discovery. These headers always describe the version you were served, and discovery lists the version under deprecated with its dates:
GET /common-grants/opportunities/123 HTTP/1.1CG-Version: 0.3.0
HTTP/1.1 200 OKCG-Version-Served: 0.3.0Vary: CG-VersionDeprecation: @1796083200Sunset: Tue, 01 Jun 2027 00:00:00 GMTLink: <https://grants.example.org/docs/migrate>; rel="deprecation"Link: <https://grants.example.org/docs/migrate>; rel="sunset"Link: <https://grants.example.org/common-grants/versions>; rel="version-history"The three dates use three formats: Deprecation uses the @<unix-timestamp> form from RFC 9745, Sunset uses an HTTP-date as in RFC 8594, and discovery uses RFC 3339. Discovery keys deprecated by the exact versions it lists, so look up the version you requested by its major and minor alone: a request for 0.3.0 served as 0.3.1 finds its entry under 0.3.1.
After the sunset date, requests for any patch of that major and minor version get 406 version.retired, with the sunset date and the supported versions, for a period the server chooses. After that, the server may answer version.unsupported instead, so handle both the same way: retry with a version from supported. If the retired version was your default, the default has already moved to the next newer version.
A single route retires a version the same way as the whole server. Experimental routes may drop a version without notice.
Learning that the default is changing
Section titled “Learning that the default is changing”If you send no version, responses from routes whose default is changing carry a Link header with rel="successor-version", and discovery shows upcomingDefault with the date the change takes effect. These responses carry no Deprecation or Sunset unless the default version is itself retiring. If you send a version, nothing changes for you.
GET /common-grants/opportunities/123 HTTP/1.1
HTTP/1.1 200 OKCG-Version-Served: 0.4.0Vary: CG-VersionLink: <https://grants.example.org/docs/versions/0.5.0>; rel="successor-version"Link: <https://grants.example.org/common-grants/versions>; rel="version-history"Here’s the data payload of discovery for a server moving its default to 0.5.0 and retiring 0.3.0:
{ "versions": ["0.3.0", "0.4.0", "0.5.0"], "defaultVersion": "0.4.0", "upcomingDefault": { "version": "0.5.0", "date": "2027-03-01T00:00:00Z" }, "deprecated": { "0.3.0": { "deprecation": "2026-12-01T00:00:00Z", "sunset": "2027-06-01T00:00:00Z" } }}Implementing version negotiation
Section titled “Implementing version negotiation”A server that serves one version needs very little: it reads CG-Version on routes under /common-grants/, rejects other major and minor versions, and reports what it serves. A server that adopts negotiation sets its default to the version it already serves, so its existing clients see no change. The specification’s Versions section is the full set of rules. In summary:
- Resolve the version. Match the route, then resolve the version, then validate the request body against that version’s schemas, all before any side effect. Check for more than one value before checking the format. Never read the version from the path, the query string,
Accept, or a media type. - Send the version headers. Send
CG-Version-Servedon every response produced after a version is selected, whatever version you serve, including errors such as a missing record. Responses to 401 and 403 may omit it, and version errors must not carry it. SendVary: CG-Versionon cacheable responses. Cross-origin servers allowCG-Versionand exposeCG-Version-Served,Deprecation,Sunset, andLink. - Publish discovery if you serve more than one version. List the baseline, and add an
operationsentry only for routes that differ from it. A version in the baseline is a compliance claim: every route that version requires serves it. - Retire a version by sending
Deprecation,Sunset, and theirLinkheaders on responses served in it, listing it underdeprecatedin discovery, and answeringversion.retiredafter the sunset. - Change a default by sending the
successor-versionandversion-historylinks on responses served by default, and showingupcomingDefaultin discovery. Don’t sendDeprecationorSunsetfor a default change. A retiring default moves forward to the next newer version no later than the sunset, so you can’t retire a default without a newer version to move to.
We recommend that servers move all their routes to a new version at the same time. A server can instead serve different versions on different routes and advertise those routes in discovery.
Schemas
Section titled “Schemas”The SDKs don’t declare the version negotiation schemas yet, so the formats below show the TypeSpec source only.
Discovery schemas
Section titled “Discovery schemas”VersionDiscovery
Section titled “VersionDiscovery”The data payload of the GET /versions response.
| Property | Type | Required | Description |
|---|---|---|---|
| versions | array | Yes | The versions every route without an `operations` entry serves |
| defaultVersion | protocolVersion | Yes | The version every route without an `operations` entry serves when a request doesn't name one, one of `versions` |
| upcomingDefault | UpcomingDefault | No | A scheduled change to the API-wide default version, if any. Its `version` is one of `versions` |
| deprecated | record<VersionRetirement> | No | Deprecated versions, keyed by version, with their retirement schedule Each key is a version from `versions`, written exactly as it appears there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses `0.3.1` as the key here. To check whether the version you request is deprecated, compare only the major and minor. A client requesting `0.3.0` is served `0.3.1`, so its entry is under `0.3.1`. |
| operations | record<OperationVersions> | No | Routes whose versions differ from the API-wide values Each key is the HTTP method and the route's published path, separated by a space, such as `GET /common-grants/forms/{formId}`. Path parameter names are ignored when matching a key to a route. Omitted when every route serves the API-wide values. |
A JSON example of this model.
{ "versions": [ "0.3.0", "0.4.0", "0.5.0" ], "defaultVersion": "0.4.0", "upcomingDefault": { "version": "0.5.0", "date": "2027-03-01T00:00:00Z" }, "deprecated": { "0.3.0": { "deprecation": "2026-12-01T00:00:00Z", "sunset": "2027-06-01T00:00:00Z" } }}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionDiscovery.yamltype: objectproperties: versions: type: array items: $ref: protocolVersion.yaml minItems: 1 description: The versions every route without an `operations` entry serves defaultVersion: $ref: protocolVersion.yaml description: The version every route without an `operations` entry serves when a request doesn't name one, one of `versions` upcomingDefault: $ref: UpcomingDefault.yaml description: A scheduled change to the API-wide default version, if any. Its `version` is one of `versions` deprecated: $ref: "#/$defs/RecordVersionRetirement" description: |- Deprecated versions, keyed by version, with their retirement schedule
Each key is a version from `versions`, written exactly as it appears there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses `0.3.1` as the key here.
To check whether the version you request is deprecated, compare only the major and minor. A client requesting `0.3.0` is served `0.3.1`, so its entry is under `0.3.1`. propertyNames: $ref: protocolVersion.yaml operations: $ref: "#/$defs/RecordOperationVersions" description: |- Routes whose versions differ from the API-wide values
Each key is the HTTP method and the route's published path, separated by a space, such as `GET /common-grants/forms/{formId}`. Path parameter names are ignored when matching a key to a route. Omitted when every route serves the API-wide values.required: - versions - defaultVersionunevaluatedProperties: {}examples: - versions: - 0.3.0 - 0.4.0 - 0.5.0 defaultVersion: 0.4.0 upcomingDefault: version: 0.5.0 date: 2027-03-01T00:00:00Z deprecated: 0.3.0: deprecation: 2026-12-01T00:00:00Z sunset: 2027-06-01T00:00:00Z - versions: - 0.4.0 defaultVersion: 0.4.0 operations: GET /common-grants/forms: versions: - 0.5.0 defaultVersion: 0.5.0 GET /common-grants/forms/{formId}: versions: - 0.4.0 - 0.5.0 defaultVersion: 0.4.0description: |- The protocol versions an API serves
The top-level fields describe every route that has no entry in `operations`. Routes that differ from them have an entry in `operations`. New fields are only ever added to this model; clients ignore fields they don't recognize.$defs: RecordVersionRetirement: type: object properties: {} unevaluatedProperties: $ref: VersionRetirement.yaml RecordOperationVersions: type: object properties: {} unevaluatedProperties: $ref: OperationVersions.yamlThe TypeSpec code for this model.
/** The protocol versions an API serves * * The top-level fields describe every route that has no entry in * `operations`. Routes that differ from them have an entry in `operations`. * New fields are only ever added to this model; clients ignore fields they * don't recognize. */@example( Examples.VersionDiscovery.routeEntries, #{ title: "Baseline with route entries" })@example( Examples.VersionDiscovery.lifecycle, #{ title: "Upcoming default and deprecated version" })@Versioning.added(CommonGrants.Versions.v0_6)model VersionDiscovery { /** The versions every route without an `operations` entry serves */ @minItems(1) versions: Types.protocolVersion[];
/** The version every route without an `operations` entry serves when a request doesn't name one, one of `versions` */ defaultVersion: Types.protocolVersion;
/** A scheduled change to the API-wide default version, if any. Its `version` is one of `versions` */ upcomingDefault?: UpcomingDefault;
/** Deprecated versions, keyed by version, with their retirement schedule * * Each key is a version from `versions`, written exactly as it appears * there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses * `0.3.1` as the key here. * * To check whether the version you request is deprecated, compare only * the major and minor. A client requesting `0.3.0` is served `0.3.1`, so * its entry is under `0.3.1`. */ @TypeSpec.JsonSchema.extension( "propertyNames", #{ $ref: "protocolVersion.yaml" } ) deprecated?: Record<VersionRetirement>;
/** Routes whose versions differ from the API-wide values * * Each key is the HTTP method and the route's published path, separated * by a space, such as `GET /common-grants/forms/{formId}`. Path parameter * names are ignored when matching a key to a route. Omitted when every * route serves the API-wide values. */ operations?: Record<OperationVersions>;
...Record<unknown>;}OperationVersions
Section titled “OperationVersions”The versions a single route serves, when they differ from the baseline.
| Property | Type | Required | Description |
|---|---|---|---|
| versions | array | Yes | The versions this route serves |
| defaultVersion | protocolVersion | Yes | The version this route serves when a request doesn't name one, one of `versions` |
| upcomingDefault | UpcomingDefault | No | A scheduled change to this route's default version, if any. Its `version` is one of `versions` |
| deprecated | record<VersionRetirement> | No | Deprecated versions of this route, keyed by version, with their retirement schedule Each key is a version from `versions`, written exactly as it appears there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses `0.3.1` as the key here. To check whether the version you request is deprecated, compare only the major and minor. A client requesting `0.3.0` is served `0.3.1`, so its entry is under `0.3.1`. |
A JSON example of this model.
{ "versions": [ "0.6.0" ], "defaultVersion": "0.6.0", "upcomingDefault": { "version": "0.6.0", "date": "2019-08-24T14:15:22Z" }, "deprecated": {}}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: OperationVersions.yamltype: objectproperties: versions: type: array items: $ref: protocolVersion.yaml minItems: 1 description: The versions this route serves defaultVersion: $ref: protocolVersion.yaml description: The version this route serves when a request doesn't name one, one of `versions` upcomingDefault: $ref: UpcomingDefault.yaml description: A scheduled change to this route's default version, if any. Its `version` is one of `versions` deprecated: $ref: "#/$defs/RecordVersionRetirement" description: |- Deprecated versions of this route, keyed by version, with their retirement schedule
Each key is a version from `versions`, written exactly as it appears there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses `0.3.1` as the key here.
To check whether the version you request is deprecated, compare only the major and minor. A client requesting `0.3.0` is served `0.3.1`, so its entry is under `0.3.1`. propertyNames: $ref: protocolVersion.yamlrequired: - versions - defaultVersionunevaluatedProperties: {}description: The versions a single route serves, when they differ from the API-wide values$defs: RecordVersionRetirement: type: object properties: {} unevaluatedProperties: $ref: VersionRetirement.yamlThe TypeSpec code for this model.
/** The versions a single route serves, when they differ from the API-wide values */@Versioning.added(CommonGrants.Versions.v0_6)model OperationVersions { /** The versions this route serves */ @minItems(1) versions: Types.protocolVersion[];
/** The version this route serves when a request doesn't name one, one of `versions` */ defaultVersion: Types.protocolVersion;
/** A scheduled change to this route's default version, if any. Its `version` is one of `versions` */ upcomingDefault?: UpcomingDefault;
/** Deprecated versions of this route, keyed by version, with their retirement schedule * * Each key is a version from `versions`, written exactly as it appears * there. A server hosting `0.3.1` lists `0.3.1` in `versions` and uses * `0.3.1` as the key here. * * To check whether the version you request is deprecated, compare only * the major and minor. A client requesting `0.3.0` is served `0.3.1`, so * its entry is under `0.3.1`. */ @TypeSpec.JsonSchema.extension( "propertyNames", #{ $ref: "protocolVersion.yaml" } ) deprecated?: Record<VersionRetirement>;
...Record<unknown>;}UpcomingDefault
Section titled “UpcomingDefault”A scheduled change to a default version.
| Property | Type | Required | Description |
|---|---|---|---|
| version | protocolVersion | Yes | The version that will become the default |
| date | utcDateTime | Yes | When the new default takes effect |
A JSON example of this model.
{ "version": "0.6.0", "date": "2019-08-24T14:15:22Z"}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: UpcomingDefault.yamltype: objectproperties: version: $ref: protocolVersion.yaml description: The version that will become the default date: type: string format: date-time description: When the new default takes effectrequired: - version - dateunevaluatedProperties: {}description: A scheduled change to the version a server serves by defaultThe TypeSpec code for this model.
/** A scheduled change to the version a server serves by default */@Versioning.added(CommonGrants.Versions.v0_6)model UpcomingDefault { /** The version that will become the default */ version: Types.protocolVersion;
/** When the new default takes effect */ date: utcDateTime;
// Discovery sits outside version selection, so new fields must be tolerated rather than versioned ...Record<unknown>;}VersionRetirement
Section titled “VersionRetirement”The retirement schedule for a deprecated version.
| Property | Type | Required | Description |
|---|---|---|---|
| deprecation | utcDateTime | Yes | When the version was or will be deprecated |
| sunset | utcDateTime | No | When the server will stop serving the version, if scheduled |
A JSON example of this model.
{ "deprecation": "2019-08-24T14:15:22Z", "sunset": "2019-08-24T14:15:22Z"}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionRetirement.yamltype: objectproperties: deprecation: type: string format: date-time description: When the version was or will be deprecated sunset: type: string format: date-time description: When the server will stop serving the version, if scheduledrequired: - deprecationunevaluatedProperties: {}description: The retirement schedule for a deprecated versionThe TypeSpec code for this model.
/** The retirement schedule for a deprecated version */@Versioning.added(CommonGrants.Versions.v0_6)model VersionRetirement { /** When the version was or will be deprecated */ deprecation: utcDateTime;
/** When the server will stop serving the version, if scheduled */ sunset?: utcDateTime;
...Record<unknown>;}Version error schemas
Section titled “Version error schemas”VersionMalformedError
Section titled “VersionMalformedError”A 400 response to a CG-Version value that isn’t a full MAJOR.MINOR.PATCH version.
| Property | Type | Required | Description |
|---|---|---|---|
| status | number | Yes | |
| message | string | Yes | Human-readable error message |
| errors | array<VersionMalformedDetail> | Yes |
A JSON example of this model.
{ "status": 400, "message": "The CG-Version header is not a valid CommonGrants version", "errors": [ { "field": "CG-Version", "code": "version.malformed", "message": "Version 0.5 is not a full MAJOR.MINOR.PATCH version", "requested": "0.5", "supported": [ "0.5.0", "0.6.0" ], "defaultVersion": "0.5.0", "discovery": "https://grants.example.org/common-grants/versions" } ]}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionMalformedError.yamltype: objectproperties: status: type: number const: 400 examples: - 400 errors: type: array items: $ref: VersionMalformedDetail.yaml minItems: 1required: - status - errorsallOf: - $ref: Error.yamlunevaluatedProperties: not: {}examples: - status: 400 message: The CG-Version header is not a valid CommonGrants version errors: - field: CG-Version code: version.malformed message: Version 0.5 is not a full MAJOR.MINOR.PATCH version requested: "0.5" supported: - 0.5.0 - 0.6.0 defaultVersion: 0.5.0 discovery: https://grants.example.org/common-grants/versionsdescription: A `CG-Version` header that isn't a full `MAJOR.MINOR.PATCH` versionThe TypeSpec code for this model.
@example(#{ status: 400, message: "The CG-Version header is not a valid CommonGrants version", errors: #[ #{ field: "CG-Version", code: "version.malformed", message: "Version 0.5 is not a full MAJOR.MINOR.PATCH version", requested: "0.5", supported: #["0.5.0", "0.6.0"], defaultVersion: "0.5.0", discovery: "https://grants.example.org/common-grants/versions", } ],})@error@doc("A `CG-Version` header that isn't a full `MAJOR.MINOR.PATCH` version")@Versioning.added(CommonGrants.Versions.v0_6)model VersionMalformedError extends Error { @example(400) status: 400;
@minItems(1) errors: VersionMalformedDetail[];}VersionConflictError
Section titled “VersionConflictError”A 400 response to a request that sent more than one CG-Version value.
| Property | Type | Required | Description |
|---|---|---|---|
| status | number | Yes | |
| message | string | Yes | Human-readable error message |
| errors | array<VersionConflictDetail> | Yes |
A JSON example of this model.
{ "status": 400, "message": "The request sent more than one CG-Version value", "errors": [ { "field": "CG-Version", "code": "version.conflict", "message": "Received CG-Version values 0.5.0 and 0.6.0", "supported": [ "0.5.0", "0.6.0" ], "defaultVersion": "0.5.0", "discovery": "https://grants.example.org/common-grants/versions" } ]}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionConflictError.yamltype: objectproperties: status: type: number const: 400 examples: - 400 errors: type: array items: $ref: VersionConflictDetail.yaml minItems: 1required: - status - errorsallOf: - $ref: Error.yamlunevaluatedProperties: not: {}examples: - status: 400 message: The request sent more than one CG-Version value errors: - field: CG-Version code: version.conflict message: Received CG-Version values 0.5.0 and 0.6.0 supported: - 0.5.0 - 0.6.0 defaultVersion: 0.5.0 discovery: https://grants.example.org/common-grants/versionsdescription: A request that sent more than one `CG-Version` value, even the same value twiceThe TypeSpec code for this model.
@example(#{ status: 400, message: "The request sent more than one CG-Version value", errors: #[ #{ field: "CG-Version", code: "version.conflict", message: "Received CG-Version values 0.5.0 and 0.6.0", supported: #["0.5.0", "0.6.0"], defaultVersion: "0.5.0", discovery: "https://grants.example.org/common-grants/versions", } ],})@error@doc("A request that sent more than one `CG-Version` value, even the same value twice")@Versioning.added(CommonGrants.Versions.v0_6)model VersionConflictError extends Error { @example(400) status: 400;
@minItems(1) errors: VersionConflictDetail[];}VersionUnsupportedError
Section titled “VersionUnsupportedError”A 406 response to a version this server or route doesn’t serve.
| Property | Type | Required | Description |
|---|---|---|---|
| status | number | Yes | |
| message | string | Yes | Human-readable error message |
| errors | array<VersionUnsupportedDetail> | Yes |
A JSON example of this model.
{ "status": 406, "message": "The requested CommonGrants version is not available for this route", "errors": [ { "field": "CG-Version", "code": "version.unsupported", "message": "Version 0.4.0 is not served by GET /common-grants/forms. Supported versions: 0.5.0, 0.6.0", "requested": "0.4.0", "supported": [ "0.5.0", "0.6.0" ], "scope": "operation", "defaultVersion": "0.5.0", "discovery": "https://grants.example.org/common-grants/versions" } ]}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionUnsupportedError.yamltype: objectproperties: status: type: number const: 406 examples: - 406 errors: type: array items: $ref: VersionUnsupportedDetail.yaml minItems: 1required: - status - errorsallOf: - $ref: Error.yamlunevaluatedProperties: not: {}examples: - status: 406 message: The requested CommonGrants version is not available for this route errors: - field: CG-Version code: version.unsupported message: "Version 0.4.0 is not served by GET /common-grants/forms. Supported versions: 0.5.0, 0.6.0" requested: 0.4.0 supported: - 0.5.0 - 0.6.0 scope: operation defaultVersion: 0.5.0 discovery: https://grants.example.org/common-grants/versionsdescription: A requested version that this server or route doesn't serveThe TypeSpec code for this model.
@example(#{ status: 406, message: "The requested CommonGrants version is not available for this route", errors: #[ #{ field: "CG-Version", code: "version.unsupported", message: "Version 0.4.0 is not served by GET /common-grants/forms. Supported versions: 0.5.0, 0.6.0", requested: "0.4.0", supported: #["0.5.0", "0.6.0"], scope: VersionErrorScope.operation, defaultVersion: "0.5.0", discovery: "https://grants.example.org/common-grants/versions", } ],})@error@doc("A requested version that this server or route doesn't serve")@Versioning.added(CommonGrants.Versions.v0_6)model VersionUnsupportedError extends Error { @example(406) status: 406;
@minItems(1) errors: VersionUnsupportedDetail[];}VersionRetiredError
Section titled “VersionRetiredError”A 406 response to a version that was retired from this server or route.
| Property | Type | Required | Description |
|---|---|---|---|
| status | number | Yes | |
| message | string | Yes | Human-readable error message |
| errors | array<VersionRetiredDetail> | Yes |
A JSON example of this model.
{ "status": 406, "message": "The requested CommonGrants version has been retired", "errors": [ { "field": "CG-Version", "code": "version.retired", "message": "Version 0.3.0 was retired on 2027-06-01. Supported versions: 0.4.0, 0.5.0, 0.6.0", "requested": "0.3.0", "supported": [ "0.4.0", "0.5.0", "0.6.0" ], "scope": "deployment", "defaultVersion": "0.4.0", "discovery": "https://grants.example.org/common-grants/versions", "sunset": "2027-06-01T00:00:00Z" } ]}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionRetiredError.yamltype: objectproperties: status: type: number const: 406 examples: - 406 errors: type: array items: $ref: VersionRetiredDetail.yaml minItems: 1required: - status - errorsallOf: - $ref: Error.yamlunevaluatedProperties: not: {}examples: - status: 406 message: The requested CommonGrants version has been retired errors: - field: CG-Version code: version.retired message: "Version 0.3.0 was retired on 2027-06-01. Supported versions: 0.4.0, 0.5.0, 0.6.0" requested: 0.3.0 supported: - 0.4.0 - 0.5.0 - 0.6.0 scope: deployment defaultVersion: 0.4.0 discovery: https://grants.example.org/common-grants/versions sunset: 2027-06-01T00:00:00Zdescription: A requested version that was retired from this server or routeThe TypeSpec code for this model.
@example(#{ status: 406, message: "The requested CommonGrants version has been retired", errors: #[ #{ field: "CG-Version", code: "version.retired", message: "Version 0.3.0 was retired on 2027-06-01. Supported versions: 0.4.0, 0.5.0, 0.6.0", requested: "0.3.0", supported: #["0.4.0", "0.5.0", "0.6.0"], scope: VersionErrorScope.deployment, defaultVersion: "0.4.0", discovery: "https://grants.example.org/common-grants/versions", sunset: utcDateTime.fromISO("2027-06-01T00:00:00Z"), } ],})@error@doc("A requested version that was retired from this server or route")@Versioning.added(CommonGrants.Versions.v0_6)model VersionRetiredError extends Error { @example(406) status: 406;
@minItems(1) errors: VersionRetiredDetail[];}VersionErrorDetail
Section titled “VersionErrorDetail”The fields every version error entry carries, describing the route that was called.
| Property | Type | Required | Description |
|---|---|---|---|
| field | string | Yes | The request header the error is about |
| message | string | Yes | Human-readable description of the problem |
| supported | array | Yes | The versions this route serves |
| defaultVersion | protocolVersion | Yes | The version this route serves when a request doesn't name one |
| discovery | url | No | The server's version discovery URL Omitted by servers that serve one version and don't publish discovery. |
A JSON example of this model.
{ "field": "CG-Version", "message": "string", "supported": [ "0.6.0" ], "defaultVersion": "0.6.0", "discovery": "http://example.com"}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionErrorDetail.yamltype: objectproperties: field: type: string const: CG-Version description: The request header the error is about message: type: string description: Human-readable description of the problem supported: type: array items: $ref: protocolVersion.yaml minItems: 1 description: The versions this route serves defaultVersion: $ref: protocolVersion.yaml description: The version this route serves when a request doesn't name one discovery: type: string format: uri description: |- The server's version discovery URL
Omitted by servers that serve one version and don't publish discovery.required: - field - message - supported - defaultVersiondescription: Details shared by every version error, describing the route that was calledThe TypeSpec code for this model.
/** Details shared by every version error, describing the route that was called */@Versioning.added(CommonGrants.Versions.v0_6)model VersionErrorDetail { /** The request header the error is about */ field: "CG-Version";
/** Human-readable description of the problem */ message: string;
/** The versions this route serves */ @minItems(1) supported: Types.protocolVersion[];
/** The version this route serves when a request doesn't name one */ defaultVersion: Types.protocolVersion;
/** The server's version discovery URL * * Omitted by servers that serve one version and don't publish discovery. */ discovery?: url;}VersionMalformedDetail
Section titled “VersionMalformedDetail”The CG-Version value isn’t a full MAJOR.MINOR.PATCH version.
| Property | Type | Required | Description |
|---|---|---|---|
| field | string | Yes | The request header the error is about |
| message | string | Yes | Human-readable description of the problem |
| supported | array | Yes | The versions this route serves |
| defaultVersion | protocolVersion | Yes | The version this route serves when a request doesn't name one |
| discovery | url | No | The server's version discovery URL Omitted by servers that serve one version and don't publish discovery. |
| code | string | Yes | Stable error code that clients branch on |
| requested | string | Yes | The value received, as sent |
A JSON example of this model.
{ "code": "version.malformed", "requested": "string", "field": "CG-Version", "message": "string", "supported": [ "0.6.0" ], "defaultVersion": "0.6.0", "discovery": "http://example.com"}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionMalformedDetail.yamltype: objectproperties: code: type: string const: version.malformed description: Stable error code that clients branch on requested: type: string description: The value received, as sentrequired: - code - requestedallOf: - $ref: VersionErrorDetail.yamlunevaluatedProperties: {}description: The `CG-Version` value isn't a full `MAJOR.MINOR.PATCH` versionThe TypeSpec code for this model.
/** The `CG-Version` value isn't a full `MAJOR.MINOR.PATCH` version */@Versioning.added(CommonGrants.Versions.v0_6)model VersionMalformedDetail extends VersionErrorDetail { /** Stable error code that clients branch on */ code: "version.malformed";
/** The value received, as sent */ requested: string;
// Version errors are returned outside version selection, so new fields must be tolerated ...Record<unknown>;}VersionConflictDetail
Section titled “VersionConflictDetail”The request sent more than one CG-Version value.
| Property | Type | Required | Description |
|---|---|---|---|
| field | string | Yes | The request header the error is about |
| message | string | Yes | Human-readable description of the problem |
| supported | array | Yes | The versions this route serves |
| defaultVersion | protocolVersion | Yes | The version this route serves when a request doesn't name one |
| discovery | url | No | The server's version discovery URL Omitted by servers that serve one version and don't publish discovery. |
| code | string | Yes | Stable error code that clients branch on |
A JSON example of this model.
{ "code": "version.conflict", "field": "CG-Version", "message": "string", "supported": [ "0.6.0" ], "defaultVersion": "0.6.0", "discovery": "http://example.com"}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionConflictDetail.yamltype: objectproperties: code: type: string const: version.conflict description: Stable error code that clients branch onrequired: - codeallOf: - $ref: VersionErrorDetail.yamlunevaluatedProperties: {}description: The request sent more than one `CG-Version` valueThe TypeSpec code for this model.
/** The request sent more than one `CG-Version` value */@Versioning.added(CommonGrants.Versions.v0_6)model VersionConflictDetail extends VersionErrorDetail { /** Stable error code that clients branch on */ code: "version.conflict";
...Record<unknown>;}VersionUnsupportedDetail
Section titled “VersionUnsupportedDetail”The requested version isn’t served by this server or this route.
| Property | Type | Required | Description |
|---|---|---|---|
| field | string | Yes | The request header the error is about |
| message | string | Yes | Human-readable description of the problem |
| supported | array | Yes | The versions this route serves |
| defaultVersion | protocolVersion | Yes | The version this route serves when a request doesn't name one |
| discovery | url | No | The server's version discovery URL Omitted by servers that serve one version and don't publish discovery. |
| code | string | Yes | Stable error code that clients branch on |
| requested | protocolVersion | Yes | The version requested |
| scope | VersionErrorScope | Yes | Whether the server or only this route doesn't serve the version |
A JSON example of this model.
{ "code": "version.unsupported", "requested": "0.6.0", "scope": "deployment", "field": "CG-Version", "message": "string", "supported": [ "0.6.0" ], "defaultVersion": "0.6.0", "discovery": "http://example.com"}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionUnsupportedDetail.yamltype: objectproperties: code: type: string const: version.unsupported description: Stable error code that clients branch on requested: $ref: protocolVersion.yaml description: The version requested scope: $ref: VersionErrorScope.yaml description: Whether the server or only this route doesn't serve the versionrequired: - code - requested - scopeallOf: - $ref: VersionErrorDetail.yamlunevaluatedProperties: {}description: The requested version isn't served by this server or this routeThe TypeSpec code for this model.
/** The requested version isn't served by this server or this route */@Versioning.added(CommonGrants.Versions.v0_6)model VersionUnsupportedDetail extends VersionErrorDetail { /** Stable error code that clients branch on */ code: "version.unsupported";
/** The version requested */ requested: Types.protocolVersion;
/** Whether the server or only this route doesn't serve the version */ scope: VersionErrorScope;
...Record<unknown>;}VersionRetiredDetail
Section titled “VersionRetiredDetail”The requested version was retired from this server or this route.
| Property | Type | Required | Description |
|---|---|---|---|
| field | string | Yes | The request header the error is about |
| message | string | Yes | Human-readable description of the problem |
| supported | array | Yes | The versions this route serves |
| defaultVersion | protocolVersion | Yes | The version this route serves when a request doesn't name one |
| discovery | url | No | The server's version discovery URL Omitted by servers that serve one version and don't publish discovery. |
| code | string | Yes | Stable error code that clients branch on |
| requested | protocolVersion | Yes | The version requested |
| scope | VersionErrorScope | Yes | Whether the server or only this route doesn't serve the version |
| sunset | utcDateTime | Yes | When the version stopped being served |
A JSON example of this model.
{ "code": "version.retired", "requested": "0.6.0", "scope": "deployment", "sunset": "2019-08-24T14:15:22Z", "field": "CG-Version", "message": "string", "supported": [ "0.6.0" ], "defaultVersion": "0.6.0", "discovery": "http://example.com"}The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionRetiredDetail.yamltype: objectproperties: code: type: string const: version.retired description: Stable error code that clients branch on requested: $ref: protocolVersion.yaml description: The version requested scope: $ref: VersionErrorScope.yaml description: Whether the server or only this route doesn't serve the version sunset: type: string format: date-time description: When the version stopped being servedrequired: - code - requested - scope - sunsetallOf: - $ref: VersionErrorDetail.yamlunevaluatedProperties: {}description: The requested version was retired from this server or this routeThe TypeSpec code for this model.
/** The requested version was retired from this server or this route */@Versioning.added(CommonGrants.Versions.v0_6)model VersionRetiredDetail extends VersionErrorDetail { /** Stable error code that clients branch on */ code: "version.retired";
/** The version requested */ requested: Types.protocolVersion;
/** Whether the server or only this route doesn't serve the version */ scope: VersionErrorScope;
/** When the version stopped being served */ sunset: utcDateTime;
...Record<unknown>;}VersionErrorScope
Section titled “VersionErrorScope”Whether a version is unavailable on the whole server or only on the route called.
| Value | Description |
|---|---|
| deployment | The server doesn’t serve the version on any route |
| operation | The server serves the version, but not on this route |
A JSON example of this model.
"deployment"The JSON Schema for this model.
$schema: https://json-schema.org/draft/2020-12/schema$id: VersionErrorScope.yamltype: stringenum: - deployment - operationdescription: Whether a version is unavailable on the whole server or only on the route calledThe TypeSpec code for this model.
/** Whether a version is unavailable on the whole server or only on the route called */@Versioning.added(CommonGrants.Versions.v0_6)enum VersionErrorScope { /** The server doesn't serve the version on any route */ deployment,
/** The server serves the version, but not on this route */ operation,}