Skip to content

feat: add Scalar API explorer and OpenAPI export tooling#6

Open
alexandrewavelet wants to merge 2 commits into
Altered-Community:mainfrom
alexandrewavelet:feat/scalar-ui
Open

feat: add Scalar API explorer and OpenAPI export tooling#6
alexandrewavelet wants to merge 2 commits into
Altered-Community:mainfrom
alexandrewavelet:feat/scalar-ui

Conversation

@alexandrewavelet
Copy link
Copy Markdown
Collaborator

@alexandrewavelet alexandrewavelet commented May 13, 2026

image

Summary

  • Integrates Scalar as the API documentation explorer, replacing the default Swagger UI at /api/docs
  • Adds OpenApiFactory decorator to inject app name/version and disable the AI agent in the dev UI
  • Adds a pre-commit git hook and make openapi target to keep docs/openapi.json in sync automatically
  • Documents the make install-hooks step in the install guide

Test plan

  • Run make install-hooks and verify the pre-commit hook is active
  • Visit /api/docs and confirm Scalar loads with the correct app info
  • Make a change and commit — verify docs/openapi.json is auto-updated and staged

🤖 Generated with Claude Code

alexandrewavelet and others added 2 commits May 13, 2026 07:22
- Integrate Scalar UI as the API documentation explorer at /api/docs
- Add OpenApiFactory decorator to inject app info and disable AI agent
- Add pre-commit hook and Makefile target to export docs/openapi.json
- Document install-hooks step in install guide

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread .githooks/pre-commit
Comment on lines +1 to +16
#!/bin/sh
# Regenerate OpenAPI spec before each commit so docs/openapi.json stays in sync.
# Skips gracefully if Docker is not running.

OPENAPI_OUTPUT="docs/openapi.json"

if ! docker compose ps --services --filter "status=running" 2>/dev/null | grep -q "php"; then
echo "⚠ Docker php container not running — skipping OpenAPI export (run 'make openapi' manually)"
exit 0
fi

echo "→ Exporting OpenAPI spec…"
docker compose exec -T php php bin/console api:openapi:export --output="$OPENAPI_OUTPUT" --no-interaction

git add "$OPENAPI_OUTPUT"
echo "✓ $OPENAPI_OUTPUT updated and staged"
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Le seul but de générer docs/openapi.json est d'avoir la spec OpenAPI à portée de main pour importer dans Postman ou pour Claude par exemple. Est ce que je garde ça?

enable_re_doc: false
enable_scalar: true
openapi:
scalar_extra_configuration:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Actuellement le "try it out" sur les endpoints est activé en prod (mais nécessite un token à saisir pour fonctionner), est ce qu'on garde ça ou en prod on utilise Scalar que pour la doc?

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