-
Notifications
You must be signed in to change notification settings - Fork 2
Make API version number accessible via HTTP and display on swagger UI #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make API version number accessible via HTTP and display on swagger UI #64
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds version information accessibility to the API by exposing version numbers through a new HTTP endpoint and updating the health endpoint with structured responses. The changes enable better API introspection and monitoring capabilities.
- Adds a new
/versionendpoint that returns API and schema version information - Refactors the
/healthendpoint to return structured response models - Implements dynamic version extraction from Git tags in the CI/CD pipeline
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/server.py | Adds new /version endpoint and updates /health endpoint with structured responses |
| src/models.py | Defines Pydantic models for health and version API responses |
| src/README.md | Documents the source directory structure and contents |
| pyproject.toml | Updates version management approach with placeholder for CI/CD replacement |
| .github/workflows/build-and-push-image.yaml | Implements dynamic version extraction and injection during container builds |
On this branch, I update the GitHub Actions workflow that builds the container image, so it gets the Git tag name (if the workflow was triggered by a GitHub Release being published) or the Git commit hash (otherwise), and overwrites the placeholder
"0.0.0"version number inpyproject.toml.I also added a
/versionAPI endpoint that reads the value frompyproject.tomland returns it to the HTTP client. This, effectively, allows HTTP clients to determine which version of the API they are accessing.I also updated the existing
/healthAPI endpoint to usetrue/falseas its possible field values, instead of one field using"ok"and the other field usingtrue/false. In other words, I standardized the values across fields. I also implemented a Pydantic model namedHealthResponse, which makes the "schema" of that response visible to users of our Swagger UI page.Finally, I added a
src/README.mdfile that contains one-line descriptions of the contents of thesrc/folder (except for one item, which I'm punting on describing).