remove FluentValidationExtensions.ValidateInstance#105
remove FluentValidationExtensions.ValidateInstance#105SimonCropp merged 4 commits intoSimonCropp:masterfrom benmccallum:feature/validate-instance-async
Conversation
|
Out of interest, how are you injecting a service into a validator? Constructor injection seems to be failing when We're not covering that in test cases, but I might add one so we can. |
|
I guess here needs to be updated to pull from the IoC container... , but then it'd have to build it and hope that it's got everything in it by that point. GraphQL.Validation/src/GraphQL.FluentValidation/ValidatorTypeCache.cs Lines 62 to 95 in 0836613 Else, I guess the |
|
currently none of our validators use DI. so havnt had to think about it yet |
|
isnt this feature already covered by https://github.com/SimonCropp/GraphQL.Validation/blob/master/src/GraphQL.FluentValidation/FluentValidationExtensions_GetArgumentAsync.cs ? |
|
I can work around in the immediate future, as I just need to pull a value to use in the validation, but would be good to hear your thoughts on what a potential strategy might be, and I can have a crack at it. Unless you feel inspired yourself. In the meantime, if you're happy with this, I'd love if you could get it merged and released so I can turn it on tomorrow. Cheers mate. |
|
I need this extension method as I call it to do a validation on a complex object, with complex properties too, as per the unit test. Calling your extension methods there would be ideal, but you're just assuming a flat object whereas mine aren't. I use JsonConvert to read it out into an object then fire the validate myself on it. I thought about adding to your extension methods what I'm doing, but it's probably an advanced scenario at then adds a dep on a json deserializer. Hence this PR to just expose an async version of what I'm currently using. |
|
fair enough. can u add some doco here https://github.com/SimonCropp/GraphQL.Validation/blob/master/readme.source.md then i will merge and release |
|
i just checked. and it seems complex types should be usable with GetValidatedArgumentAsync 5b9b4a4 |
|
just to be clear. i dont object to the PR. but i want to better understand the use case, and possible add that as doco and a test scenario |
|
bump |
|
Sorry @SimonCropp, I haven't forgot about this, just been waylaid with other stuff. Hopefully I can look this afternoon, else it'll be tomorrow (France time). |
|
Seems like it is supported... weird. Looks like in master this commit may have made some improvements, but it's not clear to me when that was released. Could be a 3.x only but was backported to 2.x... who knows. Will pull out those extension methods entirely then I guess, but leave the tests. |
Update tests to prove complex arguments with complex, nested inners are indeed deserialized correctly.
|
Alright, have removed the Have left and updated the tests to avoid any regressions. |
|
I guess this is going to be a major version bump as it's technically breaking for anyone who was using the method we'd previously exposed. I'll leave that for you to bump while merging. |
|
One side-effect of these going now is that I lose the flexibility to workaround the lack of DI-support in validators that I mentioned earlier. But that's another issue to solve and I'll just do some dodgy inline validation in the resolver for now to get around that. I'll raise an issue for us to discuss it separately. |
|
@benmccallum thanks for all the effort on this. and sorry about the delayed interactions |
Looks like we had the same need haha. Builds off yours, includes tests.