Add Swagger UI alongside Redocly documentation #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds Swagger UI for interactive API exploration alongside the existing Redocly documentation, providing users with two complementary ways to interact with the Green Button ESPI API.
Problem Solved
Users need different tools for different purposes:
Both tools now use the same
openapi/openapi.yamlsource file - no duplication!Changes Made
1. Added Swagger UI
✅ Installed
swagger-ui-distpackage✅ Created build script (
scripts/build-swagger.js)✅ Green Button branded - Custom colors and styling
✅ Navigation - Link from Swagger UI to Redocly docs
2. Updated Build System
✅ npm run build - Builds both formats
✅ npm run build:redocly - Builds only Redocly
✅ npm run build:swagger - Builds only Swagger UI
✅ npm run bundle - Generates JSON bundle for Swagger
3. Documentation Updates
✅ Updated README with both documentation formats
✅ Added link in OpenAPI description to Swagger UI
✅ Cross-navigation between both interfaces
Documentation Formats
Redocly (Main) -
dist/index.htmlSwagger UI (Interactive) -
dist/swagger/index.htmlBuild Output Structure
File Changes
scripts/build-swagger.js(build script)package.json(new scripts, swagger-ui-dist dep)package-lock.json(new dependencies)README.md(documentation for both formats)openapi/openapi.yaml(link to Swagger UI)Total: 5 files changed, 191 insertions, 4 deletions
Features
Green Button Branding
Cross-Navigation
Single Source of Truth
Both tools read from
openapi/openapi.yaml- maintain one file, get two interfaces!Validation
✅
npm test- Passes with valid OpenAPI spec✅
npm run build- Successfully builds both formats✅ Both interfaces display correctly
Testing
After merge, verify:
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com