This standalone project is a practical developer workshop for learning OpenAPI through a simple Product Catalog API. It focuses on one contract file, one mock workflow, and one recommended client-generation flow so developers can get started quickly.
- Frontend developers
- Backend developers
- Full-stack developers
- API consumers and integrators
- QA engineers working with APIs
The workshop teaches contract-first API development using the sample contract at:
openapi-workshop/contracts/product-catalog-api.yaml
Participants learn how to:
- read an OpenAPI contract confidently
- validate schemas and error responses
- run a mock API before backend implementation exists
- generate a typed client from the same contract
- make small safe updates to the contract
- Node.js 18+ and npm
- Java Runtime Environment if using
openapi-generator-cli - Terminal access
- Optional:
curl
openapi-workshop/
├── contracts/
│ └── product-catalog-api.yaml
├── labs/
├── solutions/
├── openapi-workshop.md
├── workshop-guide.md
└── exercises.md
openapi-frontend-contract/
├── openapi-frontend-contract.md
├── openapi-frontend-contract.pptx
└── artifact-build-manifest.json
From the repo root:
npm installThis installs the workshop CLI tools locally and enables the npm scripts below.
From the repo root:
npm run mockDirect command:
prism mock openapi-workshop/contracts/product-catalog-api.yamlExpected result:
- Prism starts successfully
- The mock server is available on
http://localhost:4010
From the repo root:
npm run validateExpected result:
- Validation completes successfully with no schema errors
Generate the recommended TypeScript fetch client:
npm run generate:clientThis workshop intentionally uses one primary generator target so the flow stays simple. Teams can try other generators later using the same contract.
From the repo root:
npm run mock
npm run validate
npm run generate:client
npm run verifyWhat they do:
mockstarts Prism against the workshop contractvalidatevalidates the OpenAPI contractgenerate:clientgenerates the recommended TypeScript fetch clientverifyruns validation and client generation
The worked solutions live in:
openapi-workshop/solutions/lab-01-openapi-basics-solution.mdopenapi-workshop/solutions/lab-02-contract-review-solution.mdopenapi-workshop/solutions/lab-03-prism-mock-server-solution.mdopenapi-workshop/solutions/lab-04-client-generation-solution.mdopenapi-workshop/solutions/challenge-lab-solution.md
Use these after the hands-on lab, during debrief, or when preparing to facilitate the workshop. The challenge solution is optional.
Use:
npm run mockUse:
npm installOr run the generator directly after install:
npx openapi-generator-cli versionCheck for:
- incorrect indentation in YAML
- broken
$refpointers - missing
requiredarrays - invalid enum values
- invalid schema keywords for the declared type
This is normal. Generated clients include models, API classes, helpers, and configuration. Treat the generated code as reproducible output and wrap it with thin adapters if your application needs custom behavior.
OpenAPI does not require a specific filename such as openapi.yaml. This workshop intentionally uses product-catalog-api.yaml so the teaching story stays consistent across slides, labs, and demos.