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

Panic in all_mutually_exclusive -> resolve (circleci config schema) #679

Open
vpoverennov opened this issue Sep 29, 2024 · 1 comment
Open

Comments

@vpoverennov
Copy link

Hitting a panic in all_mutually_exclusive -> resolve util.rs:566

not yet implemented
stack backtrace:

   3: typify_impl::util::resolve
             at typify-impl\src\util.rs:566
   4: typify_impl::util::all_mutually_exclusive::closure$1

  20: typify_impl::util::all_mutually_exclusive
             at typify-impl\src\util.rs:51
  21: typify_impl::TypeSpace::convert_any_of
             at typify-impl\src\convert.rs:1397
  22: typify_impl::TypeSpace::convert_schema_object
             at typify-impl\src\convert.rs:498
  23: typify_impl::TypeSpace::convert_schema
             at typify-impl\src\convert.rs:37
  24: typify_impl::TypeSpace::convert_ref_type
             at typify-impl\src\lib.rs:594
  25: typify_impl::TypeSpace::add_ref_types_impl<alloc::vec::Vec<tuple$<enum2$<typify_impl::RefKey>,enum2$<schemars::schema::Schema> >,alloc::alloc::Global> >
             at typify-impl\src\lib.rs:565
  26: typify_impl::TypeSpace::add_root_schema

minimal repro:

{
  "definitions": {
    "a": {
      "description": "a"
    },
    "b": {
      "anyOf": [
        {
          "$ref": "#/definitions/a",
          "enum": ["A"]
        },
        {
          "$ref": "#/definitions/a",
          "enum": ["B"]
        }
      ]
    }
  }
}

extracted minimal repro from circleci json schema (src)

@ahl
Copy link
Collaborator

ahl commented Oct 8, 2024

First: 100% this is a bug in typify.

We've seen this sort of construction in a few other JSON schema (e.g. #299) and OpenAPI documents (a bit like oxidecomputer/progenitor#591). Rather than having a flat list of definitions, this schema groups them into categories:

$ pbpaste | jq '.definitions.builtinSteps | keys'
[
  "configuration",
  "documentation"
]
$ pbpaste | jq '.definitions.builtinSteps.configuration | keys'
[
  "add_ssh_keys",
  "attach_workspace",
  "checkout",
  "deploy",
  "persist_to_workspace",
  "restore_cache",
  "run",
  "save_cache",
  "setup_remote_docker",
  "store_artifacts",
  "store_test_results",
  "unless",
  "when"
]
$ pbpaste | jq '.definitions.builtinSteps.documentation | keys'
[
  "add_ssh_keys",
  "attach_workspace",
  "checkout",
  "deploy",
  "persist_to_workspace",
  "restore_cache",
  "run",
  "save_cache",
  "setup_remote_docker",
  "store_artifacts",
  "store_test_results",
  "unless",
  "when"
]

Unforunately there isn't a simple workaround; see #579.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants