Automatic object derivation for complex types
See original GitHub issueHi,
If I have a case class with complex types, e.g…
case class IndexComponentDb(id: String, name: String, weight: Double)
case class ShareClassMetaDb(
id: UUID,
countriesOfSale: Set[String],
status: String,
benchmarks: List[IndexComponentDb],
[...])
and then do automatic object derivation
val ShareClassType: ObjectType[ShareClassModel.type, ShareClassMetaDb] = {
deriveObjectType[ShareClassModel.type, ShareClassMetaDb](
ObjectTypeName("ShareClass"),
ObjectTypeDescription("A share class."),
ExcludeFields("id"))
}
then these kinds of errors appear:
Can't find suitable GraphQL output type for Set[String],
Can't find suitable GraphQL output type for List[IndexComponent]
Once we have GraphQL types for the base types, in this case, String and IndexComponent, can’t Sangria automatically derive List’s and Set’s of them?
I can define a GraphQL output type for Set[String] but it doesn’t make much sense… so I think I’m probably missing something.
So how does one provide an output type in these kinds of cases?
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Automatic Type Class Derivation with Shapeless — Part One
What I wanted was a library that would take a case class and automatically derive a parser for me at compile time. Ideally...
Read more >Type Class Derivation - Scala Documentation
Type class derivation is a way to automatically generate given instances for type classes which satisfy some simple conditions. A type class in...
Read more >Automatic differentiation - Wikipedia
AD exploits the fact that every computer program, no matter how complicated, executes a sequence of elementary arithmetic operations (addition, subtraction, ...
Read more >Automatic derivation - circe
Automatic Derivation. It is also possible to derive Encoder s and Decoder s for many types with no boilerplate at all. Circe uses...
Read more >Schema derivation — tapir 0.x documentation - SoftwareMill
For case classes, Schema[_] values can be derived automatically using Magnolia, ... case class RecursiveTest(data: List[RecursiveTest]) object RecursiveTest ...
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
Just ran into this. Might be nice to mention somewhere in the README a list of gotchas like this to save people some time.
Sorry for the long delay but been on holidays. That link provided some useful clues on how to solve this, so thanks 😃