rules: # INFO / METADATA info-title-upwork-prefix: description: API title must start with "Upwork" severity: warn given: "$.info.title" then: function: pattern functionOptions: match: "^Upwork" info-description-required: description: API must have a description severity: error given: "$.info" then: field: description function: truthy info-version-required: description: API must define a version severity: error given: "$.info" then: field: version function: truthy # OPENAPI VERSION openapi-version-3: description: Specs must use OpenAPI 3.x severity: error given: "$" then: field: openapi function: pattern functionOptions: match: "^3\\." # SERVERS servers-defined: description: API must define servers severity: error given: "$" then: field: servers function: truthy servers-https-only: description: Server URLs must use HTTPS severity: error given: "$.servers[*].url" then: function: pattern functionOptions: match: "^https://" # OPERATIONS operation-summary-required: description: Every operation must have a summary severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: summary function: truthy operation-summary-upwork-prefix: description: Summaries must start with "Upwork" severity: warn given: "$.paths[*][get,post,put,patch,delete].summary" then: function: pattern functionOptions: match: "^Upwork " operation-id-required: description: Every operation must have an operationId severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: operationId function: truthy operation-id-camel-case: description: operationId should use camelCase severity: warn given: "$.paths[*][get,post,put,patch,delete].operationId" then: function: pattern functionOptions: match: "^[a-z][a-zA-Z0-9]*$" operation-tags-required: description: Operations must have tags severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: tags function: truthy operation-description-required: description: Operations must have descriptions severity: warn given: "$.paths[*][get,post,put,patch,delete]" then: field: description function: truthy # PARAMETERS parameter-description-required: description: Parameters must have descriptions severity: warn given: "$.paths[*][*].parameters[*]" then: field: description function: truthy # RESPONSES response-success-required: description: Operations must have success responses severity: error given: "$.paths[*][get,post,put,patch,delete].responses" then: function: truthy response-401-required: description: Authenticated operations should define 401 severity: warn given: "$.paths[*][get,post,put,patch,delete].responses" then: field: "401" function: truthy response-description-required: description: Responses must have descriptions severity: error given: "$.paths[*][*].responses[*]" then: field: description function: truthy # SCHEMAS schema-description-required: description: Schemas should have descriptions severity: warn given: "$.components.schemas[*]" then: field: description function: truthy schema-type-defined: description: Schemas should define a type severity: warn given: "$.components.schemas[*]" then: field: type function: truthy # SECURITY security-schemes-defined: description: Security schemes must be defined severity: error given: "$.components.securitySchemes" then: function: truthy # HTTP METHOD CONVENTIONS get-no-request-body: description: GET operations must not have a request body severity: error given: "$.paths[*].get" then: field: requestBody function: falsy # QUALITY no-empty-descriptions: description: Descriptions must not be empty severity: error given: "$..description" then: function: pattern functionOptions: match: "^.{1,}"