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

Add Options type name to validation error #51557

Closed
aelij opened this issue Apr 20, 2021 · 5 comments · Fixed by #51763
Closed

Add Options type name to validation error #51557

aelij opened this issue Apr 20, 2021 · 5 comments · Fixed by #51763
Labels
area-Extensions-Options help wanted [up-for-grabs] Good issue for external contributors
Milestone

Comments

@aelij
Copy link
Contributor

aelij commented Apr 20, 2021

The current DataAnnotationValidateOptions does not have the option type in the error message:

OptionsValidationException: DataAnnotation validation failed for members: 'ClientId' with the error: 'The ClientId field is required.'.

This makes it hard to locate the problematic option, especially when using ValidateOnStart

Please add typeof(TOptions).Name (or maybe FullName?) here:

errors.Add($"DataAnnotation validation failed for members: '{string.Join(",", r.MemberNames)}' with the error: '{r.ErrorMessage}'.");

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.ComponentModel.DataAnnotations untriaged New issue has not been triaged by the area owner labels Apr 20, 2021
@ghost
Copy link

ghost commented Apr 20, 2021

Tagging subscribers to this area: @ajcvickers
See info in area-owners.md if you want to be subscribed.

Issue Details

The current DataAnnotationValidateOptions does not have the option type in the error message:

OptionsValidationException: DataAnnotation validation failed for members: 'ClientId' with the error: 'The ClientId field is required.'.

This makes it hard to locate the problematic option, especially when using ValidateOnStart

Please add typeof(TOptions).Name (or maybe FullName?) here:

errors.Add($"DataAnnotation validation failed for members: '{string.Join(",", r.MemberNames)}' with the error: '{r.ErrorMessage}'.");

Author: aelij
Assignees: -
Labels:

area-System.ComponentModel.DataAnnotations, untriaged

Milestone: -

@aelij
Copy link
Contributor Author

aelij commented Apr 20, 2021

@maryamariyan I think the bot misassigned this?

@ghost
Copy link

ghost commented Apr 20, 2021

Tagging subscribers to this area: @maryamariyan
See info in area-owners.md if you want to be subscribed.

Issue Details

The current DataAnnotationValidateOptions does not have the option type in the error message:

OptionsValidationException: DataAnnotation validation failed for members: 'ClientId' with the error: 'The ClientId field is required.'.

This makes it hard to locate the problematic option, especially when using ValidateOnStart

Please add typeof(TOptions).Name (or maybe FullName?) here:

errors.Add($"DataAnnotation validation failed for members: '{string.Join(",", r.MemberNames)}' with the error: '{r.ErrorMessage}'.");

Author: aelij
Assignees: -
Labels:

area-Extensions-Options, area-System.ComponentModel.DataAnnotations, untriaged

Milestone: -

@maryamariyan maryamariyan added help wanted [up-for-grabs] Good issue for external contributors and removed area-System.ComponentModel.DataAnnotations untriaged New issue has not been triaged by the area owner labels Apr 20, 2021
@maryamariyan maryamariyan added this to the 6.0.0 milestone Apr 22, 2021
@Coderrob
Copy link
Contributor

@aelij does this change #51763 fit what you're requesting?

@aelij
Copy link
Contributor Author

aelij commented Apr 25, 2021

Yes, thanks!

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Apr 27, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Apr 28, 2021
@ghost ghost locked as resolved and limited conversation to collaborators May 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Extensions-Options help wanted [up-for-grabs] Good issue for external contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants