DEV Community

suin
suin

Posted on

4 1

Spectral: Rules for checking if an operationId is a camelCase

This rule checks if operationId is camelCase in spectral.

extends: spectral:oas
aliases:
  PathItem:
    - $.paths[*]
  OperationObject:
    - "#PathItem[get,put,post,delete,options,head,patch,trace]"
rules:
  operation-id-camel-case:
    description: Operation IDs must be camelCase since some generators (e.g. RTK Query) don't support kebab-cases.
    message: "Operation ID \"{{value}}\" must be camelCase since some generators (e.g. RTK Query) don't support kebab-cases."
    given: "#OperationObject"
    severity: error
    then:
      field: operationId
      function: casing
      functionOptions:
        type: camel
Enter fullscreen mode Exit fullscreen mode

Example of detecting errors:

Image description

Billboard image

Synthetic monitoring. Built for developers.

Join Vercel, Render, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (0)

Bump.sh

Bump.sh is much more than stunning documentations for all your APIs.

Automatically generate docs that are always up-to-date with CI integrations.
Get alerted on breaking API changes and enjoy the generated diff on each version.

Centralize all your API docs, whether they’re public, private or partner, whether they’re OpenAPI or AsyncAPI, and whether you’re building or consuming it.

Discover Bump.sh

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay