Redocly / Redocly/redocly-cli

Support JSON-schema assertion in configurable rules

Open
#1,886 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

JSON Schema p2 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.

Some people maintain JSON schemas to validate some parts of OpenAPI. We don't have a way to use them.

Describe the solution you'd like

I would like to add support for json schema assertion for our configurable rules. It may look like this:

rule/info-metadata-check:
  subject:
    type: Info
    property: x-metadata
  message: Metadata should match the schema.
  assertions:
    json-schema:
      $ref: ./metadata-schema.json

Describe alternatives you've considered

Right now it is possible to achieve using custom assertions/rules via plugin: https://redocly.com/docs/cli/rules/configurable-rules#custom-function-example

Additional context

Reported in Write the Docs slack: https://writethedocs.slack.com/archives/C4EPE8332/p1738793608940479

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

The issue names no files or tests; start with the linked configurable-rules custom-function example and trace the assertion-handling entry point. Use the shown rule configuration to determine how a referenced JSON Schema should be loaded, applied, and reported, then add coverage demonstrating that the assertion works.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, typescript
Domain
api, tooling
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.