Skip to content

feat: migrate OpenAPI documentation from Swagger to Scalar with custom theme#137

Merged
JacobCoffee merged 1 commit intomainfrom
feature/scalar-openapi-migration
Nov 24, 2025
Merged

feat: migrate OpenAPI documentation from Swagger to Scalar with custom theme#137
JacobCoffee merged 1 commit intomainfrom
feature/scalar-openapi-migration

Conversation

@JacobCoffee
Copy link
Owner

Summary

Migrates the Byte Bot API documentation from Swagger UI to Scalar as the default OpenAPI documentation interface, with a custom theme using Byte brand colors.

Key Changes

  • Scalar as default: Modern, customizable OpenAPI documentation UI
  • 🎨 Custom brand theme: Full light/dark mode support with Byte colors
  • 🔄 Swagger fallback: Kept available at /api/swagger
  • 📦 Static CSS serving: Theme served from /static/css/scalar-theme.css

Endpoints

Endpoint Description Status
/api/scalar Scalar UI with custom theme ✅ Default
/api/swagger Swagger UI ✅ Fallback
/api Redirects to Scalar ✅ Works
/api/openapi.json OpenAPI schema ✅ Unchanged

Brand Colors Applied

  • Primary: #42b1a8 (Byte Teal)
  • Secondary: #7bcebc (Byte Blue)
  • Accent: #abe6d2 (Byte Light Blue)
  • Success: #059669
  • Warning: #d4a35a (Byte Orange)
  • Error: #fc7054 (Byte Red)

Files Changed

New Files:

  • services/api/src/byte_api/lib/scalar_theme.py - Scalar plugin factory
  • services/api/src/byte_api/domain/web/resources/css/scalar-theme.css - Custom theme CSS

Modified Files:

  • services/api/src/byte_api/lib/openapi.py - Updated to use render_plugins
  • tests/unit/api/test_openapi.py - Updated tests for new plugin system
  • docs/web/api/lib/openapi.rst - Added Scalar documentation
  • CLAUDE.md - Updated API docs URLs
  • README.md - Updated quick start guide

Test Plan

  • All tests pass (1067 passed, 9 skipped)
  • All CI checks pass (lint, type-check, format, test)
  • Scalar endpoint renders correctly with custom theme
  • Swagger fallback endpoint works
  • Custom CSS loads and applies brand colors
  • Light/dark mode switching works
  • OpenAPI schema generation unchanged

Screenshots

Note: Screenshots can be added after deployment to show the custom theme in action

Breaking Changes

None - Swagger UI remains available as a fallback at /api/swagger

Migration Notes

  • The default OpenAPI UI has changed from Swagger to Scalar
  • All existing integrations continue to work (OpenAPI schema unchanged)
  • Users preferring Swagger can still access it at /api/swagger

🤖 Generated with Claude Code

…m theme

- Replace Swagger UI with Scalar as default OpenAPI documentation interface
- Create custom Scalar theme using Byte brand colors (teal #42b1a8, blue #7bcebc)
- Implement light and dark mode support in custom theme CSS
- Serve custom CSS as static file at /static/css/scalar-theme.css
- Keep Swagger UI available as fallback at /api/swagger
- Update OpenAPI config to use render_plugins instead of root_schema_site
- Update tests to verify Scalar and Swagger plugin configuration
- Update documentation (RST, CLAUDE.md, README.md) with new endpoints

Endpoints:
- /api/scalar - Scalar UI (default, modern interface)
- /api/swagger - Swagger UI (fallback)
- /api/openapi.json - OpenAPI schema

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @JacobCoffee, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@railway-app
Copy link

railway-app bot commented Nov 24, 2025

🚅 Environment byte-pr-137 in byte has no services deployed.

@railway-app railway-app bot temporarily deployed to byte (byte / byte-pr-137) November 24, 2025 03:28 Destroyed
@github-actions
Copy link

Documentation preview will be available shortly at https://jacobcoffee.github.io/byte-docs-preview/137

@JacobCoffee JacobCoffee merged commit 73569c3 into main Nov 24, 2025
4 checks passed
@JacobCoffee JacobCoffee deleted the feature/scalar-openapi-migration branch November 24, 2025 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant