CI to push spec openapi document into OL website branch
See original GitHub issueProblem
The current release.sh
script defined in https://github.com/OpenLineage/OpenLineage/blob/main/spec/release.sh does the following:
# check if there are any changes in spec in the latest commit
if git diff --name-only --exit-code $PREV_SPEC_COMMIT HEAD 'spec/*.json' >> /dev/null; then
echo "no changes in spec detected, skipping publishing spec"
exit 0
fi
echo "Copying spec files from commit $PREV_SPEC_COMMIT"
# Mark last commit on which we finished copying spec
echo "$CIRCLE_SHA1" > "$WEBSITE_COMMIT_FILE"
# Copy changed spec fils to target location
git diff --name-only HEAD~1 HEAD 'spec/*.json' | while read LINE; do
# extract target file name from $id field in spec files
URL=$(cat $LINE | jq -r '.["$id"]')
# extract target location in website repo
LOC="${WEBSITE_DIR}/${URL#*//*/}"
LOC_DIR="${LOC%/*}"
# create dir if necessary, and copy files
mkdir -p $LOC_DIR
cp $LINE $LOC
done
So, basically it only adds whatever is ‘changed’ in the spec file, and then puts it into the website repo (so eventually it is available via website).
However, it does NOT
do the following:
- Generate openapi.html (spec documentation)
- pushes the updated openapi.html into the appropriate location in website.
Solution
- Add the code to generate openapi.html (using redoc-cli)
- pushes the updated openapi.html to the appropriate website location
- Make sure all the files version are correct, as well as their json spec urls.
How to install and run redoc-cli
- https://redocly.com/docs/redoc/deployment/cli/ has comprehensive instructions on installing redoc-cli Running it is easy. For example, if you want to generate the full openapi.html doc, simply run the below command:
redoc-cli build --output ~/temp/openapi.html ./openlineage.yml
Issue Analytics
- State:
- Created a year ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Interactive API documentation - GitLab Docs
Introduces the interactive documentation tool for the GitLab API. About the OpenAPI specification. The OpenAPI specification (formerly called Swagger) defines a ...
Read more >wshirey/openapi-ci-demo: Continuous Integration ... - GitHub
Run npm start · Make changes using your favorite editor or swagger-editor (look for URL in console output) ...
Read more >How to validate the OpenAPI spec in CI Runners - Medium
The easy way to make perfect OpenAPI Spec by validating easily with the gkarthics/swagger-validate container image in CI.
Read more >Getting started tutorial: Using Stoplight Studio to create an ...
Click Create. Stoplight Studio creates an OpenAPI (OAS) specification file called openweathermap.yml and loads it as follows: Open API editor in ...
Read more >API Documentation with the OpenAPI Specification & Swagger ...
In this webinar, we will look at the role of the OpenAPI Specification in documenting APIs, and how teams can leverage tools like...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The first half of this has now been done with #1295 #1296 #1298 #1299 and #1300.
The second half is being worked on in the website repo: https://github.com/OpenLineage/website/pull/70 - once that is merged successfully, we can close this issue.
I think this should be done inside website CI, not in this repo CI. The parts that interact between different repos should be as small as possible, if we need to do a lot of cross-repo communication it might be better to just put the website into this monorepo.