Any way to limit a ListInputType argument to max entries?
See original GitHub issueHi,
I’ve created custom arguments for scalar types like Int and String, where they have to be between some min and max but am a bit stumped on how to do this for Lists because there’s no coerce methods available. For example, given this argument
val idsArg = Argument("ids", OptionInputType(ListInputType(StringType)), ..)
how would I go about limiting it only max x entries? Is there any way to do this currently?
If you could point me in the right direction, that would be awesome!
Thanks
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
sangria-graphql/sangria - Gitter
Is this the proper/best way to define Option(s) the schema? It works. I'm going to have a number of case classes with Option...
Read more >How can I set max-length in an HTML5 "input type=number ...
This is correct, but should be noted as Andy states that this does not restrict one from typing a longer number. So it's...
Read more >Learn Sangria
Apollo Client is an easy way to get started with Sangria as they're 100% ... things that potentially may increase query complexity, like...
Read more >Handling Arguments - GraphQL Scala
GraphQL Scala - Arguments. ... //2 arguments = List(Argument("ids", ListInputType(IntType))), //3 resolve = c => c.ctx.dao. ... But there is the better way....
Read more >minivend
arg: An argument which can be used by MiniVend to select page display ... The best way to operate in multi-user, multi-catalog setups...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
👋 Quick update on how we resolved the case when the argument is passed as a variable (there are actually two cases to take into account)
1. Case when the variable is sent as a part of
variables
:We create query validators (including our custom rule) dynamically with current variables injected and then just check the value by name:
2. Case when the variable is NOT sent as a part of
variables
but has the default value:There are probably better ways to do it but here’s an example implementation in case it helps someone: https://gist.github.com/meddulla/d28b14d519cb22f677ee18bb2aaf1097