Ternary · API Governance Rules
Ternary API Rules
Spectral linting rules defining API design standards and conventions for Ternary.
23 Rules
error 7
warn 14
Rule Categories
ternary
Rules
false
ternary-security-defined
All Ternary API operations must require authentication
$.paths[*][get,post,put,patch,delete]
error
ternary-global-security
Global security must be defined for Ternary API
$
error
ternary-path-versioned
All Ternary API paths must start with /v1/
$.paths[*]~
warn
ternary-path-kebab-case
Path segments must use kebab-case
$.paths[*]~
false
ternary-collection-plural-nouns
Collection endpoints should use plural nouns
$.paths[*]~
warn
ternary-list-uses-get
List operations must use GET method
$.paths[*][get].operationId
warn
ternary-create-uses-post
Create operations should use POST
$.paths[*][post].operationId
warn
ternary-update-uses-put
Update operations should use PUT
$.paths[*][put].operationId
error
ternary-delete-uses-delete
Delete operations must use DELETE
$.paths[*][delete].operationId
error
ternary-list-response-200
List and GET operations must return 200
$.paths[*][get].responses
warn
ternary-create-response-201
Create operations should return 201
$.paths[*][post].responses
warn
ternary-delete-response-204
Delete operations should return 204
$.paths[*][delete].responses
error
ternary-401-defined
All operations must define a 401 Unauthorized response
$.paths[*][get,post,put,patch,delete].responses
warn
ternary-404-for-resource-ops
Operations with path parameters should define 404
$.paths[*~'/{[^}]+}'][get,put,delete].responses
warn
ternary-pagination-params
List endpoints should support pagination parameters
$.paths[*][get][?(@.operationId && @.operationId.startsWith('list'))]
error
ternary-operation-summary
All operations must have a summary
$.paths[*][get,post,put,patch,delete]
warn
ternary-summary-title-case
Operation summaries must use Title Case
$.paths[*][get,post,put,patch,delete].summary
warn
ternary-operation-description
All operations should have a description
$.paths[*][get,post,put,patch,delete]
error
ternary-tags-defined
All operations must have tags
$.paths[*][get,post,put,patch,delete]
warn
ternary-schema-description
Schema objects should have descriptions
$.components.schemas[*]
warn
ternary-no-inline-schemas
Prefer reusable schemas in components over inline definitions
$.paths[*][*].responses[*].content[*].schema
warn
ternary-cost-fields-numeric
Cost and amount fields should be numeric type
$.components.schemas[*].properties[?(@key =~ /cost|amount|spend|budget/i)]
warn
ternary-date-fields-format
Date fields should use ISO 8601 format
$.components.schemas[*].properties[?(@key =~ /date|_at$/i)]