Skip to content

Compile Schema not resolving all anyOf/oneOf refs #3961

@cwendtxealth

Description

@cwendtxealth

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

When compiling a schema that uses an anyOf/oneOf schema the resolveAllReferences function util won't fully resolve all refs if the same ref is used multiple times in one schema object. For example

{
  type: 'object',
  anyOf: [{
    type: 'object',
    properties: {
      test1: {
        $ref: '#/definitions/testref'
      },
      test2: {
        $ref: '#/definitions/testref'
      }
    }
  }],
  definitions: {
    testref: {
      type: 'string'
    }
  }
}

resolveAllReferences will resolve the first ref but then because it has already resolved the first it will ignore the second leading to errors in compiled schema.

Expected Behavior

No response

Steps To Reproduce

No response

Environment

- OS:
- Node:
- npm:

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions