A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI (v3.1, v3.0, and v2.0), Arazzo v1.0, as well as AsyncAPI v2.x.
User story.
As a user of Spectral it would be much flexible for me to have an opportunity to exclude certain paths from the given paths without overcomplicating JSONPaths or without defining a custom function for this purpose.
Describe the solution you'd like
In the following example the rule checks all description or title properties, but excluding examples objects because same-called properties are not part of the OpenAPI documents definition itself, but rather the example of the actual content payload which have their own constrains and requirements/guidelines:
'no-script-tags-in-markdown': {
description: 'Markdown descriptions must not have "<script>" tags.',
recommended: true,
given: '$..[description,title]',
exclude: '$..examples', // <--- easy way to exclude `title` and `description` inside these objects
then: {
function: pattern,
functionOptions: {
notMatch: '<script',
},
},
},
User story. As a user of Spectral it would be much flexible for me to have an opportunity to exclude certain paths from the
given
paths without overcomplicating JSONPaths or without defining a custom function for this purpose.Describe the solution you'd like
In the following example the rule checks all
description
ortitle
properties, but excludingexamples
objects because same-called properties are not part of the OpenAPI documents definition itself, but rather the example of the actual content payload which have their own constrains and requirements/guidelines: