# Argo CD API Spectral Ruleset # Enforces conventions observed in the Argo CD REST API (swagger 2.0) rules: # INFO / METADATA info-title-prefix: description: API title must start with "Argo CD" severity: warn given: "$.info.title" then: function: pattern functionOptions: match: "^Argo CD" info-description-required: description: API must have a description severity: error given: "$.info" then: field: description function: truthy info-version-required: description: API must have a version severity: error given: "$.info" then: field: version function: truthy # OPERATIONS operation-summary-required: description: Every operation must have a summary severity: error given: "$.paths[*][get,post,put,delete,patch]" then: field: summary function: truthy operation-summary-title-case: description: Operation summaries must start with "Argo CD" severity: warn given: "$.paths[*][get,post,put,delete,patch].summary" then: function: pattern functionOptions: match: "^Argo CD" operation-description-required: description: Every operation must have a description severity: warn given: "$.paths[*][get,post,put,delete,patch]" then: field: description function: truthy operation-operationid-required: description: Every operation must have an operationId severity: error given: "$.paths[*][get,post,put,delete,patch]" then: field: operationId function: truthy operation-tags-required: description: Every operation must have at least one tag severity: warn given: "$.paths[*][get,post,put,delete,patch]" then: field: tags function: truthy # PATHS - NAMING CONVENTIONS paths-kebab-case: description: Path segments should use kebab-case severity: warn given: "$.paths[*]~" then: function: pattern functionOptions: match: "^(/api/v[0-9]+)?(/[a-z0-9{}-]+)*$" paths-no-trailing-slash: description: Paths must not have trailing slashes severity: warn given: "$.paths[*]~" then: function: pattern functionOptions: notMatch: "/$" paths-versioned: description: All paths should be versioned with /api/v1/ severity: info given: "$.paths[*]~" then: function: pattern functionOptions: match: "^/api/v" # PARAMETERS parameter-description-required: description: All parameters must have a description severity: warn given: "$.paths[*][get,post,put,delete,patch].parameters[*]" then: field: description function: truthy # RESPONSES response-success-required: description: Every operation must have a success response severity: error given: "$.paths[*][get,post,put,delete,patch].responses" then: function: schema functionOptions: schema: type: object minProperties: 1 response-description-required: description: All responses must have a description severity: warn given: "$.paths[*][get,post,put,delete,patch].responses[*]" then: field: description function: truthy # SECURITY security-definitions-required: description: API must define security schemes severity: warn given: "$" then: field: securityDefinitions 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: body function: falsy # GENERAL QUALITY no-empty-summaries: description: Summaries must not be empty strings severity: error given: "$.paths[*][get,post,put,delete,patch].summary" then: function: pattern functionOptions: match: ".+" operation-id-camel-case: description: OperationIds should use camelCase or ServiceName_MethodName pattern severity: info given: "$.paths[*][get,post,put,delete,patch].operationId" then: function: pattern functionOptions: match: "^[A-Za-z][A-Za-z0-9_]*$"