Swagger: Patch API
swagger_patch_apiApply targeted search/replace edits to YAML OpenAPI/AsyncAPI definitions in SwaggerHub Registry to fix specific issues; nothing is saved unless every edit applies.
Instructions
Apply targeted search/replace edits to a YAML API definition in SwaggerHub Registry. Only OpenAPI and AsyncAPI definitions are supported. Each edit's 'oldString' must be copied exactly from swagger_get_api_definition with format:'text' and without 'resolved' or 'flatten' — those options transform the definition, so edits based on them will not match the stored source. JSON definitions are not supported. Nothing is saved unless every edit applies — failed edits are returned with 'no_match' or 'ambiguous' status. When 'newVersion' is given the patched definition is saved as a new private version; patching in place keeps the visibility of the existing version. Use this tool to fix specific issues in an existing API without regenerating the whole definition.
Toolset: Registry API
Parameters:
owner (string) required: API owner (organization or user, case-sensitive)
apiName (string) required: API name (case-sensitive)
version (string) required: Version of the definition to patch (base version, e.g. '1.0.0')
newVersion (string): Version to save the patched definition as (e.g. '1.0.1'). Must not already exist and is always created as private. Omit to overwrite the base version, which keeps its current visibility. The definition's info.version is updated automatically — do not add an edit for it.
edits (array) required: Search/replace edits applied sequentially to the YAML definition. Nothing is saved unless every edit applies (atomic).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| edits | Yes | Search/replace edits applied sequentially to the YAML definition. Nothing is saved unless every edit applies (atomic). | |
| owner | Yes | API owner (organization or user, case-sensitive) | |
| apiName | Yes | API name (case-sensitive) | |
| version | Yes | Version of the definition to patch (base version, e.g. '1.0.0') | |
| newVersion | No | Version to save the patched definition as (e.g. '1.0.1'). Must not already exist and is always created as private. Omit to overwrite the base version, which keeps its current visibility. The definition's info.version is updated automatically — do not add an edit for it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | ||
| saved | No | ||
| failed | No | Only present when at least one edit failed | |
| version | No | ||
| operation | No |