Spring Batch 5.1 · API Governance Rules

Spring Batch 5.1 API Rules

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

8 Rules error 3 warn 4 info 1
View Rules File View on GitHub

Rule Categories

spring

Rules

warn
spring-batch-actuator-path-prefix
All Spring Batch Actuator paths must be prefixed with /actuator or reflect the configured management base path.
$.paths[*]~
error
spring-batch-operation-tags-required
All operations must have at least one tag for grouping in the Batch Actuator API.
$.paths[*][get,post,put,delete,patch]
error
spring-batch-operationid-required
All operations in the Spring Batch Actuator API must have an operationId.
$.paths[*][get,post,put,delete,patch]
warn
spring-batch-operationid-camelcase
OperationIds must use camelCase to match Spring Batch conventions.
$.paths[*][get,post,put,delete,patch].operationId
error
spring-batch-response-200-required
All GET operations must define a 200 response.
$.paths[*].get.responses
warn
spring-batch-schema-description
All named schemas should have a description to support batch domain documentation.
$.components.schemas[*]
info
spring-batch-status-enum
Batch status fields should use the standard Spring Batch status enum values.
$.components.schemas[*].properties.status
warn
spring-batch-pagination-consistency
Paginated responses should include page, size, totalElements, and totalPages.
$.components.schemas[?(@.description =~ /[Pp]aginated/)]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  spring-batch-actuator-path-prefix:
    description: All Spring Batch Actuator paths must be prefixed with /actuator or reflect the configured management base path.
    message: "{{description}}"
    severity: warn
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        match: "^\\/"

  spring-batch-operation-tags-required:
    description: All operations must have at least one tag for grouping in the Batch Actuator API.
    message: "Operation '{{property}}' must have at least one tag."
    severity: error
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: tags
      function: truthy

  spring-batch-operationid-required:
    description: All operations in the Spring Batch Actuator API must have an operationId.
    message: "OperationId is required for every operation."
    severity: error
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: operationId
      function: truthy

  spring-batch-operationid-camelcase:
    description: OperationIds must use camelCase to match Spring Batch conventions.
    message: "OperationId '{{value}}' must use camelCase."
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  spring-batch-response-200-required:
    description: All GET operations must define a 200 response.
    message: "GET operation must define a 200 OK response."
    severity: error
    given: "$.paths[*].get.responses"
    then:
      field: "200"
      function: truthy

  spring-batch-schema-description:
    description: All named schemas should have a description to support batch domain documentation.
    message: "Schema '{{property}}' is missing a description."
    severity: warn
    given: "$.components.schemas[*]"
    then:
      field: description
      function: truthy

  spring-batch-status-enum:
    description: Batch status fields should use the standard Spring Batch status enum values.
    message: "Status field should use Spring Batch BatchStatus values."
    severity: info
    given: "$.components.schemas[*].properties.status"
    then:
      field: enum
      function: truthy

  spring-batch-pagination-consistency:
    description: Paginated responses should include page, size, totalElements, and totalPages.
    message: "Paginated response schema should include page, size, totalElements, and totalPages."
    severity: warn
    given: "$.components.schemas[?(@.description =~ /[Pp]aginated/)]"
    then:
      field: properties
      function: schema
      functionOptions:
        schema:
          type: object
          required:
            - page
            - size
            - totalElements
            - totalPages