Open lagouyn opened 9 months ago
Ah, perhaps when using the lint
command, I can make use of Redocly's support for the Ignore file, which I can create via --generate-ignore-file=true
.
To ignore specific known errors without disabling a whole rule, yes the ignore file is the best approach.
It's hard to comment on the original error without seeing the context of the file and the referenced schema.
This is a problem encountered with OAS 3.0.x and JSON Schema usage.
You can add those keywords as type-extensions
to Redocly's config file by creating these two entries.
stick tap to this answer. https://github.com/Redocly/redocly-cli/issues/689#issuecomment-1309762532
plugins:
- './linting/plugins/index.js'
/** @type { import('@redocly/cli').typeExtensionsConfig} */
// OAS 3.0.x doesn't support $schema and id/$id, thus we need to add these two properties as extended types so they will not throw a linting error
const typeExtension = {
oas3(types) {
return {
...types,
Schema: {
...types.Schema,
properties: {
...types.Schema.properties,
$id: { type: 'string' },
// id is only for draft-04 or older
id: { type: 'string' },
$schema: { type: 'string' },
definitions: { type: 'object' },
}
}
};
},
}
module.exports = { typeExtension }
Hello.
I'm using Redocly for validation of a Swagger JSON file that references (via
$ref
) a JSON Schema file.The top-level object in my JSON Schema file contains these two properties:
The Redocly
spec
rule doesn't like these two properties ... I'd like to be able to ignore those specific top-level properties without totally disabling thespec
rule.Is there a way to configure a built-in rule to allow it to continue to enforce its rules, but with certain exceptions?
Thank you.