Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Breaking Change] Cross-Version Runtime Exception: Data does not match any schemas from 'oneOf' (AutoRest v2 -> v3) #7278

Open
mikekistler opened this issue Nov 14, 2023 · 5 comments
Assignees
Labels
Breaking Changes Improvements to Breaking Changes tooling Central-EngSys This issue is owned by the Engineering System team. Spec PR Tools Tooling that runs in azure-rest-api-specs repo.

Comments

@mikekistler
Copy link
Member

mikekistler commented Nov 14, 2023

The Breaking Changes check in PR 26672 failed with a runtime exception with "ERROR: Schema violation: Data does not match any schemas from 'oneOf'.

Pasted Graphic

The exception points to an "x-ms-example":

          "NameSpaceCreate": {
            "$ref": "./examples/NameSpaces/EHNamespaceFailover.json"
          }

for an operation with a 202 response that includes an "Azure-AsyncOperation" and a "location" response header. And the example included both of these headers:

  "responses": {
    "202": {
      "headers": {
        "azure-asyncoperation": "http://azure.async.operation/status",
        "location": "eastus"
      }
    }
  }

Through trial and error, I determined that the "location" header was causing the exception, and with a little more experimenting I found that the value had to be a URL. That makes sense, except that the OpenAPI only defined "location" as a "string". Strange!

Anyway, fixing the value of "location" in the example to be a valid URL fixed the runtime exception.

@github-actions github-actions bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 14, 2023
@kurtzeborn kurtzeborn added Spec PR Tools Tooling that runs in azure-rest-api-specs repo. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Nov 27, 2023
@kurtzeborn kurtzeborn added the Central-EngSys This issue is owned by the Engineering System team. label Nov 27, 2023
@konrad-jamrozik
Copy link
Contributor

@konrad-jamrozik
Copy link
Contributor

konrad-jamrozik commented Dec 7, 2023

More discussion of oneOf in this Teams thread

Key observation from Timothee Guerin about oneOf being unhelpful error message:

Mentioned earlier but with autorest v3 I migrated to a newer json schema which allows if then which gives a much better error
Like similar to what editor.swagger.io does

@mikekistler
Copy link
Member Author

@konrad-jamrozik
Copy link
Contributor

konrad-jamrozik commented Jan 30, 2024

Re the breaking change labelling issue in:

Mike wrote:

Approving breaking changes because #7278. Manual inspection of the diff shows no breaking changes.

Recall the failure was AutoRest error:

ERROR: Schema violation: No enum match for: operation-location

Per my comment here:

Key observation from Timothee Guerin about oneOf being unhelpful error message:

Mentioned earlier but with autorest v3 I migrated to a newer json schema which allows if then which >> gives a much better error
Like similar to what editor.swagger.io does

Because AutoRest invoked by openapi-diff failed, the downstream automation (in openapi-alps repo) that classifies breaking change failures didn't run. That downstream automation can quell the check if all the failures are benign. Basically, this kind of observed failure is imprecise and currently requires manual effort. We could work on updating to AutoRest v3, which hopefully would make the error better and would allow easier manual investigation and maybe even better automated determination what is the issue. But then we need to prioritize for it, and it is unclear how hard it would be to do the migration. It may impact what and when fails validation. We use AutoRest also in LintDiff, ModelValidation and SemanticValidation. If we don't update it there, this might lead to inconsistent behavior across checks.

Doc on AutoRest migration from v2 to v3:

@konrad-jamrozik konrad-jamrozik changed the title [Breaking Change] Cross-Version Runtime Exception: Data does not match any schemas from 'oneOf' [Breaking Change] Cross-Version Runtime Exception: Data does not match any schemas from 'oneOf' (AutoRest v2 -> v3) Feb 2, 2024
@konrad-jamrozik
Copy link
Contributor

konrad-jamrozik commented Mar 4, 2024

@konrad-jamrozik konrad-jamrozik added the Breaking Changes Improvements to Breaking Changes tooling label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Changes Improvements to Breaking Changes tooling Central-EngSys This issue is owned by the Engineering System team. Spec PR Tools Tooling that runs in azure-rest-api-specs repo.
Projects
Status: 📋 Backlog
Status: 📋 Backlog
Development

No branches or pull requests

3 participants