Add a new overlay command to be able to apply OpenAPI overlays on given API document#553
Add a new overlay command to be able to apply OpenAPI overlays on given API document#553
overlay command to be able to apply OpenAPI overlays on given API document#553Conversation
|
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
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.
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.
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
scharrier
left a comment
There was a problem hiding this comment.
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 overlaycommand 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)
--outargument