Skip to content
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

Settings validation doesn't work on array elements #68

Open
kunga opened this issue Nov 30, 2022 · 0 comments
Open

Settings validation doesn't work on array elements #68

kunga opened this issue Nov 30, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@kunga
Copy link
Member

kunga commented Nov 30, 2022

[ValidateBy(typeof(SimpleSettingsValidator))]
public class SimpleSettings
{
    public string Hello { get; set; }

    private class SimpleSettingsValidator : ISettingsValidator<SimpleSettings>
    {
        public IEnumerable<string> Validate(SimpleSettings settings)
        {
            yield return "Simple error";
        }
    }
}

provider.SetupSourceFor<SimpleSettings[]>(new ObjectSource(new []{new SimpleSettings(){Hello = "hello"}}));

log.Debug(JsonConvert.SerializeObject(provider.Get<SimpleSettings[]>()));

https://kontur.slack.com/archives/C08DRHZTP/p1669662782344039

@kunga kunga added the bug Something isn't working label Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant