-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add a new overlay
command to be able to apply OpenAPI overlays on given API document
#553
Conversation
Can we pop in a Thanks section on the README and put Lorna Mitchel on there? We've done this for Spectral, Prism, and I recommend it for any tool which has substantial contribution from a single contributor, like this. |
1bed61c
to
5715cd8
Compare
overlay
command to be able to apply OpenAPI overlays on given API documentoverlay
command to be able to apply OpenAPI overlays on given API document
4e2a7bd
to
017aab0
Compare
7e732e3
to
5d1408e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a great one! I cant wait to release it, and allow our users to start using OpenAPI overlays.
I asked a few questions, nothing blocking here. I let you answer them, and will do another pass then.
Thanks, @paulRbr <3
src/core/overlay.ts
Outdated
// WIP @github.com/lornajane/openapi-overlays-js | ||
// | ||
// I couldn't get the upstream lib to be imported properly due to | ||
// some issues with ESM module imports so this is method was copied | ||
// from github.com/lornajane/openapi-overlays-js and has been | ||
// adapted to make our Typescript build happy. | ||
// | ||
// If you make any changes here, PLEASE ALSO MAKE THEM UPSTREAM. | ||
applyOverlay(spec: APIDefinition, overlay: OpenAPIOverlay): APIDefinition { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feel like this method could be a bit enhanced by extracting smaller methods, having a case to split the different actions, etc...
It can be done later, but I think it would be a great idea to make it a bit clearer. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point here was to stay as close as possible from the original code @github.com/lornajane/openapi-overlays-js. The code will soon be available as a library and we will be able to build a common ground in a dedicated package which will remove this code from our CLI.
I'd prefer to keep it as is for now, if you don't mind?
5d1408e
to
82295e0
Compare
@scharrier following your review, I've moved things around to make it clearer (I think). Basically all the “command” related feature is in the new I think it makes more sense like this. Let me know if it suits you! |
82295e0
to
aaaf612
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have something that we can release, here! 👏
I left a few questions/feedback, I let you decide on how to handle them.
aaaf612
to
8b671ea
Compare
This is a work in progress.. but I have troubles to import the lib from https://github.com/lornajane/openapi-overlays-js and I don't understand why 🤯
This commit adds an optional `--overlay` command to the existing command `bump deploy` to be ably to apply an overlay on the target API document before deploying. This parameter only works for a single file deploy (not compatible with a DIRECTORY + hub deploy)
This commit adds a case where the overlay is targetting objects with a condition on the object (here objects where `x-beta: true` is set).
8b671ea
to
d0f3a7c
Compare
Together with the guide written by Phil on OpenAPI overlays, we thought it would be a good idea to release a new
bump overlay
command in the CLI in order to test the new OpenAPI Overlay specification.This WIP change is based on @lornajane's work on overlays with a few changes here and there.
I've published the resulting built package from this branch as a beta version on npmjs registry so you can test a beta version of Bump CLI installable with:
Example usage
Note: the input API document file name is used to detect the target output overlayed document (Json or Yaml)
--out
argument