RSC · API Governance Rules

RSC API Rules

Spectral linting rules defining API design standards and conventions for RSC.

18 Rules error 2 warn 14 info 2
View Rules File View on GitHub

Rule Categories

no operation path query rsc schema security servers

Rules

warn
rsc-operation-ids-camel-case
All operationIds must use camelCase naming convention.
$.paths.*[get,post,put,patch,delete].operationId
warn
rsc-tags-title-case
All tags must use Title Case.
$.tags[*].name
warn
rsc-api-key-auth
All operations must use apiKeyAuth security unless explicitly public.
$.paths.*[get,post,put,patch,delete]
warn
rsc-request-body-json
POST request bodies must use application/json content type.
$.paths.*.post.requestBody.content
info
rsc-filter-endpoints-return-query-id
Filter endpoints should return a queryId for async polling.
$.paths['/filter/*'].post.responses.200.content.application/json.schema
warn
rsc-paths-kebab-case
All path segments must use kebab-case.
$.paths
error
rsc-response-200-defined
All operations must define a 200 response.
$.paths.*[get,post,put,patch,delete].responses
warn
rsc-401-defined-for-secured
Secured operations should define a 401 response.
$.paths.*[get,post].responses
error
servers-https-only
Server URLs must use HTTPS.
$.servers[*].url
warn
servers-expected-domain
Server URLs should be on the rsc.org domain.
$.servers[*].url
warn
path-params-casing
Path parameters should be camelCase (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
warn
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be camelCase (the dominant convention in this API).
$.components.schemas[*].properties
warn
security-schemes-defined
Security schemes should be defined in components.
$.components
warn
operation-security-required
Every operation should declare its security requirements.
$.paths[*][get,post,put,patch,delete]
warn
operation-documents-401
Operations should document a 401 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# rsc — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-https-only: 100% of servers already https (error)
#   - servers-expected-domain: 1/1 servers on rsc.org
#   - path-params-casing: camel @ 100% (n=6)
#   - query-params-casing: snake @ 75% (n=4)
#   - operationid-casing: camel @ 100% (n=16)
#   - schema-names-casing: pascal @ 100% (n=5)
#   - schema-properties-casing: camel @ 67% (n=24)
#   - operation-security-required: 16/16 ops declare per-op security
#   - operation-documents-401: 100% adherence
#   - pagination params observed: ['count']
#   - merge: kept 8 existing, added 10 measured, upgraded 0
#   - added: servers-https-only, servers-expected-domain, path-params-casing, query-params-casing, schema-names-casing, schema-properties-casing, security-schemes-defined, operation-security-required, operation-documents-401, no-empty-descriptions
extends:
  - spectral:oas
rules:
  rsc-operation-ids-camel-case:
    description: All operationIds must use camelCase naming convention.
    severity: warn
    given: $.paths.*[get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  rsc-tags-title-case:
    description: All tags must use Title Case.
    severity: warn
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z][a-zA-Z0-9 ]*$
  rsc-api-key-auth:
    description: All operations must use apiKeyAuth security unless explicitly public.
    severity: warn
    given: $.paths.*[get,post,put,patch,delete]
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            security:
              type: array
          required:
          - security
  rsc-request-body-json:
    description: POST request bodies must use application/json content type.
    severity: warn
    given: $.paths.*.post.requestBody.content
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            application/json:
              type: object
  rsc-filter-endpoints-return-query-id:
    description: Filter endpoints should return a queryId for async polling.
    severity: info
    given: $.paths['/filter/*'].post.responses.200.content.application/json.schema
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            queryId:
              type: string
  rsc-paths-kebab-case:
    description: All path segments must use kebab-case.
    severity: warn
    given: $.paths
    then:
      function: pattern
      functionOptions:
        match: ^(/[a-z0-9{}-]+)+$
  rsc-response-200-defined:
    description: All operations must define a 200 response.
    severity: error
    given: $.paths.*[get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          required:
          - '200'
  rsc-401-defined-for-secured:
    description: Secured operations should define a 401 response.
    severity: warn
    given: $.paths.*[get,post].responses
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            '401':
              type: object
  servers-https-only:
    description: Server URLs must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  servers-expected-domain:
    description: Server URLs should be on the rsc.org domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: rsc\.org
  path-params-casing:
    description: Path parameters should be camelCase (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: camel
  query-params-casing:
    description: Query parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: snake
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: pascal
  schema-properties-casing:
    description: Schema properties should be camelCase (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: camel
  security-schemes-defined:
    description: Security schemes should be defined in components.
    severity: warn
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  operation-security-required:
    description: Every operation should declare its security requirements.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: security
      function: truthy
  operation-documents-401:
    description: Operations should document a 401 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy