Salesforce · API Governance Rules
Salesforce API Rules
Spectral linting rules defining API design standards and conventions for Salesforce.
14 Rules
error 3
warn 6
info 5
Rule Categories
operation
request
response
salesforce
use
Rules
warn
salesforce-versioned-path
All Salesforce REST API paths must be versioned under /services/data/v{version}/
$.paths[*]~
error
operation-id-required
Every operation must have an operationId for SDK generation and Postman
$.paths[*][get,post,patch,put,delete]
warn
salesforce-operation-id-camel-case
Salesforce operationIds should use camelCase
$.paths[*][get,post,patch,put,delete].operationId
warn
operation-tags-required
Every operation must be tagged for organization in API docs and Postman
$.paths[*][get,post,patch,put,delete]
error
salesforce-sobject-parameter
Paths containing {sObjectName} must define it as a path parameter
$.paths[*][get,post,patch,put,delete][?(@.parameters)]
warn
salesforce-version-parameter
All Salesforce REST API operations must include the version path parameter
$.paths['/services/data/v{version}/**'][get,post,patch,put,delete]
error
response-success-required
Every operation must define a success response (200, 201, or 204)
$.paths[*][get,post,patch,put,delete].responses
info
salesforce-401-response
All authenticated Salesforce operations should document 401 Unauthorized
$.paths[*][get,post,patch,put,delete][?(@.security)]
warn
operation-summary-required
All operations must have a summary for API docs readability
$.paths[*][get,post,patch,put,delete]
info
salesforce-title-case-summary
Salesforce operation summaries should use Title Case
$.paths[*][get,post,patch,put,delete].summary
info
salesforce-use-patch-for-updates
Salesforce REST API uses PATCH for partial record updates, not PUT. PUT is used only for upsert operations by external ID.
$.paths[*].put
warn
request-body-json
Request bodies should specify application/json content type
$.paths[*][post,patch,put].requestBody.content
info
salesforce-400-for-mutations
POST/PATCH operations should document 400 Bad Request for validation errors
$.paths[*][post,patch].responses
info
use-schema-refs
Prefer $ref to component schemas instead of inline schema definitions for consistency and reuse across operations.
$.paths[*][get,post,patch,put,delete].responses[*].content[*].schema