-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom rules -- can a built-in rule be overridden to relax enforcement of certain specific conditions? #27
Comments
Ah, perhaps when using the |
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 stick tap to this answer. Redocly/redocly-cli#689 (comment) redocly.yamlplugins:
- './linting/plugins/index.js'
./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.
The text was updated successfully, but these errors were encountered: