Description
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:
paths:
/item:
post:
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
- photoUrls
properties:
id:
type: integer
format: int64
name:
type: string
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
This would enable scenario 1 via
actions:
- target: $.paths
update:
"/newitem": {}
- target: $.paths["/item"]
destination: $.paths["/newitem"]
remove: true
And scenario 2 via something similar.