Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

We have a requirement, that we check only integer part of number, but not the fractional. Looks like DigitsConstraint does not support that.

I can raise a PR, but I want to check first whether it's acceptable change.

You must be logged in to vote

Replies: 1 comment · 6 replies

Comment options

Can you please expand your example please with actual examples.

Are you talking about the AST grammar, the scalar inputs / outputs of something else ?

You must be logged in to vote
6 replies
@bbakerman
Comment options

is it not a https://github.com/graphql-java/graphql-java-extended-validation#range

@Digits(integer : 5)

@Range( min : 0, max : 99999))
@lukasGemela
Comment options

@Digits(integer : 5)

won't work, see here. My plan would be to make this possible

https://github.com/graphql-java/graphql-java-extended-validation/blob/02e006a213c944c0f4e2e55c7f31f2cc603ffc9c/src/main/java/graphql/validation/constraints/standard/DigitsConstraint.java#L46

@Range( min : 0, max : 99999))

is something different. I also want to support numbers like 99999.99999, but not "100000". Range is inclusive

@bbakerman
Comment options

gotcha - yeah it seems fair

one way might be to make it @Digits(integer : Int!, fraction : Int = 2147483647, message : String)

That way when its not specified you accept any number of fractional parts

@lukasGemela
Comment options

yeah but that seems very not obvious and verbose :) Ok I try to create PR and let's see what owners think

@lgemela
Comment options

graphql-java/graphql-java-extended-validation#92 raised PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
💡
Ideas
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.