Ce mini outillage te permet de (1) valider, (2) bundler et (3) générer un HTML autonome Redoc à partir de openapi.yaml.
- Node.js 18+
- Ton fichier
openapi.yamlà la racine du projet
npm install- Lint (valide la spec) :
npm run lint
- Bundle (optionnel, fusionne les $ref) :
npm run bundle # génère openapi.bundle.yaml - Build (génère le HTML autonome) :
npm run build # sortie : dist/index.html - Serveur local :
npm run serve # ouvre http://localhost:8080
Astuce : si tu utilises des
$reflocaux ou distants,npm run bundleavantbuildaide Redoc à tout résoudre.
Un workflow est fourni dans .github/workflows/deploy.yml.
- Il build la doc et la publie sur GitHub Pages (branche
gh-pagesinterne à Pages). - Active Pages dans Settings → Pages et choisis "GitHub Actions".
/ (racine)
├── openapi.yaml
├── package.json
├── dist/ # sortie du build
└── .github/workflows/deploy.yml