Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
97396a6
Align lifecycle.md with SAF framing using discussion #5 example data
miqui Sep 13, 2026
254cb1c
Merge pull request #2 from miqui/lifecycle-saf-alignment
miqui Sep 13, 2026
2438af1
Update lifecycle.md
miqui Sep 13, 2026
cf6e3da
Update endpoint from '/pets' to '/flights'
miqui Sep 15, 2026
4b60bb8
Align lifecycle SAF with OAS #5447 features and add external links ex…
miqui Oct 29, 2026
3bca048
Merge pull request #3 from miqui/lifecycle-saf-features-external-links
miqui Oct 29, 2026
d48630f
Fix formatting in lifecycle.md for OpenAPI section
miqui Oct 29, 2026
36a8aef
Replace named lifecycle link fields with an externalLinks array
miqui Oct 29, 2026
5a910ee
Merge pull request #4 from miqui/lifecycle-external-links-array
miqui Oct 29, 2026
75607b7
Define the Lifecycle Object schema and add pass/fail tests
miqui Oct 29, 2026
84487ff
Merge pull request #5 from miqui/lifecycle-schema
miqui Oct 29, 2026
a5f5208
Make `deprecated` take precedence over the Lifecycle Object
miqui Oct 29, 2026
07d7d2d
Note that deprecated: true alone is unchanged by the Lifecycle SAF
miqui Oct 29, 2026
ef7d652
Merge pull request #6 from miqui/lifecycle-deprecated-precedence
miqui Oct 29, 2026
0c10911
Use uri-reference format for External Documentation Object url
miqui Oct 30, 2026
3f02cb7
Point OAS links at pages that exist until OAS 3.3 is published
miqui Oct 30, 2026
0371a89
Show header output for the complete example and note provisional plac…
miqui Nov 6, 2026
bd72f5c
Clarify how the Lifecycle Object relates to deprecated, drop OAS vers…
miqui Nov 19, 2026
6dde9e8
Make a Lifecycle Object without deprecated: true an error
miqui Nov 19, 2026
0b26810
Make lifecycle link relations in response Link headers an error
miqui Nov 19, 2026
25b4c8f
Place the Lifecycle Object under featureFields
miqui Nov 21, 2026
65659c4
Remove the Non-goal paragraph from the Introduction
miqui Nov 21, 2026
2021375
Link to the OAS section on SAF declarations instead of restating it
miqui Nov 21, 2026
44d44a7
Group lifecycle links under named deprecation and sunset fields
miqui Nov 21, 2026
6bd6162
Restrict the Lifecycle Object to operations and drop scope history
miqui Nov 21, 2026
db1449c
Fill the compatibility TODO and make Header Mapping advice non-normative
miqui Nov 23, 2026
9292557
Define date-time fields as RFC 3339 date-time values
miqui Nov 28, 2026
5e194b4
Re-run CI after transient link-check failures
miqui Nov 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
452 changes: 432 additions & 20 deletions src/lifecycle.md

Large diffs are not rendered by default.

100 changes: 89 additions & 11 deletions src/schemas/validation/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,94 @@ $id: 'https://spec.openapis.org/lifecycle/1.0/schema/WORK-IN-PROGRESS'
title: Lifecycle Schema
description: Validates a Lifecycle Object.

# $dynamicAnchor marks Schema Object positions as an integration point.
# When this schema is used standalone, $dynamicRef resolves to the standard
# JSON Schema 2020-12 definition immediately below.
# When composed with an OAS metaschema (integration mechanism TBD), the OAS
# dialect fills in this anchor with the full OAS Schema Object definition.
$ref: '#/$defs/lifecycle'

$defs:
schema-object:
$dynamicAnchor: schema-object
$ref: 'https://json-schema.org/draft/2020-12/schema'
lifecycle:
description: Deprecation and sunset status of a single operation.
type: object
required:
- deprecation
properties:
deprecation:
$ref: '#/$defs/deprecation'
sunset:
$ref: '#/$defs/sunset'
unevaluatedProperties: false

deprecation:
description: When and why an operation is deprecated, and what replaces it.
type: object
required:
- date
properties:
date:
type: string
format: date-time
reason:
type: string
infoLink:
$ref: '#/$defs/link'
successorLink:
$ref: '#/$defs/link'
externalLinks:
$ref: '#/$defs/external-links'
unevaluatedProperties: false

sunset:
description: When an operation is expected to stop accepting requests.
type: object
required:
- date
properties:
date:
type: string
format: date-time
policyLink:
$ref: '#/$defs/link'
externalLinks:
$ref: '#/$defs/external-links'
unevaluatedProperties: false

# A link that maps to a Link header; the relation comes from the field holding it.
link:
type: object
required:
- url
properties:
url:
type: string
format: uri-reference
summary:
type: string
description:
type: string
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false

external-links:
type: array
items:
$ref: '#/$defs/external-documentation'

# External Documentation Object as extended by the OAS Docs Links proposal.
external-documentation:
type: object
required:
- url
properties:
summary:
type: string
description:
type: string
url:
type: string
format: uri-reference
kind:
type: string
$ref: '#/$defs/specification-extensions'
unevaluatedProperties: false

type: object
properties: {}
additionalProperties: false
specification-extensions:
patternProperties:
'^x-': true
2 changes: 2 additions & 0 deletions tests/schema/fail/date-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecation:
date: 1736899200
2 changes: 2 additions & 0 deletions tests/schema/fail/deprecation-missing-date.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deprecation:
reason: "Replaced by v2 API with improved performance."
1 change: 1 addition & 0 deletions tests/schema/fail/deprecation-not-object.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deprecation: "2025-01-15T00:00:00Z"
4 changes: 4 additions & 0 deletions tests/schema/fail/deprecation-unknown-field.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Unknown fields are not allowed in the Deprecation Object
deprecation:
date: "2025-01-15T00:00:00Z"
sunsetDate: "2025-07-01T00:00:00Z"
5 changes: 5 additions & 0 deletions tests/schema/fail/external-link-description-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
deprecation:
date: "2025-01-15T00:00:00Z"
externalLinks:
- url: https://docs.example.com/changelog
description: 1
5 changes: 5 additions & 0 deletions tests/schema/fail/external-link-kind-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
deprecation:
date: "2025-01-15T00:00:00Z"
externalLinks:
- url: https://docs.example.com/changelog
kind: 1
4 changes: 4 additions & 0 deletions tests/schema/fail/external-link-missing-url.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deprecation:
date: "2025-01-15T00:00:00Z"
externalLinks:
- summary: Changelog
4 changes: 4 additions & 0 deletions tests/schema/fail/external-link-not-object.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deprecation:
date: "2025-01-15T00:00:00Z"
externalLinks:
- https://docs.example.com/changelog
5 changes: 5 additions & 0 deletions tests/schema/fail/external-link-summary-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
deprecation:
date: "2025-01-15T00:00:00Z"
externalLinks:
- url: https://docs.example.com/changelog
summary: 1
5 changes: 5 additions & 0 deletions tests/schema/fail/external-link-unknown-field.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
deprecation:
date: "2025-01-15T00:00:00Z"
externalLinks:
- name: Changelog
url: https://docs.example.com/changelog
4 changes: 4 additions & 0 deletions tests/schema/fail/external-link-url-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deprecation:
date: "2025-01-15T00:00:00Z"
externalLinks:
- url: 1
4 changes: 4 additions & 0 deletions tests/schema/fail/external-links-not-array.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deprecation:
date: "2025-01-15T00:00:00Z"
externalLinks:
url: https://docs.example.com/changelog
2 changes: 2 additions & 0 deletions tests/schema/fail/lifecycle-not-object.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- deprecation:
date: "2025-01-15T00:00:00Z"
5 changes: 5 additions & 0 deletions tests/schema/fail/link-description-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
deprecation:
date: "2025-01-15T00:00:00Z"
infoLink:
url: https://docs.example.com/migrate
description: 1
4 changes: 4 additions & 0 deletions tests/schema/fail/link-missing-url.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deprecation:
date: "2025-01-15T00:00:00Z"
infoLink:
summary: Migration guide
3 changes: 3 additions & 0 deletions tests/schema/fail/link-not-object.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
deprecation:
date: "2025-01-15T00:00:00Z"
infoLink: https://docs.example.com/migrate
5 changes: 5 additions & 0 deletions tests/schema/fail/link-summary-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
deprecation:
date: "2025-01-15T00:00:00Z"
infoLink:
url: https://docs.example.com/migrate
summary: 1
4 changes: 4 additions & 0 deletions tests/schema/fail/link-url-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deprecation:
date: "2025-01-15T00:00:00Z"
infoLink:
url: 1
6 changes: 6 additions & 0 deletions tests/schema/fail/link-with-kind.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# The relation comes from the field, so Link Objects have no kind
deprecation:
date: "2025-01-15T00:00:00Z"
infoLink:
url: https://docs.example.com/migrate
kind: deprecation
2 changes: 2 additions & 0 deletions tests/schema/fail/missing-deprecation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sunset:
date: "2025-07-01T00:00:00Z"
3 changes: 3 additions & 0 deletions tests/schema/fail/reason-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
deprecation:
date: "2025-01-15T00:00:00Z"
reason: 42
4 changes: 4 additions & 0 deletions tests/schema/fail/removed-top-level-date.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# date moved to deprecation.date
date: "2025-01-15T00:00:00Z"
deprecation:
date: "2025-01-15T00:00:00Z"
6 changes: 6 additions & 0 deletions tests/schema/fail/removed-top-level-external-links.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# lifecycle.externalLinks keyed by kind was replaced by named link fields
deprecation:
date: "2025-01-15T00:00:00Z"
externalLinks:
- kind: deprecation
url: https://docs.example.com/migrate
7 changes: 7 additions & 0 deletions tests/schema/fail/successor-under-sunset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# successorLink belongs to the Deprecation Object
deprecation:
date: "2025-01-15T00:00:00Z"
sunset:
date: "2025-07-01T00:00:00Z"
successorLink:
url: https://api.example.com/v2/openapi.yaml
4 changes: 4 additions & 0 deletions tests/schema/fail/sunset-date-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deprecation:
date: "2025-01-15T00:00:00Z"
sunset:
date: 1751328000
3 changes: 3 additions & 0 deletions tests/schema/fail/sunset-missing-date.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
deprecation:
date: "2025-01-15T00:00:00Z"
sunset: {}
3 changes: 3 additions & 0 deletions tests/schema/fail/sunset-not-object.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
deprecation:
date: "2025-01-15T00:00:00Z"
sunset: "2025-07-01T00:00:00Z"
8 changes: 8 additions & 0 deletions tests/schema/pass/external-links-without-kind.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# kind is optional in documentation-only externalLinks
deprecation:
date: "2025-01-15T00:00:00Z"
externalLinks:
- url: https://docs.example.com/changelog
sunset:
date: "2025-07-01T00:00:00Z"
externalLinks: []
30 changes: 30 additions & 0 deletions tests/schema/pass/lifecycle-object-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Lifecycle Object from the spec's Complete OpenAPI Description Example
deprecation:
date: "2025-01-15T00:00:00Z"
reason: "Replaced by v2 API with improved performance."
infoLink:
summary: Migrating from Flights v1 to v2
description: |
Step-by-step guide covering renamed query parameters and the
new cursor-based pagination.
url: https://docs.example.com/migrate
successorLink:
summary: Flights API v2
description: Use `listFlights_v2` (`GET /v2/flights`) instead.
url: https://api.example.com/v2/openapi.yaml
externalLinks:
- url: https://docs.example.com/changelog#2025-01-15
summary: Changelog entry announcing the v1 deprecation
kind: changelog
sunset:
date: "2025-07-01T00:00:00Z"
policyLink:
summary: API sunset policy
url: https://docs.example.com/sunset-policy
externalLinks:
- url: https://status.example.com/announcements/flights-v1-sunset
summary: Sunset announcement
description: |
Timeline, support contacts, and FAQ for the retirement of
`GET /v1/flights`.
kind: announcement
9 changes: 9 additions & 0 deletions tests/schema/pass/link-extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Link and External Documentation Objects MAY be extended with Specification Extensions
deprecation:
date: "2025-01-15T00:00:00Z"
infoLink:
url: https://docs.example.com/migrate
x-audience: internal
externalLinks:
- url: https://docs.example.com/changelog
x-audience: public
3 changes: 3 additions & 0 deletions tests/schema/pass/minimal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Only the required fields
deprecation:
date: "2025-01-15T00:00:00Z"
5 changes: 5 additions & 0 deletions tests/schema/pass/relative-link-url.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# url is a URI reference, so relative references are allowed
deprecation:
date: "2025-01-15T00:00:00Z"
infoLink:
url: ../docs/migrate.html
4 changes: 4 additions & 0 deletions tests/schema/pass/sunset-minimal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deprecation:
date: "2025-01-15T00:00:00Z"
sunset:
date: "2025-07-01T00:00:00Z"
30 changes: 24 additions & 6 deletions tests/schema/schema.test.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
import { describe, expect, it } from "@oai/build-infra/test";
import { registerSchema } from "@oai/build-infra/schema/vitest";
import { readdirSync, readFileSync } from "node:fs";
import YAML from "yaml";
import { registerSchema, toMatchJsonSchema } from "@oai/build-infra/schema/vitest";
import { describe, expect, test } from "@oai/build-infra/test";

expect.extend({ toMatchJsonSchema });

const schemaUri = "https://spec.openapis.org/lifecycle/1.0/schema/WORK-IN-PROGRESS";
await registerSchema("./src/schemas/validation/schema.yaml");

// Placeholder test suite - add pass/fail test cases as the schema is developed.
describe("Lifecycle schema", () => {
it("validates an empty Lifecycle Object", async () => {
await expect({}).to.matchJsonSchema("./src/schemas/validation/schema.yaml");
});
for (const entry of readdirSync("tests/schema/pass", { withFileTypes: true })) {
if (!entry.isFile() || !entry.name.endsWith(".yaml")) continue;

test(`pass/${entry.name}`, async () => {
const document = YAML.parse(readFileSync(`tests/schema/pass/${entry.name}`, "utf8"));
await expect(document).toMatchJsonSchema(schemaUri);
});
}

for (const entry of readdirSync("tests/schema/fail", { withFileTypes: true })) {
if (!entry.isFile() || !entry.name.endsWith(".yaml")) continue;

test(`fail/${entry.name}`, async () => {
const document = YAML.parse(readFileSync(`tests/schema/fail/${entry.name}`, "utf8"));
await expect(document).not.toMatchJsonSchema(schemaUri);
});
}
});