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

Positive, Negative constraints to be used with String scalar type #56

Open
pkonyves opened this issue Jan 13, 2022 · 0 comments
Open

Positive, Negative constraints to be used with String scalar type #56

pkonyves opened this issue Jan 13, 2022 · 0 comments

Comments

@pkonyves
Copy link

We have a use-case where we define numeric values as String scalar in the graphql schema. the reason for that is not to loose precision for fractions. We use them effectively as BigDecimal.

The problem with this is that we cannot use Positive, Negative and other constraints as they are only applicable on numeric values.

I tested locally and looking at the code AbstractPositiveNegativeConstraint could easily handle String scalar type by code: AbstractDirectiveConstraint#asBigDecimal() can cope with String.

The only thing would need to be changed is adding String to AbstractPositiveNegativeConstraint#getApplicableTypes

We could use BigDecimal scalar unit in our schema, but we'd like to avoid forcing our client to set up extra configuration on their side of graphql code generation

Would it be ok if I create such pull request to support String generally for all numeric kind of constraints?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant