The patch file should be in the JSON Patch format, although I plan on adding some operations that are specific to JSON:API to make it easier to patch docs.



Fetching patched docs programmatically

You can programmatically get patched results by fetching the /patch endpoint with ?doc and ?patch query string parameters.

For example:

fetch(`https://openapi-patcher.vercel.app/patch?${
  new URLSearchParams({
    doc: "https://someapi.com/docs.json",
    patch: "https://gist.githubusercontent.com/username/gist/raw/patch.json",
  })
}`)

You can also send the data as a POST or PUT request with the request body consisting of the inline JSON patches.

fetch(`https://openapi-patcher.vercel.app/patch?${
  new URLSearchParams({ doc: "https://someapi.com/docs.json" })
}`, {
  method: 'put',
  body: `[{"op": "replace", "path": "/host", "value": "patched host name" }]`
})

Source code is available here.