rules: # INFO / METADATA info-title-workato-prefix: message: API title must begin with "Workato" severity: warn given: $.info.title then: function: pattern functionOptions: match: '^Workato' info-description-required: message: Info object must have a non-empty description severity: error given: $.info then: field: description function: truthy info-version-required: message: Info object must have a version severity: error given: $.info then: field: version function: truthy info-contact-required: message: Info object should include contact information severity: warn given: $.info then: field: contact function: truthy # OPENAPI VERSION openapi-version-3: message: Must use OpenAPI 3.0.x severity: error given: $.openapi then: function: pattern functionOptions: match: '^3\.0\.' # SERVERS servers-defined: message: At least one server must be defined severity: error given: $ then: field: servers function: truthy servers-https-only: message: Server URLs must use HTTPS severity: error given: $.servers[*].url then: function: pattern functionOptions: match: '^https://' servers-workato-domain: message: Server URLs should use the workato.com domain severity: warn given: $.servers[*].url then: function: pattern functionOptions: match: 'workato\.com' # PATHS — NAMING CONVENTIONS paths-kebab-case: message: Path segments must use kebab-case or snake_case (Workato uses snake_case) severity: info given: $.paths[*]~ then: function: pattern functionOptions: match: '^(/[a-z0-9{][a-z0-9\-._{}]*)*$' paths-no-trailing-slash: message: Paths must not have a trailing slash severity: warn given: $.paths[*]~ then: function: pattern functionOptions: notMatch: '/$' paths-api-prefix: message: Workato API paths should begin with /api/ severity: warn given: $.paths[*]~ then: function: pattern functionOptions: match: '^/api/' # OPERATIONS operation-summary-required: message: All operations must have a summary severity: error given: $.paths[*][get,post,put,patch,delete] then: field: summary function: truthy operation-description-required: message: All operations must have a description severity: warn given: $.paths[*][get,post,put,patch,delete] then: field: description function: truthy operation-id-required: message: All operations must have an operationId severity: error given: $.paths[*][get,post,put,patch,delete] then: field: operationId function: truthy operation-id-camel-case: message: operationId must 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: message: Operations must have at least one tag severity: warn given: $.paths[*][get,post,put,patch,delete] then: field: tags function: truthy operation-summary-workato-prefix: message: Operation summaries must start with "Workato" severity: warn given: $.paths[*][get,post,put,patch,delete].summary then: function: pattern functionOptions: match: '^Workato' # TAGS tags-defined: message: Global tags array should be defined severity: info given: $ then: field: tags function: truthy # PARAMETERS parameter-description-required: message: Parameters must have a description severity: warn given: $.paths[*][get,post,put,patch,delete].parameters[*] then: field: description function: truthy parameter-schema-required: message: Parameters must have a schema severity: error given: $.paths[*][get,post,put,patch,delete].parameters[*] then: field: schema function: truthy parameter-snake-case: message: Parameter names should use snake_case (Workato convention) severity: info given: $.paths[*][get,post,put,patch,delete].parameters[*].name then: function: pattern functionOptions: match: '^[a-z][a-z0-9_]*$' # REQUEST BODIES request-body-json-content: message: Request bodies should use application/json content type severity: warn given: $.paths[*][post,put,patch].requestBody.content then: field: application/json function: truthy # RESPONSES response-success-required: message: Operations must have a success response (200 or 201) severity: error given: $.paths[*][get,post,put,patch,delete].responses then: function: schema functionOptions: schema: type: object anyOf: - required: ['200'] - required: ['201'] - required: ['204'] response-description-required: message: All responses must have a description severity: error given: $.paths[*][get,post,put,patch,delete].responses[*] then: field: description function: truthy response-401-unauthorized: message: Authenticated endpoints must document 401 response severity: warn given: $.paths[*][get,post,put,patch,delete].responses then: field: '401' function: truthy response-422-validation: message: POST/PUT endpoints should document 422 validation errors severity: info given: $.paths[*][post,put].responses then: field: '422' function: truthy # SCHEMAS — PROPERTY NAMING schema-description-required: message: Top-level schemas must have a description severity: warn given: $.components.schemas[*] then: field: description function: truthy schema-type-defined: message: Schemas must have a type defined severity: warn given: $.components.schemas[*] then: field: type function: truthy schema-property-snake-case: message: Schema properties should use snake_case (Workato convention) severity: warn given: $.components.schemas[*].properties[*]~ then: function: pattern functionOptions: match: '^[a-z][a-z0-9_]*$' schema-property-description: message: Schema properties should have descriptions severity: info given: $.components.schemas[*].properties[*] then: field: description function: truthy # SECURITY security-schemes-defined: message: Security schemes must be defined in components severity: error given: $.components then: field: securitySchemes function: truthy security-bearer-token: message: Workato APIs should use bearer token authentication severity: warn given: $.components.securitySchemes[*] then: field: scheme function: pattern functionOptions: match: '^bearer$' security-header-api-token: message: API token should be in Authorization header as Bearer token severity: info given: $.components.securitySchemes[*][?(@.type == 'apiKey')] then: field: in function: enumeration functionOptions: values: [header] # HTTP METHOD CONVENTIONS get-no-request-body: message: GET operations must not have a request body severity: error given: $.paths[*].get then: field: requestBody function: falsy delete-returns-success: message: DELETE operations should return 200 or 204 severity: warn given: $.paths[*].delete.responses then: function: schema functionOptions: schema: type: object anyOf: - required: ['200'] - required: ['204'] # GENERAL QUALITY no-empty-descriptions: message: Descriptions must not be empty strings severity: warn given: $..description then: function: pattern functionOptions: match: '.+' operations-have-examples: message: Operations should have response examples for documentation and mocking severity: info given: $.paths[*][get,post,put,patch,delete].responses[*].content.application\/json then: field: examples function: truthy microcks-operation-extension: message: Operations should have x-microcks-operation extension for mock server compatibility severity: info given: $.paths[*][get,post,put,patch,delete] then: field: x-microcks-operation function: truthy