Skip to content

Validation rules should have a unique key to drive it by configuration #1140

@baywet

Description

@baywet

Is your feature request related to a problem? Please describe.
OpenApi.net currently provides a set of validation rules, and the ability for library consumers to define their own. This is a great first step in a linting experience. However driving configuration of those rules is nearly impossible today.

Describe the solution you'd like
Most linters (eslint, etc...) name their validation rules with a unique key to allow enablement/disablement via configuration. As well as configuration of the rules themselves.
In addition to that change, the ValidationRuleSet class should provide methods to CRUD validation rules by key to allow easy manipulation of them at runtime.
It should also provide a clear method that clears all the current configured validation rules.
This will need to be implemented in v2 as it's most likely a breaking change.

Describe alternatives you've considered
Matching by typename (not target type) would be quite hard because a lot of the validation rules are lambdas and don't have a trivial type name.

Additional context
Kiota rules are all named today https://microsoft.github.io/kiota/using.html#--disable-validation-rules---dvr
Ran into the issue while trying to get the dvr switch in kiota to disable OpenAPI.net default rules when the all value is provided.
microsoft/kiota#2182

Metadata

Metadata

Assignees

Labels

type:breaking-changeAn issue that will result in dependent client projects failing.type:enhancementEnhancement request targeting an existing experience

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions