-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When applying the [ValidatableType]
attribute to a class located in a different assembly than the one invoking builder.Services.AddValidation()
, the validation metadata for that class is not generated into the GeneratedValidatableInfoResolver
.
Expected Behavior
All types annotated with [ValidatableType]
, regardless of the assembly they reside in, should be included in the generated GeneratedValidatableInfoResolver
.
Steps To Reproduce
- Create a class in Assembly A and annotate it with
[ValidatableType]
. - In Assembly B, call
builder.Services.AddValidation()
. - Observe that the class from Assembly A is not included in the generated resolver.
Exceptions (if any)
No response
.NET Version
10.0.100-rc.1.25451.107
Anything else?
Proposed Solutions
Primary Solution:
Enhance the source generator to scan all referenced assemblies for [ValidatableType] attributes and include them in the generated GeneratedValidatableInfoResolver.
Alternative Solution:
Generate a separate ValidatableInfoResolver per assembly. These resolvers could then be manually registered with ValidationOptions to compose a complete validation metadata set.