Files
ubicloud/openapi/.spectral.yml
geemus 76bef4a3bd Move openapi infrastructure to a directory, get a new openapi snapshot
Some of the linting toolchain does not use hidden files, so they can
be annoying to mix with other top-level directory files.

This also picks up a new version of the openapi.yml from @geemus's
work that is more-correct, and far more complete: note that the length
has doubled.

It's not quite 100% correct, because at least a few hard-to-spec
features were added to the API -- probably accidentally -- that we'd
be better off removing, per daniel@ubicloud.com advisory.

These abnormalities are already identified in a development branch we
can pick through after, that has every single test passing the schema
verification.
2024-11-22 14:29:54 -08:00

47 lines
1.4 KiB
YAML

extends: ["spectral:oas"]
rules:
operation-description: off
additional-properties-with-properties:
description: "Any element with properties also has additionalProperties false"
given: $..[?(@ && @.properties)]
severity: error
then:
- field: additionalProperties
function: defined
- field: additionalProperties
function: falsy
responses-required-with-properties:
description: "Any responses schema with properties also has required array"
given: $.paths..responses..[?(@ && @.properties)]
severity: error
then:
- field: required
function: schema
functionOptions:
schema:
type: array
items:
type: string
schemas-required-with-properties:
description: "Any components/schemas schema with properties also has required array"
given: $.components.schemas..[?(@ && @.properties)]
severity: error
then:
- field: required
function: schema
functionOptions:
schema:
type: array
items:
type: string
default-for-responses:
description: "Responses have default value `$ref: '#/components/responses/Error'`"
given: $.paths[*][*][responses]
severity: error
then:
field: default
function: schema
functionOptions:
schema:
$ref: '#/components/responses/Error'