Skip to content

Respect doesn't resolve complex constraint pattern #2639

@AlbinaBlazhko17

Description

@AlbinaBlazhko17

Describe the bug
AJV validation error when using a discriminator with a schema property that uses allOf + not pattern instead of explicit enum values. The discriminator expects the mapped schema's discriminator property to have const or enum, but the AlternativeInstrument schema uses a more complex constraint pattern.

‼️ Error: Ajv error: discriminator: "properties/method" must have "const" or "enum"

To Reproduce

  1. Given the openapi.yaml file with the AlternativeInstrument schema that uses allOf + not:
AlternativeInstrument:
  properties:
    method:
      allOf:
        - $ref: '#/components/schemas/AlternativePaymentMethods'
        - not:
            enum:
              - payment-card
              - paypal
              - ach
  1. And the openapi.arazzo.yaml workflow file
  2. Run: redocly respect openapi.arazzo.yaml
  3. See the error: Ajv error: discriminator: "properties/method" must have "const" or "enum"

Expected behavior
The schema should br validated successfully.

Logs

Workflow name: test-cash-payment
 
  stepId - create-cash-instrument 
  ✗ schema check 
     Ajv error: discriminator: "properties/method" must have "const" or "enum"

OpenAPI description

Redocly version(s)
2.20.4

Node.js version(s)
v24

OS, environment
macOs

Additional context
If we use directly enum without allOf + not pattern everything works as expected.

complex-schema-repro.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    JSON SchemaRespectRelated to the `respect` command which works with Arazzo specificationType: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions