extends:
  - spectral:oas
  - spectral-rules/spectral-generic.yml
  - spectral-rules/spectral-security.yml

rules:
  # Broken rules (spectral crashes) in spectral-generic.yml
  cache-responses-undocumented: off
  cache-control-parameter-undocumented: off
  servers-use-https: off
  no-method-name-in-operationId: off

  # Broken rules (spectral crashes) in spectral-security.yml
  sec-array-boundaries: off
  sec-number-boundaries: off
  sec-no-additionalProperties: off
  sec-no-default-additionalProperties: off
  sec-constrained-additionalProperties: off
  sec-securitySchemes-oauth: off
  sec-securitySchemes-jwt: off
  sec-string-maxlength: off
  sec-string-pattern-or-format-or-enum: off

  # API_VERSION is only set during release
  use-semver: warn

  # Disabled, since we don't want a /status endpoint.
  # See https://git.fitko.de/fit-connect/api/-/merge_requests/37
  paths-status: warn

  # Our PATCH endpoints are not PATCH compliant
  patch-media-type: warn

  path-parameters-camelcase:
    given: $..parameters[?(@.in == 'path')].name
    then:
      function: casing
      functionOptions:
        type: camel
        disallowDigits: true
    message: Path parameters should be camelCase and not contain digits
    severity: error

  query-parameters-camelcase:
    given: $..parameters[?(@.in == 'query')].name
    then:
      function: casing
      functionOptions:
        type: camel
        disallowDigits: true
    message: Query parameters should be camelCase and not contain digits
    severity: error
