Redocly / Redocly/redocly-cli

Add support for allOf to the discriminator

Open
#994 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

p3 Type: Enhancement
Dominant language
TypeScript
Stars
1.5k
Forks
228
Avg merge
1d 14h
Merged PRs (30d)
48

Description

Is your feature request related to a problem? Please describe.

Currently Redocly CLI doesn't validate the no-invalid-media-type-examples rule when a schema uses allOf in discriminator.

Describe the solution you'd like

Add support to the allOf in discriminator (most likely on the ajv side).
Describe alternatives you've considered

Explicitly prohibit using allOf in discriminator.
Additional context

We had a similar issue before: https://github.com/Redocly/redocly-cli/issues/700

Also a related conversation: https://redoc-ly.slack.com/archives/C04HZU8SZR7/p1674039829587489

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the no-invalid-media-type-examples rule and the linked Redocly/ajv dependency, then trace how discriminator schemas are handled. Reproduce validation for a discriminator using allOf and verify that valid media-type examples pass while invalid examples still fail.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.