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

BREAKING: hoisted resources out of data: #11

Merged
merged 5 commits into from
Mar 6, 2024

Conversation

philsturgeon
Copy link
Collaborator

@philsturgeon philsturgeon commented Mar 6, 2024

Got rid of the { data: {} } wrapper on resources (request and response), but left it for collections.

Also added a license, and added GET and DELETE for booking resources.

Copy link

github-actions bot commented Mar 6, 2024

🚨 Breaking API change detected:

Added (2)

  • DELETE /bookings/{bookingId}
  • GET /bookings/{bookingId}

Modified (3)

  • POST /bookings
    • Content type modified: application/json
      • [Breaking] Attribute removed: data
        • Removing a resource is always breaking unless it was deprecated before [Breaking]
      • Attributes added: trip_id, passenger_name, has_bicycle, has_dog
    • Content type modified: application/xml
      • [Breaking] Attribute removed: data
        • Removing a resource is always breaking unless it was deprecated before [Breaking]
      • Attributes added: trip_id, passenger_name, has_bicycle, has_dog
    • Response modified: 201
      • Content type modified: application/json
        • [Breaking] Attribute removed: data
          • Removing a resource is always breaking unless it was deprecated before [Breaking]
        • Attributes added: id, trip_id, passenger_name, has_bicycle, has_dog
      • Content type modified: application/xml
        • [Breaking] Attribute removed: data
          • Removing a resource is always breaking unless it was deprecated before [Breaking]
        • Attributes added: id, trip_id, passenger_name, has_bicycle, has_dog
  • POST /bookings/{bookingId}/payment
    • Content type modified: application/json
      • [Breaking] Attribute removed: data
        • Removing a resource is always breaking unless it was deprecated before [Breaking]
      • Attributes added: amount, currency, source
    • Response modified: 200
      • Content type modified: application/json
        • [Breaking] Attribute removed: data
          • Removing a resource is always breaking unless it was deprecated before [Breaking]
        • Attributes added: id, amount, currency, source, status
  • Webhook POST newBooking
    • Content type modified: application/json
      • [Breaking] Attribute removed: data
        • Removing a resource is always breaking unless it was deprecated before [Breaking]
      • Attributes added: trip_id, passenger_name, has_bicycle, has_dog

Preview documentation

Powered by Bump.sh

Copy link

@scharrier scharrier left a comment

Choose a reason for hiding this comment

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

LGTM, besides a question about the licence. You can either merge without this licence change, or wait for Paulr's answer here!

Thanks for doing this change 👍

openapi.yaml Outdated Show resolved Hide resolved
openapi.yaml Show resolved Hide resolved
Comment on lines 6 to 8
push:
branches:
- main
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do you remove the workflow from the push on main branch. It's still needed when we merge in a PR into main branch, to deploy the API document to Bump.sh :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

With the current setup it was doing all checks twice, and as well as looking untidy there's a carbon footprint to doing everything twice. If you can help me get this right I'd appreciate it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's kind of doing checks twice.

However, running workflows on the HEAD of a pull request is slightly different than running workflows on the HEAD of the target branch (here always main).

That's because the merged PR can have difference with the head of the PR (if there's changes on the main while the PR is being developed)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't mean "doing it twice" like once in the PR and once again on main.

I mean it was literally doing it twice on the PR. This happens when you do a first push because both the push event and the pull_request event are triggered, so its literally running all the checks simultaniously twice, once for push and once for pull_request.

This is a documented thing, and its wasting compute resources: https://github.com/orgs/community/discussions/26940

I've reverted the change here, but I would like to not only fix it in this repo, but in the sample Bump.sh workflow in documentation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm 🤔, I can't see any duplicate jobs on the commits of the HEAD of this PR:

bc97140
Capture d’écran du 2024-03-06 19-38-43

There's only:

  • one Lint job (the second check --> Linter OPENAPI is a created in the Lint job by the super-linter gh action)
  • only one Check API diff job.

The description of the push target in the GH action workflow file:

on:
  push:
    - main

Means it will only trigger a workflow on push on the main branch (so not on pushed on any other branches, i.e. pull request branches):

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The first push will have two lots of checks as you've opened a pull request.

The second push will have only one lot of checks because the pull request is old now.

I'll take a screenshot next time this happens.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no reason for a duplicate job with the current workflow definition file, sorry to insist!

Here's a demo with a newly created PR with a single push on that PR branch: #13

There's a single Lint workflow and a single Check & Deploy API documentation workflow` running on the repository:
Capture d’écran du 2024-03-06 20-15-35

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I saw the duplicates. I saw two of everything. I should have taken a screenshot, but I will do next time it happens.

.github/workflows/lint.yml Outdated Show resolved Hide resolved
.github/workflows/lint.yml Outdated Show resolved Hide resolved
@philsturgeon philsturgeon merged commit b0c1471 into main Mar 6, 2024
4 checks passed
@philsturgeon philsturgeon deleted the feat/add-get-delete-booking branch March 6, 2024 18:27
@paulRbr
Copy link
Collaborator

paulRbr commented Mar 6, 2024

Thanks for the changes 🙏

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.

3 participants