Argo CD · API Governance Rules

Argo CD API Rules

Spectral linting rules defining API design standards and conventions for Argo CD.

21 Rules error 7 warn 11 info 3
View Rules File View on GitHub

Rule Categories

get info no operation parameter path paths query response security

Rules

warn
info-title-prefix
API title must start with "Argo CD"
$.info.title
error
info-description-required
API must have a description
$.info
error
info-version-required
API must have a version
$.info
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,delete,patch]
warn
operation-summary-title-case
Operation summaries must start with "Argo CD"
$.paths[*][get,post,put,delete,patch].summary
warn
operation-description-required
Every operation must have a description
$.paths[*][get,post,put,delete,patch]
error
operation-operationid-required
Every operation must have an operationId
$.paths[*][get,post,put,delete,patch]
warn
operation-tags-required
Every operation must have at least one tag
$.paths[*][get,post,put,delete,patch]
warn
paths-kebab-case
Path segments should use kebab-case
$.paths[*]~
warn
paths-no-trailing-slash
Paths must not have trailing slashes
$.paths[*]~
info
paths-versioned
All paths should be versioned with /api/v1/
$.paths[*]~
warn
parameter-description-required
All parameters must have a description
$.paths[*][get,post,put,delete,patch].parameters[*]
error
response-success-required
Every operation must have a success response
$.paths[*][get,post,put,delete,patch].responses
warn
response-description-required
All responses must have a description
$.paths[*][get,post,put,delete,patch].responses[*]
warn
security-definitions-required
API must define security schemes
$
error
get-no-request-body
GET operations must not have a request body
$.paths[*].get
error
no-empty-summaries
Summaries must not be empty strings
$.paths[*][get,post,put,delete,patch].summary
info
operation-id-camel-case
OperationIds should use camelCase or ServiceName_MethodName pattern
$.paths[*][get,post,put,delete,patch].operationId
warn
path-params-casing
Path parameters should be snake_case (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
info
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
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# argo-cd — 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:
#   - path-params-casing: snake @ 77% (n=79)
#   - query-params-casing: snake @ 50% (n=283)
#   - merge: kept 18 existing, added 3 measured, upgraded 0
#   - added: path-params-casing, query-params-casing, no-empty-descriptions
extends:
  - spectral:oas
rules:
  info-title-prefix:
    description: API title must start with "Argo CD"
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^Argo CD
  info-description-required:
    description: API must have a description
    severity: error
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    description: API must have a version
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  operation-summary-required:
    description: Every operation must have a summary
    severity: error
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: summary
      function: truthy
  operation-summary-title-case:
    description: Operation summaries must start with "Argo CD"
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].summary
    then:
      function: pattern
      functionOptions:
        match: ^Argo CD
  operation-description-required:
    description: Every operation must have a description
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: description
      function: truthy
  operation-operationid-required:
    description: Every operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: operationId
      function: truthy
  operation-tags-required:
    description: Every operation must have at least one tag
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: tags
      function: truthy
  paths-kebab-case:
    description: Path segments should use kebab-case
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(/api/v[0-9]+)?(/[a-z0-9{}-]+)*$
  paths-no-trailing-slash:
    description: Paths must not have trailing slashes
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: /$
  paths-versioned:
    description: All paths should be versioned with /api/v1/
    severity: info
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^/api/v
  parameter-description-required:
    description: All parameters must have a description
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].parameters[*]
    then:
      field: description
      function: truthy
  response-success-required:
    description: Every operation must have a success response
    severity: error
    given: $.paths[*][get,post,put,delete,patch].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1
  response-description-required:
    description: All responses must have a description
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].responses[*]
    then:
      field: description
      function: truthy
  security-definitions-required:
    description: API must define security schemes
    severity: warn
    given: $
    then:
      field: securityDefinitions
      function: truthy
  get-no-request-body:
    description: GET operations must not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: body
      function: falsy
  no-empty-summaries:
    description: Summaries must not be empty strings
    severity: error
    given: $.paths[*][get,post,put,delete,patch].summary
    then:
      function: pattern
      functionOptions:
        match: .+
  operation-id-camel-case:
    description: OperationIds should use camelCase or ServiceName_MethodName pattern
    severity: info
    given: $.paths[*][get,post,put,delete,patch].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[A-Za-z][A-Za-z0-9_]*$
  path-params-casing:
    description: Path parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: snake
  query-params-casing:
    description: Query parameters should be snake_case (the dominant convention in this API).
    severity: info
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: snake
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy