extends: spectral:oas2
rules:
contact-properties: true
info-license: true
license-url: true
host-not-example: true
operation-singular-tag: true
model-description: true
oas2-parameter-description: true
operation-default-response: false
info-contact-name-onap:
description: Info object should set `contact-name` to ONAP
recommended: true
type: style
given: $.info.contact
then:
field: name
function: pattern
functionOptions:
match: ^ONAP$
info-contact-url-onap:
description: Info object should set `contact-url` to https://onap.readthedocs.io
recommended: true
type: style
given: $.info.contact
then:
field: url
function: pattern
functionOptions:
match: ^https://onap.readthedocs.io$
info-contact-email-onap:
description: Info object should set `contact-email` to onap-discuss@lists.onap.org
recommended: true
type: style
given: $.info.contact
then:
field: email
function: pattern
functionOptions:
match: ^onap-discuss@lists.onap.org$
info-license-name-onap:
description: Info object should set `license-name` to Apache 2.0
recommended: true
type: style
given: $.info.license
then:
field: name
function: pattern
functionOptions:
match: ^Apache 2.0$
info-license-url-onap:
description: Info object should set `license-url` to http://www.apache.org/licenses/LICENSE-2.0
recommended: true
type: style
given: $.info.license
then:
field: url
function: pattern
functionOptions:
match: ^http://www.apache.org/licenses/LICENSE-2.0$
info-version-onap:
description: Info object should set `version` in the form of MAJOR.MINOR.PATCH
recommended: true
type: style
given: $.info
then:
field: version
function: pattern
functionOptions:
match: ^[0-9]+.[0-9]+.[0-9]+$
info-x-planned-retirement-date:
description: Info object should include `x-planned-retirement-date` field in the form of YYYYMM
recommended: true
type: style
given: $.info
then:
field: x-planned-retirement-date
function: truthy
info-x-planned-retirement-date-form:
description: Info object `x-planned-retirement-date` field MUST be in the form of YYYYMM
recommended: true
type: style
given: $.info
then:
field: x-planned-retirement-date
function: pattern
functionOptions:
match: ^[0-9][0-9][0-9][0-9][0-9][0-9]$
info-x-component:
description: Info object should include `x-component` field to indicate the component that primarily owns the API from a development perspective
recommended: true
type: style
given: $.info
then:
field: x-component
function: truthy
path-x-interface:
description: Path object should include `x-interface` info extension with attributes api-version and last-mod-release
recommended: true
type: style
given: $.paths
then:
field: x-interface
function: truthy
operation-summary:
description: Operation should include `summary` field, which should be short, descriptive and reflect the purpose of the operation
recommended: true
type: style
given: $.paths.*[?( @property === 'get' || @property === 'put' || @property === 'post' || @property === 'delete' || @property === 'options' || @property === 'head' || @property === 'patch' || @property === 'trace' )]
then:
field: summary
function: truthy
model-definitions-description:
description: Model property `description` must be present and non-empty string.
recommended: true
type: style
given: $..definitions[*]
then:
field: description
function: truthy
model-definitions-examples:
description: Model property `examples` SHOULD be present and non-empty string.
recommended: true
type: style
given: $..properties[*]
then:
field: example
function: truthy