APIs · Intermediate · 26 min
Version an API without breaking existing clients
By Padding · Updated 18 Nov 2026
node:26 image · Node.js 26.13 · Express 5.3.0 · oasdiff 1.39.0
You will ship a v2 endpoint beside v1 in Express 5.3, announce v1's retirement with Deprecation, Sunset and Link headers, and add an oasdiff 1.39 check that fails any change to the OpenAPI contract that would break a client.
On this page
An API is a promise. Once a mobile app, a partner's integration or a script someone wrote two years ago depends on a field, renaming that field breaks them, and you usually find out from an angry support ticket. Versioning is how you change the promise without breaking it: ship the new shape beside the old one, tell callers the old one is going away and when, and make a machine catch the changes you did not notice were breaking.
This tutorial does that for a small members API in Express 5.3. You write the v1 contract as an OpenAPI file, use oasdiff to see which changes break clients, add a v2 endpoint next to v1, mark v1 with the Deprecation (RFC 9745) and Sunset (RFC 8594) headers, and finish with a written versioning policy and a check that enforces it on every pull request.
The window between deprecation and removal matters more than it looks. Many people keep an app version for months, especially on low-end Android phones with little storage or on prepaid data where an app update costs money. Those old builds keep calling v1 long after you ship v2, so plan for a generous sunset date rather than a few weeks.
Step 1 · Build v1 of the members API
Make a project folder and install Express. The range ~5.3.0 allows patch releases of 5.3 only:
mkdir -p ~/members-api
cd ~/members-api
npm init -y
npm pkg set type=module
npm install express@~5.3.0The code keeps two things apart from the start: how the server stores a member, and what each API version sends. The store holds a member with a name and a list of phones. Version 1 only ever exposed one phone number, as a string. Create store.js:
cat > store.js <<'JS'
const members = new Map()
let nextId = 1
export function addMember({ name, phones }) {
const member = { id: nextId++, name, phones }
members.set(member.id, member)
return member
}
export function getMember(id) {
return members.get(id)
}
addMember({ name: 'Amina Bello', phones: ['+234 800 000 0001'] })
addMember({ name: 'Kwame Mensah', phones: [] })
JSCreate v1.js. The function toV1 is the only place that knows the v1 shape:
cat > v1.js <<'JS'
import { Router } from 'express'
import { addMember, getMember } from './store.js'
export const v1 = Router()
function toV1(member) {
return { id: member.id, name: member.name, phone: member.phones[0] ?? '' }
}
v1.get('/members/:id', (req, res) => {
const member = getMember(Number(req.params.id))
if (!member) return res.status(404).json({ error: 'Member not found' })
res.json(toV1(member))
})
v1.post('/members', (req, res) => {
const { name, phone } = req.body ?? {}
if (typeof name !== 'string' || name.length < 1 || name.length > 100) {
return res.status(422).json({ error: 'name must be 1 to 100 characters' })
}
if (phone !== undefined && typeof phone !== 'string') {
return res.status(422).json({ error: 'phone must be a string' })
}
const member = addMember({ name, phones: phone ? [phone] : [] })
res.status(201).location(`/v1/members/${member.id}`).json(toV1(member))
})
JSCreate app.js, which mounts the v1 router under /v1, and server.js, which starts it:
cat > app.js <<'JS'
import express from 'express'
import { v1 } from './v1.js'
export const app = express()
app.disable('x-powered-by')
app.use(express.json({ limit: '10kb' }))
app.use('/v1', v1)
JS
cat > server.js <<'JS'
import { app } from './app.js'
const port = Number(process.env.PORT ?? 3000)
const server = app.listen(port, '127.0.0.1', (error) => {
if (error) throw error
console.log(`Listening on http://127.0.0.1:${port}`)
})
for (const signal of ['SIGINT', 'SIGTERM']) {
process.on(signal, () => server.close(() => process.exit(0)))
}
JSStart it in a second terminal and leave it running. --watch restarts the server whenever you change a file, which also resets the in-memory store to the two starting members:
cd ~/members-api
node --watch server.jsCheck it worked
Back in the first terminal, read a member and create one:
curl -s -w '\n' http://127.0.0.1:3000/v1/members/1
curl -s -w '\n%{http_code}\n' --json '{"name": "Chipo Moyo"}' http://127.0.0.1:3000/v1/membersThe first line is {"id":1,"name":"Amina Bello","phone":"+234 800 000 0001"}. The second request answers {"id":3,"name":"Chipo Moyo","phone":""} and 201. This is the shape every v1 client now depends on.
Step 2 · Write down the v1 contract
A breaking change is only visible against a written promise. Describe v1 in an OpenAPI file. It is JSON here so that a small Node script can make changed copies of it in the next steps; YAML works the same way with oasdiff. If OpenAPI is new to you, describe an API with an OpenAPI 3.2 document covers it in depth.
cat > openapi.json <<'JSON'
{
"openapi": "3.2.1",
"info": { "title": "Members API", "version": "1.0.0" },
"paths": {
"/v1/members": {
"post": {
"operationId": "createMemberV1",
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewMemberV1" } } }
},
"responses": {
"201": {
"description": "Member created",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/MemberV1" } } }
},
"422": { "description": "Invalid input" }
}
}
},
"/v1/members/{id}": {
"get": {
"operationId": "getMemberV1",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1 } }
],
"responses": {
"200": {
"description": "The member",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/MemberV1" } } }
},
"404": { "description": "No such member" }
}
}
}
},
"components": {
"schemas": {
"MemberV1": {
"type": "object",
"required": ["id", "name", "phone"],
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"phone": { "type": "string" }
}
},
"NewMemberV1": {
"type": "object",
"required": ["name"],
"properties": {
"name": { "type": "string", "minLength": 1, "maxLength": 100 },
"phone": { "type": "string" }
}
}
}
}
}
JSONTwo details decide what the checker can see later. required in MemberV1 says every response carries all three fields, so removing one is a broken promise. maxLength: 100 in NewMemberV1 says what input v1 accepts, so lowering it is one too.
Put the project under Git and commit this contract. The commit is the baseline every later change is compared with:
printf 'node_modules/\ncandidate.json\n' > .gitignore
git init -b main
git add -A
git commit -m "Members API v1 and its contract"Check it worked
node -p "Object.keys(require('./openapi.json').paths).join(' ')"
git log --onelineThe first command prints /v1/members /v1/members/{id}, so the file is valid JSON. git log shows one commit.
Step 3 · Install oasdiff
oasdiff compares two OpenAPI files and sorts each difference into a level: ERR for a definite breaking change, WARN for one that may break some clients, and INFO for a change that is safe. Its breaking command reports only ERR and WARN.
On Ubuntu or Debian, download the release package for your processor, check it against the published checksums and install it:
cd /tmp
OASDIFF_VERSION=1.39.0
ARCH=$(dpkg --print-architecture)
curl -fsSLO "https://github.com/oasdiff/oasdiff/releases/download/v${OASDIFF_VERSION}/oasdiff_${OASDIFF_VERSION}_linux_${ARCH}.deb"
curl -fsSLO "https://github.com/oasdiff/oasdiff/releases/download/v${OASDIFF_VERSION}/checksums.txt"
sha256sum --check --ignore-missing checksums.txt
sudo apt install -y "./oasdiff_${OASDIFF_VERSION}_linux_${ARCH}.deb"
rm "oasdiff_${OASDIFF_VERSION}_linux_${ARCH}.deb" checksums.txt
cd ~/members-apisha256sum prints oasdiff_1.39.0_linux_amd64.deb: OK (or arm64). If it prints FAILED, stop and download again. This package does not come from an apt repository, so apt upgrade never updates it. To upgrade, run the same commands with a newer version number from the oasdiff releases page.
On macOS, install it with Homebrew instead:
brew install oasdiffCheck it worked
oasdiff --versionThe output includes 1.39.0.
Step 4 · Find out which changes break clients
Write a script that makes a changed copy of the contract, candidate.json, for one kind of change at a time. Each change is one that teams make all the time:
cat > try-change.mjs <<'JS'
import { readFileSync, writeFileSync } from 'node:fs'
const change = process.argv[2]
const spec = JSON.parse(readFileSync('openapi.json', 'utf8'))
const { MemberV1, NewMemberV1 } = spec.components.schemas
if (change === 'rename') {
// "name" becomes "displayName" in responses
MemberV1.properties.displayName = MemberV1.properties.name
delete MemberV1.properties.name
MemberV1.required = ['id', 'displayName', 'phone']
} else if (change === 'type') {
// "phone" becomes a list of phone numbers
MemberV1.properties.phone = { type: 'array', items: { type: 'string' } }
} else if (change === 'tighten') {
// names longer than 40 characters are now rejected
NewMemberV1.properties.name.maxLength = 40
} else if (change === 'add-field') {
// responses gain an optional "joinedOn" date
MemberV1.properties.joinedOn = { type: 'string', format: 'date' }
} else if (change === 'remove-v1') {
// every /v1 endpoint is deleted
for (const path of Object.keys(spec.paths)) {
if (path.startsWith('/v1/')) delete spec.paths[path]
}
} else {
console.error('usage: node try-change.mjs rename|type|tighten|add-field|remove-v1')
process.exit(1)
}
writeFileSync('candidate.json', JSON.stringify(spec, null, 2) + '\n')
console.log(`wrote candidate.json with the "${change}" change`)
JSRename a response field and compare:
node try-change.mjs rename
oasdiff breaking openapi.json candidate.jsonThe report opens with a count of changes by level. Each finding then gives its level and an id in square brackets, names the endpoint, and says what changed in a sentence. Here the id is response-required-property-removed, once for GET /v1/members/{id} and once for POST /v1/members, because both return a member. Every client that reads member.name now gets undefined.
Now change a type, then tighten validation:
node try-change.mjs type
oasdiff breaking openapi.json candidate.json
node try-change.mjs tighten
oasdiff breaking openapi.json candidate.jsonThe first report flags response-property-type-changed: a client that calls phone.trim() crashes on a list. The second flags request-property-max-length-decreased: a form that has always sent 60-character names starts getting 422 back, and nothing in the client changed.
Finally, add an optional field to responses:
node try-change.mjs add-field
oasdiff breaking openapi.json candidate.json
oasdiff changelog openapi.json candidate.jsonbreaking says there are no breaking changes to report. changelog lists every change that affects callers, and shows this one as info with the id response-optional-property-added. Adding fields is safe as long as clients ignore fields they do not know, which is worth saying in your API documentation.
The pattern behind all of this: anything that makes a previously valid request invalid, or removes or reshapes something a response promised, breaks clients. That covers renaming or removing fields, changing types, tightening validation, adding a required request field, removing an endpoint and changing a status code. Adding endpoints, optional request fields and response fields does not.
oasdiff only sees what the contract describes. A change in behaviour the contract does not mention, such as a new default sort order or a field that is now sometimes empty, can still break clients. Review those by hand.
Check it worked
You have seen three changes reported as breaking (response-required-property-removed, response-property-type-changed, request-property-max-length-decreased) and one that breaking let through. git status --short shows try-change.mjs as new and nothing else, because candidate.json is ignored.
git status --shortStep 5 · Ship v2 beside v1
Suppose members now need several phone numbers and the product team prefers displayName. Both changes break v1 clients, so they go into a new version while v1 keeps answering exactly as before.
URL, header or date
There are three common ways for a client to choose a version:
- In the URL path, as in
/v1/membersand/v2/members. It is visible in every log line, works with any HTTP client and with caches without extra setup, and maps cleanly to separate code. The cost is that the "same" resource has two addresses. - In a request header, such as
Accept: application/vnd.members.v2+jsonor a customAPI-Version: 2. URLs stay stable, but the version is hidden from logs and browser address bars, caches must vary on that header, and a client that forgets the header silently gets whatever your default is. - By date, where each client is pinned to the API as it was on a date, sent in a header or stored with the client's account. The server keeps a chain of small transforms between dates. It lets you make many small changes without big version jumps, but every response passes through that chain, and it takes real tooling to maintain.
For most teams, a major version in the path is the clearest choice, and the one this tutorial uses. Whatever you choose, version only for breaking changes. Additive changes ship inside the current version.
Create v2.js. It reads the same store and returns the new shape:
cat > v2.js <<'JS'
import { Router } from 'express'
import { addMember, getMember } from './store.js'
export const v2 = Router()
function toV2(member) {
return { id: member.id, displayName: member.name, phones: member.phones }
}
function validPhones(phones) {
return (
Array.isArray(phones) &&
phones.length <= 5 &&
phones.every((phone) => typeof phone === 'string' && phone.length > 0)
)
}
v2.get('/members/:id', (req, res) => {
const member = getMember(Number(req.params.id))
if (!member) return res.status(404).json({ error: 'Member not found' })
res.json(toV2(member))
})
v2.post('/members', (req, res) => {
const { displayName, phones = [] } = req.body ?? {}
if (typeof displayName !== 'string' || displayName.length < 1 || displayName.length > 100) {
return res.status(422).json({ error: 'displayName must be 1 to 100 characters' })
}
if (!validPhones(phones)) {
return res.status(422).json({ error: 'phones must be a list of up to 5 phone numbers' })
}
const member = addMember({ name: displayName, phones })
res.status(201).location(`/v2/members/${member.id}`).json(toV2(member))
})
JSThen replace app.js so it mounts both routers:
cat > app.js <<'JS'
import express from 'express'
import { v1 } from './v1.js'
import { v2 } from './v2.js'
export const app = express()
app.disable('x-powered-by')
app.use(express.json({ limit: '10kb' }))
app.use('/v1', v1)
app.use('/v2', v2)
JSnode --watch restarts the server in the second terminal.
Check it worked
Create a member through v2 with two numbers, then read it through both versions:
curl -s -w '\n' --json '{"displayName": "Chipo Moyo", "phones": ["+263 77 000 0003", "+263 71 000 0004"]}' http://127.0.0.1:3000/v2/members
curl -s -w '\n' http://127.0.0.1:3000/v2/members/3
curl -s -w '\n' http://127.0.0.1:3000/v1/members/3The v2 responses are {"id":3,"displayName":"Chipo Moyo","phones":["+263 77 000 0003","+263 71 000 0004"]}. The v1 response for the same member is {"id":3,"name":"Chipo Moyo","phone":"+263 77 000 0003"}: an old client still gets the shape it was written for. One store with a translation function per version is what keeps v1 cheap to run.
Step 6 · Announce when v1 retires
Callers need to learn that v1 is going away from the API itself, not only from a blog post. Two standard response headers do that:
Deprecation(RFC 9745) says when the resource was or will be deprecated. Its value is@followed by a Unix timestamp in seconds.Sunset(RFC 8594) says when the resource is expected to stop responding, as an HTTP date. It must not be earlier than the deprecation date.- A
Linkheader withrel="deprecation"points to a page that explains the change and how to migrate.
Create deprecation.js, a middleware that adds all three, and that answers 410 Gone once the sunset date has passed:
cat > deprecation.js <<'JS'
export function deprecated({ since, sunset, docs }) {
const deprecationValue = `@${Math.floor(since.getTime() / 1000)}`
const sunsetValue = sunset.toUTCString()
const link = `<${docs}>; rel="deprecation"; type="text/html"`
return (req, res, next) => {
res.set('Deprecation', deprecationValue)
res.set('Sunset', sunsetValue)
res.append('Link', link)
if (Date.now() >= sunset.getTime()) {
return res.status(410).json({ error: 'This version has been retired', docs })
}
next()
}
}
JSReplace app.js to put it in front of v1 only. The documentation address below is an example: replace it with your own migration guide.
cat > app.js <<'JS'
import express from 'express'
import { deprecated } from './deprecation.js'
import { v1 } from './v1.js'
import { v2 } from './v2.js'
export const app = express()
app.disable('x-powered-by')
app.use(express.json({ limit: '10kb' }))
const v1Retirement = deprecated({
since: new Date('2026-11-16T00:00:00Z'),
sunset: new Date('2028-06-30T23:59:59Z'),
docs: 'https://api.example.com/docs/migrate-v1-to-v2',
})
app.use('/v1', v1Retirement, v1)
app.use('/v2', v2)
JSIf browsers call your API from another origin, add Deprecation, Sunset, Link to your Access-Control-Expose-Headers, or front-end code cannot read them.
The contract has to say the same thing. Replace openapi.json with a version that adds the v2 endpoints and marks each v1 operation deprecated, with oasdiff's x-sunset extension holding the sunset date:
cat > openapi.json <<'JSON'
{
"openapi": "3.2.1",
"info": { "title": "Members API", "version": "2.0.0" },
"paths": {
"/v1/members": {
"post": {
"operationId": "createMemberV1",
"deprecated": true,
"x-sunset": "2028-06-30",
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewMemberV1" } } }
},
"responses": {
"201": {
"description": "Member created",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/MemberV1" } } }
},
"422": { "description": "Invalid input" }
}
}
},
"/v1/members/{id}": {
"get": {
"operationId": "getMemberV1",
"deprecated": true,
"x-sunset": "2028-06-30",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1 } }
],
"responses": {
"200": {
"description": "The member",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/MemberV1" } } }
},
"404": { "description": "No such member" }
}
}
},
"/v2/members": {
"post": {
"operationId": "createMemberV2",
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewMemberV2" } } }
},
"responses": {
"201": {
"description": "Member created",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/MemberV2" } } }
},
"422": { "description": "Invalid input" }
}
}
},
"/v2/members/{id}": {
"get": {
"operationId": "getMemberV2",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1 } }
],
"responses": {
"200": {
"description": "The member",
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/MemberV2" } } }
},
"404": { "description": "No such member" }
}
}
}
},
"components": {
"schemas": {
"MemberV1": {
"type": "object",
"required": ["id", "name", "phone"],
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"phone": { "type": "string" }
}
},
"NewMemberV1": {
"type": "object",
"required": ["name"],
"properties": {
"name": { "type": "string", "minLength": 1, "maxLength": 100 },
"phone": { "type": "string" }
}
},
"MemberV2": {
"type": "object",
"required": ["id", "displayName", "phones"],
"properties": {
"id": { "type": "integer" },
"displayName": { "type": "string" },
"phones": { "type": "array", "maxItems": 5, "items": { "type": "string", "minLength": 1 } }
}
},
"NewMemberV2": {
"type": "object",
"required": ["displayName"],
"properties": {
"displayName": { "type": "string", "minLength": 1, "maxLength": 100 },
"phones": { "type": "array", "maxItems": 5, "items": { "type": "string", "minLength": 1 } }
}
}
}
}
}
JSONCheck it worked
Look at the headers of a v1 response and a v2 response:
curl -si http://127.0.0.1:3000/v1/members/1 | grep -iE '^(deprecation|sunset|link):'
curl -si http://127.0.0.1:3000/v2/members/1 | grep -ciE '^(deprecation|sunset):' || trueThe v1 response carries three lines:
Deprecation: @1794787200
Sunset: Fri, 30 Jun 2028 23:59:59 GMT
Link: <https://api.example.com/docs/migrate-v1-to-v2>; rel="deprecation"; type="text/html"The v2 count is 0. The v1 body has not changed, so nothing breaks today; client developers who log these headers, and tools that watch for them, now know the date.
Step 7 · Block breaking changes in CI
Now turn the comparison into a check that fails. oasdiff can read a file straight from a Git revision with <ref>:<path>, so a script can compare your working copy with the contract on the base branch. Create scripts/check-contract.sh:
mkdir -p scripts
cat > scripts/check-contract.sh <<'SH'
#!/bin/sh
# Fail if the contract breaks clients compared with the base branch.
# BASE_REF defaults to origin/main; pass another file to check a candidate.
set -eu
base="${BASE_REF:-origin/main}"
revision="${1:-openapi.json}"
oasdiff breaking --fail-on ERR "$base:openapi.json" "$revision"
SH
npm pkg set scripts.api:check="sh scripts/check-contract.sh"--fail-on ERR makes oasdiff exit with code 1 when it finds a definite breaking change. Run it against your last commit, which still holds the v1-only contract:
BASE_REF=HEAD npm run api:checkIt passes, and says there are no breaking changes to report. Adding v2 is additive, and marking v1 deprecated does not break anyone. Commit this state, as if the pull request were merged:
git add -A
git commit -m "Add v2 and deprecate v1"Now try to delete v1 early, before its sunset date:
node try-change.mjs remove-v1
BASE_REF=HEAD npm run --silent api:check -- candidate.json || echo "check failed with exit code $?"Check it worked
The check fails with exit code 1, and each v1 endpoint is reported with the id api-path-removed-before-sunset and the date 2028-06-30. Run the same command on or after that date and the removal is allowed, because the contract announced it.
To run this on every pull request, add a workflow. Pin the oasdiff version and its checksum, and fetch the full history so the base branch exists:
mkdir -p .github/workflows
cat > .github/workflows/api-contract.yml <<'YAML'
name: API contract
on: pull_request
jobs:
no-breaking-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install oasdiff 1.39.0
run: |
curl -fsSLO https://github.com/oasdiff/oasdiff/releases/download/v1.39.0/oasdiff_1.39.0_linux_amd64.deb
echo "23140232d54af4fc1557d78c511e5d836a83176d96ac356a5219989405c8eeb1 oasdiff_1.39.0_linux_amd64.deb" | sha256sum --check
sudo apt-get install -y ./oasdiff_1.39.0_linux_amd64.deb
- name: Compare the contract with the base branch
env:
BASE_REF: origin/${{ github.base_ref }}
run: sh scripts/check-contract.sh
YAMLMake the job a required status check in your repository's branch protection, so a red result blocks the merge. For more on workflows, see run Node tests in GitHub Actions.
Step 8 · Write the versioning policy
The check enforces rules that people also need to read. Write them down next to the code, with the same dates the headers and contract use:
cat > API-VERSIONING.md <<'MD'
# Members API versioning policy
## What counts as breaking
- Removing or renaming an endpoint, a field or a query parameter.
- Changing a field's type or format, or the meaning of a value.
- Tightening validation: a new required field, a lower maximum, a narrower enum.
- Changing a success status code or the error format.
Adding endpoints, optional request fields and response fields is not breaking.
Clients must ignore response fields they do not know.
## How versions work
- The major version is in the path: /v1, /v2. Breaking changes only ship in a new major version.
- Additive changes ship inside the current version, with no notice period.
- At most two major versions are live at once.
## Retiring a version
- Deprecated versions send Deprecation (RFC 9745), Sunset (RFC 8594) and a Link with rel="deprecation" to the migration guide.
- The contract marks every deprecated operation with deprecated: true and x-sunset.
- At least 12 months pass between deprecation and sunset.
- After the sunset date the version answers 410 Gone for 30 days, then it is removed.
- Current: v1 deprecated 16 November 2026, sunset 30 June 2028.
## Enforcement
- Every pull request runs npm run api:check (oasdiff breaking --fail-on ERR against the base branch).
- Overriding a failure needs a written reason in the pull request and approval from the API owner.
MDCheck it worked
grep -E 'sunset|api:check' API-VERSIONING.mdThe output shows the x-sunset rule, the 12-month window, the current v1 dates and the npm run api:check line. The dates match the Sunset header and the x-sunset values; if they ever drift apart, fix the policy, the headers and the contract in the same pull request.
Step 9 · Clean up
Stop the server with Ctrl+C in the second terminal. Then remove the project:
cd ~
rm -rf ~/members-apiIf you do not want to keep oasdiff, remove it too:
sudo apt remove -y oasdiffCheck it worked
ls ~/members-api reports that there is no such file or directory, and nothing answers on port 3000.
Next steps
- Design endpoints that need fewer breaking changes in the first place: design REST endpoints, methods and status codes.
- Write a fuller contract with schemas split across files and linting: describe an API with an OpenAPI 3.2 document.
- Revisit the basics of the framework used here: build a REST API with Express 5.
- Run the contract check beside your other checks: run Node tests in GitHub Actions.
Part of these paths
Related tutorials
- Describe an API with an OpenAPI 3.2 documentYou will write an OpenAPI 3.2 contract for a ticketing API by hand across several files, lint it clean with Redocly CLI 2, bundle it into one file and generate TypeScript types that a client uses against a mock server.
- Design REST endpoints: resources, methods and status codesYou will design the endpoints of an event ticketing API on one page, build an Express 5 stub that follows it, and prove every status code in the design with curl.
- How to Build a REST API with Express 5You will build a small items API with Express 5.3 on Node.js 26 that validates its input, returns the right HTTP status codes, never sends a stack trace to callers, and has automated tests that use only Node's built-in test runner.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials