Skip to content
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

CI: generate openapi contract before asking for contract diff #21

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

paulRbr
Copy link
Member

@paulRbr paulRbr commented Oct 16, 2023

Add an additional step to automatically generate to API contract in the CI step.

@paulRbr paulRbr force-pushed the generate-openapi-diff branch 9 times, most recently from 552efab to 07007b5 Compare October 16, 2023 12:58
With this commit:

Review can be deleted (operation added)
Boon can not be deleted (operation removed, this is a breaking change)
@github-actions
Copy link

🚨 Breaking API change detected:

Added (1)

  • DELETE /reviews/{id}

Removed (1)

  • [Breaking] DELETE /books/{id}

Powered by Bump.sh

@paulRbr
Copy link
Member Author

paulRbr commented Oct 16, 2023

ping @Polo2 Here's my suggestion to automatically generate the API contract as part of the CI process. I'll remove the commit changing the API (be4a835) if you're ok to merge this

Copy link
Member

@Polo2 Polo2 left a comment

Choose a reason for hiding this comment

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

Many thanks for this suggestion @paulRbr.

Could we discuss sync about the strategy here, and the new process allowed by this cutom GitHub action?

- name: Comment pull request with API diff
uses: bump-sh/github-action@v1
with:
doc: apiplatform-test-demo
token: ${{secrets.BUMP_TOKEN}}
file: docs/openapi.json
file: api/openapi.json
Copy link
Member

Choose a reason for hiding this comment

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

is it possible to keep contract on same file docs/openapi.json ?

Copy link
Member

Choose a reason for hiding this comment

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

Or does it mean openapi contract is not persisted anymore (there is no file api/openapi.json with second commit)

options: -v ${{github.workspace}}/api:/srv/app -v /srv/app/vendor
run: |
composer require symfony/runtime
php bin/console api:openapi:export > openapi.json
Copy link
Member

Choose a reason for hiding this comment

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

is it possible to keep contract on same file docs/openapi.json ?

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.

2 participants