oasdiff
oasdiff copied to clipboard
Add custom attributes to changelog entries basing on OpenAPI extension tags
In our OpenAPI specs we use a number of custom vendor extension tags which are set at the level of operation. These are additional classifiers which help to group APIs one or another way.
Today oasdiff creates a changelog in JSON format and has "operation", "operationId" and "path" for each item. My request is also support adding extra attributes basing on x-tags defined in original OpenAPI spec. For example, I can have "x-audience: Public" defined in the spec at operation level. Would be nice to have a config option which instructs oasdiff to copy certain xtags as attributes into resulting changelog JSON entry.
The rationale behind it is the following. We render changelog JSON as HTML table. So having extra columns which allows to quickly filter or sort basing on original classifiers from OpenAPI spec would help to analyze large changelogs.
Example: OpenAPI fragment (YaML):
"/restapi/oauth/token":
post:
operationId: getToken
x-audience: Public
summary: ...
requestBody:
...
responses:
...
Changelog fragment:
[ {
"id":"new-optional-request-property",
"text":"added the new optional request property ivr_pin'",
"level":1,
"operation":"POST",
"operationId":"getToken",
"path":"/restapi/oauth/token",
"source":"new-openapi.yml",
"x-audience": "Public"
}]
Another helpful improvement would be detecting changes in these custom OpenAPI tags defined at operation level (simplest). So in the example above, oasdiff could detect if "x-audience" is changed from "Private" to "Public".