Square · API Governance Rules
Square API Rules
Spectral linting rules defining API design standards and conventions for Square.
28 Rules
error 7
warn 12
info 9
Rule Categories
info
no
openapi
operation
parameter
paths
response
schema
security
tag
Rules
error
info-title-required
Info title must be present.
$.info
info
info-title-square
Info title should reference Square.
$.info.title
error
info-description-required
Info description must be present.
$.info
warn
info-version-required
Info version must be present.
$.info
info
info-contact-required
A contact object should be provided.
$.info
info
info-license-required
A license object should be provided.
$.info
warn
openapi-version-3
Specification should be OpenAPI 3.x.
$.openapi
warn
paths-versioned
Square Connect resource paths should be versioned under /v2/ (or legacy /v1/).
$.paths[*]~
warn
paths-no-trailing-slash
Paths should not end with a trailing slash.
$.paths[*]~
warn
paths-lowercase
Path segments should be lowercase (snake_case path params allowed).
$.paths[*]~
error
operation-operationid-required
Every operation must have an operationId.
$.paths[*][get,post,put,patch,delete]
warn
operation-operationid-pascalcase
Square operationIds use PascalCase (e.g. CreatePayment, ListLocations).
$.paths[*][get,post,put,patch,delete].operationId
error
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-square-prefix
Operation summaries should begin with the provider name "Square".
$.paths[*][get,post,put,patch,delete].summary
info
operation-description-present
Operations should have a description.
$.paths[*][get,post,put,patch,delete]
error
operation-tags-required
Every operation must have tags.
$.paths[*][get,post,put,patch,delete]
warn
parameter-description-required
Parameters should have a description.
$.paths[*][get,post,put,patch,delete].parameters[*]
warn
parameter-name-snakecase
Query and path parameters should use snake_case.
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query' || @.in=='path')].name
error
response-description-required
Every response must have a description.
$.paths[*][get,post,put,patch,delete].responses[*]
warn
response-2xx-required
Operations should define at least one 2xx success response.
$.paths[*][get,post,put,patch,delete].responses
info
response-json-content
Responses should serve application/json.
$.paths[*][get,post,put,patch,delete].responses[*].content
warn
schema-property-snakecase
Square schema properties use snake_case.
$.components.schemas[*].properties[*]~
info
schema-type-defined
Schema properties should declare a type or reference.
$.components.schemas[*].properties[*]
warn
security-schemes-defined
Security schemes must be defined under components.
$.components
info
security-oauth2-present
Square uses OAuth 2.0; an oauth2 security scheme should be present.
$.components.securitySchemes
info
tag-name-titlecase
Tag names should be PascalCase / Title Case (e.g. Payments, GiftCards).
$.tags[*].name
error
no-empty-descriptions
Descriptions must not be empty.
$..description
info
operation-examples-encouraged
Operations are encouraged to provide examples for mock servers (Microcks).
$.paths[*][get,post,put,patch,delete]