Skip to content

Conversation

@eecavanna
Copy link
Collaborator

@eecavanna eecavanna commented Jul 18, 2025

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 in pyproject.toml.

I also added a /version API endpoint that reads the value from pyproject.toml and 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 /health API endpoint to use true/false as its possible field values, instead of one field using "ok" and the other field using true/false. In other words, I standardized the values across fields. I also implemented a Pydantic model named HealthResponse, which makes the "schema" of that response visible to users of our Swagger UI page.

Finally, I added a src/README.md file that contains one-line descriptions of the contents of the src/ folder (except for one item, which I'm punting on describing).

@eecavanna eecavanna self-assigned this Jul 18, 2025
@eecavanna eecavanna linked an issue Jul 18, 2025 that may be closed by this pull request
2 tasks
@eecavanna eecavanna requested a review from Copilot July 18, 2025 06:33
Copy link
Contributor

Copilot AI left a 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 /version endpoint that returns API and schema version information
  • Refactors the /health endpoint 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

@eecavanna eecavanna merged commit dd395b9 into main Jul 18, 2025
2 checks passed
@eecavanna eecavanna deleted the 60-make-api-version-number-accessible-via-http-and-display-on-swagger-ui branch July 18, 2025 06:50
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.

Make API version number accessible via HTTP

2 participants