You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Actions Object has the ability to enable users to add/mutate/remove attributes on OpenAPI documents, but cannot handle the following scenarios:
Renaming paths items
I.e. given a path on $.paths["/item"], move it to `$.paths["/newitem"]:
From
paths:
/item:
summary: 'The root resource'
get:
summary: 'Retrieve the root resource'
...
To:
paths:
/newitem:
summary: 'The root resource'
get:
summary: 'Retrieve the root resource'
...
Doing this via a full add/remove of the /item requires inlining the schema into the overlay, and thus makes it brittle: any overlay which overrides a path item in this way effectively nukes the ability for a source document to change any of the information in "/item".
Extracting inline schemas into component schemas
Many OpenAPI frameworks produce inline json schemas for operations:
Enabling an overlay to extract that inline schema and replace it with $ref: #/components/schemas/Item would enable a category of simplifications for downstream tooling.
Proposed change to the Actions Object
Fixed Fields
Field Name
Type
Description
target
string
REQUIRED A JSONPath expression selecting nodes in the target document.
description
string
A description of the action. [[CommonMark]] syntax MAY be used for rich text representation.
update
Any
If the target selects an object node, the value of this field MUST be an object with the properties and values to merge with the selected node. If the target selects an array, the value of this field MUST be an entry to append to the array.
remove
boolean
A boolean value that indicates that the target object or array MUST be removed from the the map or array it is contained in. The default value is false.
destination
string
A JSONPath expression selecting destination nodes in the target document. If set, this indicates that each node in the target expression (after applying the update) should be appended as a child to the destination node. If not set, the target is mutated in-place.
This is a good use case! I think there might also be a wider consideration here about how to use parts of the OpenAPI description (in its current state at the time the action runs) as inputs to actions.
Another similar use case to 1. (but with dynamic destination based on the target) would be to duplicate content entries for requestBody or responses. Consider an API that wants to support both JSON and YAML (input and/or output), currently we have to do:
The Actions Object has the ability to enable users to add/mutate/remove attributes on OpenAPI documents, but cannot handle the following scenarios:
paths
itemsI.e. given a path on
$.paths["/item"]
, move it to `$.paths["/newitem"]:From
To:
Doing this via a full add/remove of the
/item
requires inlining the schema into the overlay, and thus makes it brittle: any overlay which overrides a path item in this way effectively nukes the ability for a source document to change any of the information in "/item".Many OpenAPI frameworks produce inline json schemas for operations:
Enabling an overlay to extract that inline schema and replace it with
$ref: #/components/schemas/Item
would enable a category of simplifications for downstream tooling.Proposed change to the Actions Object
Fixed Fields
string
string
target
selects an object node, the value of this field MUST be an object with the properties and values to merge with the selected node. If thetarget
selects an array, the value of this field MUST be an entry to append to the array.boolean
false
.string
This would enable scenario 1 via
And scenario 2 via something similar.
The text was updated successfully, but these errors were encountered: