Repository navigation
refactor(ipa): CLOUDP-453872 defineRule collects results, generated Applies to docs #1564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <!--- NOTE: This file is generated, please see /scripts/generateRulesetReadme.js ---> | ||
|
|
||
| # IPA Validation Conditions | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add fixes description what business purpose this chapter serves before generated content
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added an intro before the generated content, and a "Why generate the docs" section to the PR description on what the generated docs are for. |
||
|
|
||
| A condition is a named, tested yes/no question about the part of the spec a rule is looking at, such as "is a singleton resource" or "is a 2xx response". Rules built with `defineRule` list the conditions they apply to, and the "Applies to" sections in the [rules README](./README.md) link here. Each entry says what the condition is evaluated on, gives examples that match and do not match (checked by the tests), and lists the rules that use it. To change where several rules apply, change the condition once. Conditions are defined in [rulesets/functions/utils/conditions](https://github.com/mongodb/openapi/tree/main/tools/spectral/ipa/rulesets/functions/utils/conditions); to add one, see [CONTRIBUTING.md](https://github.com/mongodb/openapi/blob/main/tools/spectral/ipa/CONTRIBUTING.md). Only conditions used by at least one rule are listed. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why we need this as separate md file. Can we append to existing docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered
rulesets/README.md, but kept it separate. That README is already ~1,800 lines, and the glossary is reference material that readers reach from an "Applies to" link rather than by reading top to bottom. On my local branch, with 71 of ~117 rules migrated, it is ~520 lines (34 conditions), which would be about a quarter of the README.CONTRIBUTING.mdis for rule authors, and this file is generated from the code. To make it findable,tools/spectral/README.mdnow links to it next to the ruleset docs. Happy to fold it into the rules README if you would still prefer that.