Skip to content

Commit

Permalink
Merge pull request bump-sh#553 from bump-sh/overlay-testing
Browse files Browse the repository at this point in the history
Add a new `overlay` command to be able to apply OpenAPI overlays on given API document
  • Loading branch information
paulRbr authored Mar 18, 2024
2 parents 4292b5f + d0f3a7c commit ca88767
Show file tree
Hide file tree
Showing 16 changed files with 847 additions and 111 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ We currently support [OpenAPI](https://github.com/OAI/OpenAPI-Specification) fro

Bug reports and pull requests are welcome on GitHub at <https://github.com/bump-sh/cli>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## Thanks

- [Lorna Mitchel](https://github.com/lornajane/) for [openapi-overlay-js](https://github.com/lornajane/openapi-overlays-js)

## License

The Bump CLI project is released under the [MIT License](http://opensource.org/licenses/MIT).
Expand Down
4 changes: 4 additions & 0 deletions examples/valid/openapi.v3.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@
"description": "Sentence about ping and pong",
"example": "And that's how ping-pong ball is bumped",
"type": "string"
},
"ping": {
"type": "string",
"x-beta": true
}
}
},
Expand Down
36 changes: 36 additions & 0 deletions examples/valid/overlay.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
overlay: 1.0.0
info:
title: Overlay to customise API for Protect Earth
version: 0.0.1
actions:
- target: '$.info.description'
description: Provide a better introduction for our end users than this techno babble.
update: |
Protect Earth's Tree Tracker API will let you see what we've been planting and restoring all
around the UK, and help support our work by directly funding the trees we plant or the sites
we restore.
To get involved [contact us and ask for an access token](https://protect.earth/contact) then
[check out the API documentation](https://protect.earth/api).
- target: '$.info'
description: Let's have the public contact general support instead of whoever happened to release this API.
update:
contact:
name: Protect Earth Support
url: https://protect.earth/contact
email: [email protected]

- target: '$.servers.*'
description: Remove all other servers so we can add our own.
remove: true

- target: '$..[?(@["x-beta"]==true)]'
description: Remove all beta operations
remove: true

- target: '$.servers'
description: Pop our server into the empty server array.
update:
- description: Production
url: https://api.protect.earth/
Loading

0 comments on commit ca88767

Please sign in to comment.