-
Notifications
You must be signed in to change notification settings - Fork 9
Request: Adding new configurable rule: operation-operationId-exclude-OPTIONS
#52
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
base: main
Are you sure you want to change the base?
Conversation
operation-operationId-exclude-OPTIONSoperation-operationId-exclude-OPTIONS
|
@nickcorby Thanks for the feedback and contribution! We will review it and merge as soon as possible, |
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.
Left a couple of suggestions. I hope they make sense.
|
|
||
| ## Code | ||
|
|
||
| > If you are using a ruleset that includes the `operation-operationId` rule (like `recommended`), you will need to disable this rule in order for the configurable rule to apply. |
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.
Technically, the configurable rule will be applied anyway, but it just doesn't make any sense to use both built-in and the configurable rule 🙂.
| > operation-operationId: off | ||
| > ``` | ||
|
|
||
| This rule is added to your `redocly.yaml` file: |
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.
| This rule is added to your `redocly.yaml` file: | |
| This rule is added to the `rules` section of your `redocly.yaml` file: |
| With the rule configured with `severity: error`, the following snippet of a `GET` operation will trigger this rule & display an error: | ||
|
|
||
| ```yaml | ||
| get: |
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.
Could you make your examples smaller just to contain the needed data to showcase the rule, and start from the root?
openapi: 3.2.0
paths:
/example:
get: ...| However, the following snippet of an `OPTIONS` operation **won't** trigger the rule: | ||
|
|
||
| ```yaml | ||
| options: |
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.
Perhaps you can combine the examples into one endpoint, but with different methods, and leave hints what's correct and what's wrong in summaries or descriptions.
As suggested by AlbinaBlazhko17, I've added a configurable rule to the cookbook to allow you to emulate the
operation-operationIdrule with the added capability of filtering by operation type (in this case,OPTIONS).Please let me know if anything needs to be tweaked, and thank you again for being so responsive & offering assistance! We're starting a new IaC project at work and Redocly CLI has been instrumental in defining our APIs. This is just one feature that has provided huge benefit for us.