Redocly / Redocly/redocly-cli

Introduce the `description` field in the rules

Open
#1,283 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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.

It's good to keep the docs together with the code. However, currently, built-in rules are authored separately from the corresponding documentation.

Another common problem is that a rule can be unclear (requires a more detailed explanation).

Describe the solution you'd like

It might be helpful to introduce a description field (similar to what we have in OAS) that would explain the intention of the rule or provide some examples of using it. The descriptions themselves should utilize the markdown/markdoc format.

Also, we need to implement a way of creating docs from the descriptions.

This will help to keep the docs and the code in sync as we can generate the actual documentation out of the descriptions.

We can also show an extended hint of a rule in an editor extension.

Consider this example of a Redocly config:

rules:
  rule/something:
    ...
    description: |
       Some description to explain what the rule does (like examples).

For build-in rules, it should be predefined but with a possibility to override the existing one, e.g.:

rules:
  info-license: 
    severity: error
    description: A custom description that explains why we need this field and maybe a link to a list of the possible licences.

I'm not clear, however, if it'd be better to reference the existing .md files from the code or actually move the descriptions into the code.

@adamaltman please add anything I missed here.

Describe alternatives you've considered

We may continue writing the rules and the docs separately.

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

No files, tests, or entry points are named in the issue. First clarify whether descriptions should live in rule code or reference existing Markdown files, then identify the rule definitions and documentation-generation entry points; done means built-in and user-defined descriptions, overrides, and generated documentation are specified and tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, typescript
Domain
documentation, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.