Skip to content

No validation when combining objects with oneOf or anyOf #154

@cswilson90

Description

@cswilson90

Validation doesn't work for a schema which combines multiple objects with oneOf or anyOf.

const schema = {
  oneOf: [
   {
      properties: {
        foo: {
          type: 'string',
        },
      },
      required: ['foo'],
      type: 'object',
    },
    {
      properties: {
        bar: {
          type: 'string',
        },
      },
      required: ['bar'],
      type: 'object',
     },
  ],
};

Validating with this schema doesn't display any errors when the input doesn't match:

Image

json-schema-library does return an error but it's being ignored by the validation code because OneOfError is not in positionalErrors and the pointer only has keyFrom/keyTo and not valueFrom/valueTo.

Changing oneOf to anyOf in the schema has the same problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions