WireMock · API Governance Rules

WireMock API Rules

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

7 Rules warn 5 info 2
View Rules File View on GitHub

Rule Categories

wiremock

Rules

warn
wiremock-operation-summary-title-case
All operation summaries must use Title Case.
$.paths[*][*].summary
warn
wiremock-admin-path-prefix
All WireMock admin paths must start with /__admin/.
$.paths
info
wiremock-uuid-path-param
Path parameters representing IDs should use UUID format examples.
$.paths[*].parameters[?(@.in == 'path')]
warn
wiremock-response-200-defined
All GET operations must define a 200 response.
$.paths[*].get
warn
wiremock-operation-tags
All operations should have at least one tag.
$.paths[*][get,post,put,delete,patch]
warn
wiremock-json-request-body
POST/PUT operations that accept a body should specify application/json content type.
$.paths[*][post,put].requestBody.content
info
wiremock-no-empty-descriptions
Operations should have descriptions when complex behavior is involved.
$.paths[*][post,put,delete]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  # WireMock Admin API Spectral Rules
  # These rules enforce conventions specific to the WireMock Admin API

  wiremock-operation-summary-title-case:
    description: All operation summaries must use Title Case.
    message: "Operation summary '{{value}}' must use Title Case."
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-z]*( [A-Z a-z]+)*$"

  wiremock-admin-path-prefix:
    description: All WireMock admin paths must start with /__admin/.
    message: "WireMock admin path '{{property}}' should start with /__admin/."
    severity: warn
    given: "$.paths"
    then:
      field: "@key"
      function: pattern
      functionOptions:
        match: "^/__admin/"

  wiremock-uuid-path-param:
    description: Path parameters representing IDs should use UUID format examples.
    message: "Path parameter '{{value}}' should document UUID format."
    severity: info
    given: "$.paths[*].parameters[?(@.in == 'path')]"
    then:
      - field: schema.type
        function: truthy
      - field: example
        function: truthy

  wiremock-response-200-defined:
    description: All GET operations must define a 200 response.
    message: "GET operation at '{{path}}' should define a 200 response."
    severity: warn
    given: "$.paths[*].get"
    then:
      field: responses.200
      function: truthy

  wiremock-operation-tags:
    description: All operations should have at least one tag.
    message: "Operation is missing tags."
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: tags
      function: truthy

  wiremock-json-request-body:
    description: POST/PUT operations that accept a body should specify application/json content type.
    message: "Request body should specify application/json content type."
    severity: warn
    given: "$.paths[*][post,put].requestBody.content"
    then:
      field: application/json
      function: truthy

  wiremock-no-empty-descriptions:
    description: Operations should have descriptions when complex behavior is involved.
    message: "Consider adding a description for this operation."
    severity: info
    given: "$.paths[*][post,put,delete]"
    then:
      field: description
      function: truthy