Redocly / Redocly/redocly-cli

Rule no-invalid-media-type-examples not properly evaluated for types using allOf

Open
#952 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
Rule no-invalid-media-type-examples is not triggered for unevaluated properties for examples of allOf types.

To Reproduce
Steps to reproduce the behavior:

  1. Given this redocly.yaml configuration
lint:
  extends:
    - recommended
  1. And this (zipped) OpenAPI file: bikes.yaml.zip
  2. Run this command with these arguments... redocly lint bikes.yaml
  3. See linting output
    Only one warning is produced:
Example value must conform to the schema: must NOT have unevaluated properties 'unevaluatedProperty2'.

Expected behavior
Two warnings should be included in the linting output:

Example value must conform to the schema: must NOT have unevaluated properties 'unevaluatedProperty1'.
Example value must conform to the schema: must NOT have unevaluated properties 'unevaluatedProperty2'.

Redocly Version(s)
1.0.0-beta.112

Node.js Version(s)
v18.2.0

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 supplied bikes.yaml.zip example and the redocly.yaml configuration, then run redocly lint bikes.yaml to reproduce the single warning. Trace the no-invalid-media-type-examples rule while evaluating the allOf example, and verify completion when the lint output includes warnings for both unevaluatedProperty1 and unevaluatedProperty2.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.