extends: spectral:oas rules: wmg-operation-ids-required: description: All operations must have an operationId severity: error given: "$.paths[*][*]" then: field: operationId function: truthy wmg-operation-summary-title-case: description: Operation summaries must use Title Case severity: warn given: "$.paths[*][*].summary" then: function: pattern functionOptions: match: "^[A-Z][a-zA-Z0-9]*(\\s[A-Z][a-zA-Z0-9]*)*$" wmg-operation-tags-required: description: All operations must have at least one tag severity: error given: "$.paths[*][*]" then: field: tags function: truthy wmg-paths-versioned: description: All API paths must include a version prefix severity: error given: "$.paths" then: function: pattern functionOptions: match: "^\\/v[0-9]+" wmg-oauth2-required: description: WMG API uses OAuth2 authentication severity: error given: "$.components.securitySchemes" then: function: schema functionOptions: schema: type: object minProperties: 1 wmg-response-success-defined: description: Operations must define a successful response severity: error given: "$.paths[*][*].responses" then: function: schema functionOptions: schema: type: object anyOf: - required: ["200"] - required: ["201"] wmg-response-401-defined: description: Protected operations must define a 401 response severity: warn given: "$.paths[*][*].responses" then: function: schema functionOptions: schema: type: object required: - "401" wmg-catalog-search-params: description: Catalog search must have at least a query parameter severity: error given: "$.paths['/v1/catalog/search'].get.parameters" then: function: truthy wmg-isrc-path-pattern: description: Track endpoints should use ISRC as the path parameter severity: info given: "$.paths./v1/tracks/{isrc}.get.parameters[*]" then: function: schema functionOptions: schema: type: object properties: name: enum: - isrc wmg-pagination-on-lists: description: List operations should support limit and offset parameters severity: warn given: "$.paths[*].get.parameters[*].name" then: function: enumeration functionOptions: values: - limit - offset - page - cursor