feat: enable semantic versioning for openAPI specs#677
Conversation
| openapi: "3.1.0" | ||
| info: | ||
| version: 2.12.0 | ||
| version: ${TAG} |
There was a problem hiding this comment.
BDD tests depend on openapi_internal.yaml to generate the JSON spec (source). I checked this branch and the API client auto-generation still succeeds even if the ${TAG} is not resolved in the JSON file:

I don't know if this has side effects on the BDD tests, though. Could you please run them on this PR?
There was a problem hiding this comment.
Thanks Leo, I've implemented an additional target that compiles the OpenAPI spec before generating a client, but given that the compiled code is generated in a subfolder, the hardcoded references to the object schemas break. So the idea of version generation will not work for this OpenAPI spec. I'm closing the PR.

MarkRedeman
left a comment
There was a problem hiding this comment.
I don't want to block this since it will help in improving our release process.
But I personally don't really like that we are making a functioning yaml configuration file be aware of how our build system is supposed to work.
One thing for the UI team to be aware of with this change is that running npm run build:rest-openapi-spec will no longer produce a valid spec as like Leo mentioned the version will be "${TAG}".
We could fix that by adding these env substitions into our scripts as well, but I think that would just add more complexity without a lot of gain.
| COPY --from=docs_context rest_api /home/app/docs/rest_api/ | ||
| COPY --from=api_context schemas /home/app/interactive_ai/services/api/schemas/ | ||
| COPY --from=build_rest_api_specs /home/app/docs/rest_api/ /home/app/docs/rest_api/ | ||
| COPY --from=build_rest_api_specs /home/app/interactive_ai/services/api/schemas/ /home/app/interactive_ai/services/api/schemas/ |
There was a problem hiding this comment.
I believe we can remove these since we don't need this at build time (only when calling build:rest-openapi-spec).
| RUN TAG=${REACT_APP_GETI_VERSION} envsubst '$$TAG' < /home/app/docs/rest_api/openapi.yaml > /home/app/docs/rest_api/openapi.yaml.tmp && \ | ||
| mv /home/app/docs/rest_api/openapi.yaml.tmp /home/app/docs/rest_api/openapi.yaml && \ | ||
| TAG=${REACT_APP_GETI_VERSION} envsubst '$$TAG' < /home/app/docs/rest_api/openapi_internal.yaml > /home/app/docs/rest_api/openapi_internal.yaml.tmp && \ | ||
| mv /home/app/docs/rest_api/openapi_internal.yaml.tmp /home/app/docs/rest_api/openapi_internal.yaml |
There was a problem hiding this comment.
We could simplify this a bit using tee,
RUN for file in /home/app/docs/rest_api/openapi.yaml /home/app/docs/rest_api/openapi_internal.yaml; do \
TAG=${REACT_APP_GETI_VERSION} envsubst '$$TAG' < "$file" | tee "$file"; \
done
| @@ -0,0 +1,22 @@ | |||
| include ../../Makefile.shared | |||
|
|
|||
| RESTAPI_BUILD_DIR := ${TARGET_DIR}/rest-api | |||
There was a problem hiding this comment.
This folder uses kebab case vs the camel case that we use in the actual folder is that intended?
|
closing because of this issue: #677 (comment) |
📝 Description
This PR adds automatic version injection to OpenAPI files during the build process. This ensures consistent automatic versioning across all components in the repository.
Changes:
✨ Type of Change
Select the type of change your PR introduces:
🧪 Testing Scenarios
Describe how the changes were tested and how reviewers can test them too:
✅ Checklist
Before submitting the PR, ensure the following: