442 lines
16 KiB
YAML
442 lines
16 KiB
YAML
openapi: 3.2.0
|
|
info:
|
|
title: OpenAPI 3.2 compatibility fixture
|
|
version: 0.1.0
|
|
description: >-
|
|
Exercises the OpenAPI 3.2 subset and the api/core conventions (problem
|
|
details, cursor pagination, Idempotency-Key, If-Match, and ETag) through
|
|
the pinned generators. The operations are test fixtures, not product
|
|
endpoints. Component definitions shared with api/core are copies that must
|
|
stay identical to the api/core bundle.
|
|
servers:
|
|
- url: /
|
|
paths:
|
|
/probe:
|
|
get:
|
|
operationId: GetProbe
|
|
summary: Exercise OpenAPI 3.2 routing and input validation.
|
|
security: []
|
|
parameters:
|
|
- name: state
|
|
in: query
|
|
required: true
|
|
schema:
|
|
type: string
|
|
enum:
|
|
- allowed
|
|
responses:
|
|
"200":
|
|
description: The nullable value is generated with its validation type.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/NullablePayload"
|
|
default:
|
|
$ref: "#/components/responses/Problem"
|
|
additionalOperations:
|
|
PURGE:
|
|
operationId: PurgeProbe
|
|
summary: Exercise the OpenAPI 3.2 additionalOperations field.
|
|
security: []
|
|
responses:
|
|
"204":
|
|
description: The compatibility fixture operation completed.
|
|
default:
|
|
$ref: "#/components/responses/Problem"
|
|
/probe/items:
|
|
get:
|
|
operationId: ListProbeItems
|
|
summary: Exercise bounded cursor pagination.
|
|
security: []
|
|
parameters:
|
|
- $ref: "#/components/parameters/PageLimit"
|
|
- $ref: "#/components/parameters/PageCursor"
|
|
responses:
|
|
"200":
|
|
description: One page of fixture items.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/ProbeItemPage"
|
|
default:
|
|
$ref: "#/components/responses/Problem"
|
|
post:
|
|
operationId: CreateProbeItem
|
|
summary: Exercise an idempotent mutating command.
|
|
security: []
|
|
parameters:
|
|
- $ref: "#/components/parameters/IdempotencyKey"
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/ProbeItemInput"
|
|
responses:
|
|
"201":
|
|
description: The fixture item was created or the stored response was replayed.
|
|
headers:
|
|
ETag:
|
|
$ref: "#/components/headers/ETag"
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/ProbeItem"
|
|
"409":
|
|
$ref: "#/components/responses/IdempotencyInProgress"
|
|
"422":
|
|
$ref: "#/components/responses/UnprocessableContent"
|
|
default:
|
|
$ref: "#/components/responses/Problem"
|
|
/probe/items/{item_id}:
|
|
patch:
|
|
operationId: UpdateProbeItem
|
|
summary: Exercise optimistic concurrency with If-Match and ETag.
|
|
description: This operation requires If-Match; without it the fixture handler answers 428 precondition_required.
|
|
security: []
|
|
parameters:
|
|
- name: item_id
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: string
|
|
format: uuid
|
|
- $ref: "#/components/parameters/IdempotencyKey"
|
|
- $ref: "#/components/parameters/IfMatch"
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/ProbeItemInput"
|
|
responses:
|
|
"200":
|
|
description: The fixture item was updated.
|
|
headers:
|
|
ETag:
|
|
$ref: "#/components/headers/ETag"
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/ProbeItem"
|
|
"412":
|
|
$ref: "#/components/responses/PreconditionFailed"
|
|
"428":
|
|
$ref: "#/components/responses/PreconditionRequired"
|
|
default:
|
|
$ref: "#/components/responses/Problem"
|
|
components:
|
|
schemas:
|
|
NullablePayload:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- value
|
|
properties:
|
|
value:
|
|
type:
|
|
- string
|
|
- "null"
|
|
ProbeItemInput:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- name
|
|
properties:
|
|
name:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 100
|
|
ProbeItem:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- id
|
|
- name
|
|
- updated_at
|
|
properties:
|
|
id:
|
|
type: string
|
|
format: uuid
|
|
name:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 100
|
|
updated_at:
|
|
$ref: "#/components/schemas/Timestamp"
|
|
ProbeItemPage:
|
|
type: object
|
|
additionalProperties: false
|
|
required:
|
|
- items
|
|
- page
|
|
properties:
|
|
items:
|
|
type: array
|
|
maxItems: 100
|
|
items:
|
|
$ref: "#/components/schemas/ProbeItem"
|
|
page:
|
|
$ref: "#/components/schemas/PageInfo"
|
|
Problem:
|
|
type: object
|
|
description: Problem details (RFC 9457) returned with the application/problem+json media type for every error response. `code` is the stable, machine-readable reason; clients branch on it rather than on `title`, `detail`, or the HTTP status alone. The body never contains internal error text, stack traces, SQL, file paths, credentials, contact data, or echoed request values.
|
|
additionalProperties: false
|
|
required:
|
|
- type
|
|
- title
|
|
- status
|
|
- code
|
|
properties:
|
|
type:
|
|
type: string
|
|
format: uri-reference
|
|
maxLength: 256
|
|
description: URI that identifies the problem type. It has the form `urn:lincodex:problem:<code>` and is an identifier, not a link to dereference.
|
|
title:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 200
|
|
description: Short, fixed English summary of the problem type. It does not change between occurrences.
|
|
status:
|
|
type: integer
|
|
format: int32
|
|
minimum: 400
|
|
maximum: 599
|
|
description: HTTP status code generated by the origin server.
|
|
code:
|
|
$ref: "#/components/schemas/ProblemCode"
|
|
detail:
|
|
type: string
|
|
maxLength: 1000
|
|
description: Safe English explanation of this occurrence. It never contains internal error text or request values.
|
|
instance:
|
|
type: string
|
|
format: uri-reference
|
|
maxLength: 2048
|
|
description: URI reference that identifies this occurrence, when one exists.
|
|
trace_id:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 128
|
|
pattern: ^[A-Za-z0-9._-]+$
|
|
description: Request identifier, equal to the X-Request-ID response header. Quote it when reporting the problem; it is not a secret.
|
|
errors:
|
|
type: array
|
|
maxItems: 100
|
|
description: Field-level reasons for validation_failed. Other codes omit it.
|
|
items:
|
|
$ref: "#/components/schemas/ProblemFieldError"
|
|
ProblemCode:
|
|
type: string
|
|
description:
|
|
"Stable public error code. Adding a code is a contract change; renaming or removing one is a breaking change. Clients must handle an unknown code by its HTTP status.
|
|
|
|
|
|
- validation_failed (400): parameters or body do not match the contract, or a body violates a domain rule such as salary_from <= salary_to; `errors` points at the fields.
|
|
|
|
- unauthenticated (401): no valid session or credentials.
|
|
|
|
- forbidden (403): the caller is authenticated but not allowed.
|
|
|
|
- not_found (404): the route or object does not exist or is not visible.
|
|
|
|
- method_not_allowed (405): the route does not support the method.
|
|
|
|
- idempotency_in_progress (409): a request with the same Idempotency-Key is still being processed.
|
|
|
|
- state_conflict (409): the operation conflicts with the current state of the resource, for example an invitation that was already accepted.
|
|
|
|
- version_conflict (412): If-Match does not match the current version.
|
|
|
|
- payload_too_large (413): the request body exceeds the limit.
|
|
|
|
- unsupported_media_type (415): the request Content-Type is not accepted.
|
|
|
|
- idempotency_key_reused (422): the Idempotency-Key was already used with a different request.
|
|
|
|
- precondition_required (428): the operation requires If-Match.
|
|
|
|
- rate_limited (429): too many requests; see Retry-After.
|
|
|
|
- internal (500): unexpected server error.
|
|
|
|
- not_implemented (501): the operation is in the contract but not implemented yet."
|
|
enum:
|
|
- validation_failed
|
|
- unauthenticated
|
|
- forbidden
|
|
- not_found
|
|
- method_not_allowed
|
|
- idempotency_in_progress
|
|
- state_conflict
|
|
- version_conflict
|
|
- payload_too_large
|
|
- unsupported_media_type
|
|
- idempotency_key_reused
|
|
- precondition_required
|
|
- rate_limited
|
|
- internal
|
|
- not_implemented
|
|
ProblemFieldError:
|
|
type: object
|
|
description: One reason why a request field or parameter is invalid.
|
|
additionalProperties: false
|
|
required:
|
|
- in
|
|
- pointer
|
|
- code
|
|
- message
|
|
properties:
|
|
in:
|
|
$ref: "#/components/schemas/ProblemFieldLocation"
|
|
pointer:
|
|
type: string
|
|
maxLength: 1024
|
|
pattern: ^(/([^~/]|~[01])*)*$
|
|
description: JSON Pointer (RFC 6901). For `body` it points into the request body document, for example `/salary_from`; an empty string means the whole body. For a parameter it is `/` followed by the parameter name, for example `/limit` or `/Idempotency-Key`.
|
|
code:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 64
|
|
pattern: ^[a-z][a-z0-9_]*$
|
|
description: Stable field reason. Current values are `required` (missing value) and `invalid` (malformed value or a value outside the schema). Clients must tolerate new values.
|
|
message:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 500
|
|
description: Fixed English message that never echoes the submitted value.
|
|
ProblemFieldLocation:
|
|
type: string
|
|
description: Part of the request that contains the invalid field.
|
|
enum:
|
|
- body
|
|
- query
|
|
- path
|
|
- header
|
|
- cookie
|
|
Timestamp:
|
|
type: string
|
|
format: date-time
|
|
description: UTC instant in RFC 3339 format with the Z suffix, for example 2026-10-05T09:30:00Z. Servers always emit UTC. Every date-time field in this contract uses this schema.
|
|
examples:
|
|
- "2026-10-05T09:30:00Z"
|
|
PageInfo:
|
|
type: object
|
|
description: Cursor pagination state of a list response. Lists are ordered by a stable server-defined key. To read the next page, repeat the request with the same filters and `cursor` set to `next_cursor`.
|
|
additionalProperties: false
|
|
required:
|
|
- has_more
|
|
- next_cursor
|
|
properties:
|
|
has_more:
|
|
type: boolean
|
|
description: Whether another page follows this one.
|
|
next_cursor:
|
|
type:
|
|
- string
|
|
- "null"
|
|
minLength: 1
|
|
maxLength: 512
|
|
pattern: ^[A-Za-z0-9_-]+$
|
|
description: Opaque cursor of the next page, or null on the last page. Clients must not parse, build, or store it beyond the current listing.
|
|
parameters:
|
|
IdempotencyKey:
|
|
name: Idempotency-Key
|
|
in: header
|
|
required: true
|
|
description:
|
|
"Client-generated key that makes a retried mutating command safe; a UUID v4 is recommended. The value is sent without quotes. The server scopes the key by caller and operation and fingerprints the request by method, path, and body.
|
|
|
|
|
|
Stored for 24 hours after the first request and replayed with the same status, headers, and body: the final 2xx outcome and final deterministic 4xx business outcomes of the command, such as 404 not_found or 409 state_conflict. A replay does not repeat the side effect.
|
|
|
|
|
|
Not stored, so a retry with the same key is evaluated again: 400 validation_failed, 413, and 415 for the request itself, 401 and 403, 409 idempotency_in_progress, 412 version_conflict and 428 precondition_required (nothing changed; read the resource again and retry), 422 idempotency_key_reused, 429, and every 5xx.
|
|
|
|
|
|
Order of checks: authentication (401), request validation (400, 413, 415), authorization (403), then the key. A stored or running request with a different fingerprint returns 422 idempotency_key_reused before any other key check; a running request with the same fingerprint returns 409 idempotency_in_progress; a stored outcome with the same fingerprint is replayed. Only after that does the server check If-Match, so a retry of a completed change replays its outcome instead of failing on the version it has just changed. After 24 hours the key may be accepted as new."
|
|
schema:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 255
|
|
pattern: ^[A-Za-z0-9._:-]+$
|
|
example: 5f0c6a8e-3b0e-4c47-9f4c-2a8f9e5d7c11
|
|
IfMatch:
|
|
name: If-Match
|
|
in: header
|
|
required: false
|
|
description:
|
|
"Strong entity tag of the resource version the client last read, copied from the ETag response header. An operation that changes a versioned resource says in its own description that it requires If-Match.
|
|
|
|
|
|
On such an operation, a missing If-Match returns 428 precondition_required. An If-Match that does not equal the current ETag returns 412 version_conflict and changes nothing; read the resource again before retrying. Only one strong entity tag is accepted; weak tags, lists, and `*` fail validation with 400. The parameter is optional in the schema so that a missing header reaches the application, which answers 428."
|
|
schema:
|
|
type: string
|
|
minLength: 3
|
|
maxLength: 130
|
|
pattern: ^"[A-Za-z0-9._~-]{1,128}"$
|
|
example: '"v7"'
|
|
PageLimit:
|
|
name: limit
|
|
in: query
|
|
required: false
|
|
description: Maximum number of items in the page. The server may return fewer items even when more remain; use `page.has_more` to detect the end.
|
|
schema:
|
|
type: integer
|
|
format: int32
|
|
minimum: 1
|
|
maximum: 100
|
|
default: 20
|
|
PageCursor:
|
|
name: cursor
|
|
in: query
|
|
required: false
|
|
description: Opaque `page.next_cursor` value from the previous page of the same listing. Omit it to read the first page. A malformed or foreign cursor returns 400 with code validation_failed.
|
|
schema:
|
|
type: string
|
|
minLength: 1
|
|
maxLength: 512
|
|
pattern: ^[A-Za-z0-9_-]+$
|
|
headers:
|
|
ETag:
|
|
description: Strong entity tag of the returned resource version. Send it back in If-Match to change this version.
|
|
required: true
|
|
schema:
|
|
type: string
|
|
minLength: 3
|
|
maxLength: 130
|
|
pattern: ^"[A-Za-z0-9._~-]{1,128}"$
|
|
example: '"v7"'
|
|
responses:
|
|
IdempotencyInProgress:
|
|
description: A request with the same Idempotency-Key and the same fingerprint is still being processed; code idempotency_in_progress. Retry after the original request completes.
|
|
content:
|
|
application/problem+json:
|
|
schema:
|
|
$ref: "#/components/schemas/Problem"
|
|
UnprocessableContent:
|
|
description: The Idempotency-Key was already used with a different request within 24 hours; code idempotency_key_reused. Nothing was changed.
|
|
content:
|
|
application/problem+json:
|
|
schema:
|
|
$ref: "#/components/schemas/Problem"
|
|
PreconditionFailed:
|
|
description: If-Match does not match the current resource version; code version_conflict. Nothing was changed.
|
|
content:
|
|
application/problem+json:
|
|
schema:
|
|
$ref: "#/components/schemas/Problem"
|
|
PreconditionRequired:
|
|
description: The operation requires If-Match; code precondition_required.
|
|
content:
|
|
application/problem+json:
|
|
schema:
|
|
$ref: "#/components/schemas/Problem"
|
|
Problem:
|
|
description: Any error response. The body is a Problem whose `status` equals the HTTP status and whose `code` is one of ProblemCode.
|
|
content:
|
|
application/problem+json:
|
|
schema:
|
|
$ref: "#/components/schemas/Problem"
|