A sample Spectral ruleset extending the built-in OpenAPI ruleset and adding custom rules for tag and operation consistency.
API DesignAPI LintingAPI Style GuideAsyncAPIJSON-SchemaOpenAPIQuality Assurance
Spectral Openapi Ruleset Example is an example object payload from Spectral, with 3 top-level fields. It illustrates the shape of data this provider's APIs accept or return.
{
"example": "OpenAPI Spectral Ruleset",
"description": "A sample Spectral ruleset extending the built-in OpenAPI ruleset and adding custom rules for tag and operation consistency.",
"ruleset": {
"extends": ["spectral:oas"],
"rules": {
"operation-summary-required": {
"description": "All operations must have a summary.",
"message": "Operation {{path}} is missing a summary field.",
"severity": "error",
"given": "$.paths[*][get,post,put,patch,delete,options,head]",
"then": {
"field": "summary",
"function": "truthy"
}
},
"operation-tags-required": {
"description": "All operations must have at least one tag.",
"message": "Operation {{path}} must have at least one tag.",
"severity": "warn",
"given": "$.paths[*][get,post,put,patch,delete]",
"then": {
"field": "tags",
"function": "truthy"
}
},
"info-contact-required": {
"description": "The info object must contain a contact.",
"message": "API spec is missing contact information in the info object.",
"severity": "warn",
"given": "$.info",
"then": {
"field": "contact",
"function": "truthy"
}
}
}
}
}
Discovery needs no key. Ratings and market analysis are Pro.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. See our Privacy Policy and
Terms.