-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Swagger BreakingChange
Mike Harder edited this page Jul 22, 2025
·
2 revisions
If Swagger BreakingChange fails with AutoRest threw a runtime error, the root cause is likely a problem in your spec causing AutoRest to crash. To debug (all commands run from repo root):
-
Determine if the problem is "before" or "after" your PR (or both)
- Checkout the target branch of your PR (likely
mainorRPSaaSMaster) npm i- Run
@azure/oadagainst the copy of your spec in the target branch. Specify the same path twice, which should always pass unless AutoRest crashes.
$ npx @azure/oad compare \ specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/stable/2021-11-01/contoso.json \ specification/contosowidgetmanager/resource-manager/Microsoft.Contoso/stable/2021-11-01/contoso.json- If your spec is valid, this should return
"code":"NoVersionChange", since you are comparing the spec to itself. If your spec is invalid, this will fail withAutoRest threw a runtime error, and the stack trace should includepathproperties pointing to the error. For instance, here's a failure caused by example with a disallowed property:
code: 'OBJECT-ADDITIONAL-PROPERTIES' params: [ [Array] ] message: 'Additional properties not allowed: headers' path: '#/paths/~1executions/post/x-ms-examples/CodeExecution-Execute-Async-Running'- If
@azure/oad comparepassed on the copy of your spec in the target branch, repeat these steps on the copy of your spec in the source branch.
- Checkout the target branch of your PR (likely
-
If the problem is "before" your PR, open another PR dedicated to fixing just this problem. BreakingChanges may fail in this fixup PR, but should pass going forward.
-
If the problem is "after" your PR, just fix the problem in your PR.