stoplightio / spectral-documentation

Teach Spectral how to help improve the quality of your OpenAPI-based documentation.
8 stars 4 forks source link

Should operation-operationId continue to exist? #7

Open philsturgeon opened 1 year ago

philsturgeon commented 1 year ago

Where should operation-operationId exist (if it should continue to exist anywhere) once spectral:oas goes away, because it is not actually required in the OpenAPI spec.

Context

This is the old rule in spectral:oas:

    "operation-operationId": {
      message: "Operation is missing an operationId.",
      severity: DiagnosticSeverity.Error,
      recommended: true,
      given: "#OperationObject",
      then: {
        field: "operationId",
        function: truthy,
      },
    },

Current Behavior

Currently Spectral with the default spectral:oas ruleset will tell everyone that operation must have an operationId, but OpenAPI v3.x doesn't say that at all.

Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.

Notice that there is no REQUIRED: at the start, like other required properties.

image

Expected Behavior

As operationId is optional I think it should be deleted from here, and added to spectral-documentation. Or... does it even need to be added to documentation?

Fundamentally, what does this add?

Possible Solution(s)

I am removing it from https://github.com/philsturgeon/spectral-openapi so that when spectral:oas is deprecated and people switch to that repo it will be gone.

Should I add the rule to Spectral Documentation, under the assumption that documentation tools use this for something useful, or should I just let it vanish in the spectral:oas to spectral-openapi migration?