Skip to content

Conversation

@nickcorby
Copy link

As suggested by AlbinaBlazhko17, I've added a configurable rule to the cookbook to allow you to emulate the operation-operationId rule 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.

@nickcorby nickcorby changed the title Request: Adding new configural rule: operation-operationId-exclude-OPTIONS Request: Adding new configurable rule: operation-operationId-exclude-OPTIONS Oct 23, 2025
@AlbinaBlazhko17
Copy link

@nickcorby Thanks for the feedback and contribution! We will review it and merge as soon as possible,

Copy link
Contributor

@tatomyr tatomyr left a 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.
Copy link
Contributor

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:
Copy link
Contributor

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:
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants