-
Notifications
You must be signed in to change notification settings - Fork 100
docs: adds an upgrade guide for overlay 1.1 #169
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
180fd7c
docs: adds an upgrade guide for overlay 1.1
baywet 84281e2
docs: better example for RFC9535 compliance
baywet 82425b6
docs: expands the non compliant examples.
baywet 4ccafb5
Update upgrading/overlay-v1.0-to-v1.1.md
baywet 30b21dd
Update upgrading/overlay-v1.0-to-v1.1.md
baywet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| --- | ||
| layout: default | ||
| title: Overlay - Upgrading Between Versions 1.0 and 1.1 | ||
| parent: Upgrading Between Versions | ||
| nav_order: 1 | ||
| --- | ||
|
|
||
| # Overlay - Upgrading Between Versions 1.0 and 1.1 | ||
|
|
||
| Overlay 1.1 adds powerful new copy features, and upgrading from 1.0 is as simple as updating the version number. This guide walks you through that quick transition. | ||
|
|
||
| ## Getting started | ||
|
|
||
| Begin by updating the version number in your Overlay document. Locate this line in your JSON or YAML file: | ||
|
|
||
| ```yaml | ||
| overlay: 1.0.0 | ||
| ``` | ||
|
|
||
| Update it to: | ||
|
|
||
| ```yaml | ||
| overlay: 1.1.0 | ||
| ``` | ||
|
|
||
| ## Copy elements from the OpenAPI document | ||
|
|
||
| The following example illustrates how you can now use the copy action to update a target node with a value from the document being processed. Saving you from having duplicate definitions in your overlay document. | ||
|
|
||
| ```yaml | ||
| overlay: 1.0.0 | ||
| info: | ||
| title: Copy a schema component | ||
| version: 1.1.0 | ||
| actions: | ||
| - target: '$.components.schemas' | ||
| description: Ensure the target schema is present | ||
| update: | ||
| Bar: {} | ||
| - target: '$.components.schemas['Bar']' | ||
| copy: '$.components.schemas['Foo']' | ||
| description: Copy the Foo Schema to Bar | ||
| ``` | ||
|
|
||
| ## Name the file according to the convention for better tooling integration | ||
|
|
||
| You might want to rename your overlay documents to end with `.overlay.yaml|json` to get better integration with tooling. | ||
|
|
||
| ## Ensure your JSONPath are RFC 9535 for better interoperability | ||
|
|
||
| ### Missing square brackets around property names | ||
|
|
||
| This example JSONPath query expression, which filters path items based on an OpenAPI extension property: | ||
|
|
||
| ```jsonpath | ||
| $.paths.*.get[?(@.x-oai-traits[?(@ == 'paged')])] | ||
| ``` | ||
|
|
||
| Should in fact be: | ||
|
|
||
| ```jsonpath | ||
| $.paths.*.get[?(@['x-oai-traits'][?(@ == 'paged')])] | ||
| ``` | ||
|
|
||
| Because square brackets are required for property selection. | ||
|
|
||
| ### Use of the undefined `in` keyword | ||
|
|
||
| This example JSONPath query expression, which selects tags matching *Enterprise-Only*: | ||
|
|
||
| ```jsonpath | ||
| $.paths..[?('Enterprise-Only' in @.tags)] | ||
| ``` | ||
|
|
||
| Should instead be: | ||
|
|
||
| ```jsonpath | ||
| $.paths..[?(@.tags[?(@ == 'Enterprise-Only')])] | ||
| ``` | ||
|
|
||
| Since the `in` keyword is undefined in the RFC. | ||
|
|
||
| ## Removing/Updating primitive values is now fully supported | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When did we add this feature and do the tools support it?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this PR OAI/Overlay-Specification#225 |
||
|
|
||
| ```yaml | ||
| overlay: 1.1.0 | ||
| info: | ||
| title: Targeted Overlay | ||
| version: 1.0.0 | ||
| actions: | ||
| - target: $.paths['/foo'].get.description | ||
| update: This is the new description | ||
| - target: $.paths['/bar'].get.description | ||
| update: This is the updated description | ||
| ``` | ||
|
|
||
| Before it used to require updating the parent object. | ||
|
|
||
| ## Add a description to your overlay document | ||
baywet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| The Overlay information section now supports a new description field. Adding a detailed description to your overlay documents is a great way to convey the purpose and nature of your documents. | ||
|
|
||
| ```yaml | ||
| overlay: 1.1.0 | ||
| info: | ||
| title: Overlay with description | ||
| version: 1.0.0 | ||
| description: This overlay document has a long description thanks to the new field. | ||
| actions: [] | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Let's not include the optional features in the upgrade guide. Signpost the docs by all means, but let's put the actual upgrading things in this document (or at least, make it clear that these are optional steps and put them later in the document). Many users will not need this feature but may want to upgrade.
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 believe the main appeal of upgrading is to use the copy feature. Yes we have additional minor improvements in this new version, and some required "technical upgrades" that I suspect will only impact very few users.
May I suggest dividing this document in two sections: the required upgrade steps, i.e. things won't works in 1.1 if you don't take these steps. And the optional steps, those are things you want to consider as you've upgraded to v1.1 (copy, info description, etc...)
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.
Actually, I just remember something. I used the upgrade guide for OpenAPI from v3.1 to v3.2 as an inspiration to write this one.
It's FULL of optional upgrades (like using the new query operation for instance) that people might want to consider and benefit from, but that are not strictly required to get a document compliant with the 3.2.0 spec.
So I'm not sure why this upgrade guide, which will "sit" right next to the OpenAPI one, should be any different in terms of content?