micro-elements/MicroElements.Swashbuckle.FluentValidation

First validator is used when more validators are used for one type

FrantisekSidak opened this issue · 2 comments

Using version 6.0.0-beta.1 of MicroElements.Swashbuckle.FluentValidation package.

For one contract object I use more validators with different rules. It is complex type, so SetValidator is used inside (also more than single validation for type, depending on top level validator type).

Such setup presents single validator rule sets in openapi, which does not reflects the configuration. Validation works as expected.

Hello @FrantisekSidak
Can you add an example?

Maybe IsOneValidatorForType option will help

            services.AddFluentValidationRulesToSwagger(configure: options =>
            {
                options.ValidatorSearch = new ValidatorSearchSettings()
                {
                    IsOneValidatorForType = false,
                    SearchBaseTypeValidators = true
                };
            });