Spring Framework · API Governance Rules

Spring Framework API Rules

Spectral linting rules defining API design standards and conventions for Spring Framework.

6 Rules error 2 warn 3 info 1
View Rules File View on GitHub

Rule Categories

spring

Rules

error
spring-framework-operation-id-required
All operations must have a unique operationId
$.paths[*][get,post,put,patch,delete]
warn
spring-framework-tags-required
All operations must have tags
$.paths[*][get,post,put,patch,delete]
warn
spring-framework-summary-title-case
Operation summaries must use Title Case
$.paths[*][*].summary
warn
spring-framework-api-versioning
Servers should define a base URL
$
error
spring-framework-response-200
GET operations should have a 200 response
$.paths[*].get
info
spring-framework-no-empty-descriptions
Operations and parameters should have descriptions
$.paths[*][*]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  spring-framework-operation-id-required:
    description: All operations must have a unique operationId
    message: "Operation is missing operationId at {{path}}"
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  spring-framework-tags-required:
    description: All operations must have tags
    message: "Operation at {{path}} is missing tags"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  spring-framework-summary-title-case:
    description: Operation summaries must use Title Case
    message: "Summary '{{value}}' should begin with an uppercase letter"
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z]"

  spring-framework-api-versioning:
    description: Servers should define a base URL
    message: "API should define at least one server"
    severity: warn
    given: "$"
    then:
      field: servers
      function: truthy

  spring-framework-response-200:
    description: GET operations should have a 200 response
    message: "GET operation at {{path}} is missing a 200 response"
    severity: error
    given: "$.paths[*].get"
    then:
      field: "responses.200"
      function: truthy

  spring-framework-no-empty-descriptions:
    description: Operations and parameters should have descriptions
    message: "Description is required at {{path}}"
    severity: info
    given: "$.paths[*][*]"
    then:
      field: description
      function: truthy