Skip to content
Open
Show file tree
Hide file tree
Changes from 20 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
425 changes: 408 additions & 17 deletions src/lifecycle.md

Large diffs are not rendered by default.

69 changes: 58 additions & 11 deletions src/schemas/validation/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,63 @@ $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:
- date
properties:
date:
type: string
format: date-time
reason:
type: string
sunset:
$ref: '#/$defs/sunset'
externalLinks:
type: array
items:
$ref: '#/$defs/lifecycle-link'
unevaluatedProperties: false

sunset:
description: When an operation is expected to stop accepting requests.
type: object
required:
- date
properties:
date:
type: string
format: date-time
unevaluatedProperties: false

# An External Documentation Object in lifecycle.externalLinks, where kind is required.
lifecycle-link:
$ref: '#/$defs/external-documentation'
required:
- kind

# 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
1 change: 1 addition & 0 deletions tests/schema/fail/date-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
date: 1736899200
1 change: 1 addition & 0 deletions tests/schema/fail/lifecycle-not-object.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- 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 @@
date: "2025-01-15T00:00:00Z"
externalLinks:
- kind: deprecation
description: 1
url: https://docs.example.com/migrate
4 changes: 4 additions & 0 deletions tests/schema/fail/link-kind-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
date: "2025-01-15T00:00:00Z"
externalLinks:
- kind: 1
url: https://docs.example.com/migrate
4 changes: 4 additions & 0 deletions tests/schema/fail/link-missing-kind.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# kind is REQUIRED in lifecycle.externalLinks
date: "2025-01-15T00:00:00Z"
externalLinks:
- url: https://docs.example.com/migrate
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 @@
date: "2025-01-15T00:00:00Z"
externalLinks:
- kind: deprecation
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 @@
date: "2025-01-15T00:00:00Z"
externalLinks:
- 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 @@
date: "2025-01-15T00:00:00Z"
externalLinks:
- kind: deprecation
summary: 1
url: https://docs.example.com/migrate
5 changes: 5 additions & 0 deletions tests/schema/fail/link-unknown-field.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
date: "2025-01-15T00:00:00Z"
externalLinks:
- kind: deprecation
name: Migration guide
url: https://docs.example.com/migrate
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 @@
date: "2025-01-15T00:00:00Z"
externalLinks:
- kind: deprecation
url: 1
4 changes: 4 additions & 0 deletions tests/schema/fail/links-not-array.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
date: "2025-01-15T00:00:00Z"
externalLinks:
kind: deprecation
url: https://docs.example.com/migrate
1 change: 1 addition & 0 deletions tests/schema/fail/missing-date.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
reason: "Replaced by v2 API with improved performance."
2 changes: 2 additions & 0 deletions tests/schema/fail/reason-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
date: "2025-01-15T00:00:00Z"
reason: 42
4 changes: 4 additions & 0 deletions tests/schema/fail/removed-migration-field.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# migration was replaced by externalLinks with kind: deprecation
date: "2025-01-15T00:00:00Z"
migration:
url: https://docs.example.com/migrate
4 changes: 4 additions & 0 deletions tests/schema/fail/removed-replacement-field.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# replacement was replaced by externalLinks with kind: successor-version
date: "2025-01-15T00:00:00Z"
replacement:
url: https://api.example.com/v2/openapi.yaml
6 changes: 6 additions & 0 deletions tests/schema/fail/removed-sunset-policy-field.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# sunset.policy was replaced by externalLinks with kind: sunset
date: "2025-01-15T00:00:00Z"
sunset:
date: "2025-07-01T00:00:00Z"
policy:
url: https://docs.example.com/sunset-policy
3 changes: 3 additions & 0 deletions tests/schema/fail/sunset-date-not-string.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
date: "2025-01-15T00:00:00Z"
sunset:
date: 1751328000
2 changes: 2 additions & 0 deletions tests/schema/fail/sunset-missing-date.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
date: "2025-01-15T00:00:00Z"
sunset: {}
2 changes: 2 additions & 0 deletions tests/schema/fail/sunset-not-object.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
date: "2025-01-15T00:00:00Z"
sunset: "2025-07-01T00:00:00Z"
2 changes: 2 additions & 0 deletions tests/schema/pass/empty-links.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
date: "2025-01-15T00:00:00Z"
externalLinks: []
25 changes: 25 additions & 0 deletions tests/schema/pass/lifecycle-object-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Lifecycle Object from the spec's Complete OpenAPI Description Example
date: "2025-01-15T00:00:00Z"
reason: "Replaced by v2 API with improved performance."
sunset:
date: "2025-07-01T00:00:00Z"
externalLinks:
- kind: deprecation
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
- kind: successor-version
summary: Flights API v2
description: Use `listFlights_v2` (`GET /v2/flights`) instead.
url: https://api.example.com/v2/openapi.yaml
- kind: sunset
summary: API sunset policy
url: https://docs.example.com/sunset-policy
- kind: changelog
summary: Changelog entry announcing the v1 deprecation
url: https://docs.example.com/changelog#2025-01-15
- kind: announcement
summary: Sunset announcement
url: https://status.example.com/announcements/flights-v1-sunset
6 changes: 6 additions & 0 deletions tests/schema/pass/link-extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# External Documentation Objects MAY be extended with Specification Extensions
date: "2025-01-15T00:00:00Z"
externalLinks:
- kind: deprecation
url: https://docs.example.com/migrate
x-audience: internal
2 changes: 2 additions & 0 deletions tests/schema/pass/minimal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Only the required field
date: "2025-01-15T00:00:00Z"
7 changes: 7 additions & 0 deletions tests/schema/pass/multiple-successors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# successor-version MAY appear more than once
date: "2025-01-15T00:00:00Z"
externalLinks:
- kind: successor-version
url: https://api.example.com/v2/openapi.yaml
- kind: successor-version
url: https://api.example.com/v3/openapi.yaml
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
date: "2025-01-15T00:00:00Z"
externalLinks:
- kind: deprecation
url: ../docs/migrate.html
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);
});
}
});