Comments (3)
how would you express validations if u dont use the fluent API?
from graphql.validation.
bump
from graphql.validation.
Sorry, been a busy week.
Ah, I might not fully understan the question but here goes...
IValidator<T>
doesn't specify that T
is a class, so you could set up your validator as always (see below) and then off the argument declaration on the field, we could have an extension method like .ValidateWith<StarRatingValidator>()
that registers it for that field.
public class StarRatingValidator : AbstractValidator<int>
{
public PhoneNumberValidator()
{
RuleFor(x => x).InclusiveBetween(1, 5).;
}
}
When I'm back in a GraphQL project I'll complete the example with the extension method placement
from graphql.validation.
Related Issues (15)
- Support DI in validators HOT 12
- Add FluentValidationExtensions.AddCacheToContext to make unit testing easier
- Make ArgumentValidation public HOT 4
- Extension methods off IResolveFieldContext now HOT 5
- Clarify the term "Validation" HOT 1
- Fix GraphQL version to match NuGet versions HOT 2
- Dont work validation for different names. HOT 1
- How i can change exceptions. HOT 4
- UseFluentValidation now also required on Schema instance
- Update to AspNetCore 6
- Validation not firing HOT 5
- Unable to resolve the Validator HOT 2
- Make ArgumentValidation public for manual calling HOT 7
- Remove redundant resolvers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql.validation.