Sangria - Scala GraphQL implementation
Questions tagged [sangria]
66 questions
7
votes
2 answers
Marshalling nested custom Objects in Sangria
I have the following Input Objects:
val BusinessInputType = InputObjectType[BusinessInput]("BusinessInput", List(
InputField("userId", StringType),
InputField("name", StringType),
InputField("address", OptionInputType(StringType)),
…

john
- 1,057
- 1
- 17
- 28
6
votes
1 answer
GraphQL Schema with Sangria
I'm looking at the Sangria library for coding a GraphQL server in Scala. It feels odd, however, that the same type system must be implemented twice: (1) as part of the GraphQL type declarations, and (2) also at the server side, as Scala case…

silverberry
- 786
- 5
- 20
6
votes
3 answers
Relay app: How to introspect schema on server?
I'm playing with relay-starter-kit. I've also used sangria to create a graphql server. Now I'm trying to wire the two together.
In relay-starter-kit, every time you alter the schema, you need to run a script to regenerate the schema.json file. But…

jbrown
- 7,518
- 16
- 69
- 117
5
votes
1 answer
How to know requested fields in resolver of Object in Sangria GraphQL
I am building GrapQL server by Sangria GraphQL("org.sangria-graphql" %% "sangria" % "1.0.0-RC5")
I am not sure it is needed in normally. But to improve performance i'd like to get the requested fields from client during resolving.
For example,
If…

user2930677
- 81
- 4
4
votes
1 answer
Separate graphql/relay backend and frontend
I would like to separate my backend and my frontend with different projects using relay. The reason I'm doing this is because I'm using a particular relay/graphql backend, sangria and would like to keep the frontend development separate from the…

Atol
- 569
- 4
- 12
3
votes
1 answer
Keep id out of a GraphQL migration when creating a resource with Sangria
I am stuck trying to define what seems to me like a very basic mutation.
I am new to all of Scala, GraphQL, Akka HTTP, and not a native speaker, so forgive me if anything below is nonsense! Sorry for the lengthy post, I did try to keep it short with…

astorije
- 2,666
- 2
- 27
- 39
3
votes
3 answers
Creating a `Decoder` for arbitrary JSON
I am building a GraphQL endpoint for an API using Finch, Circe and Sangria. The variables that come through in a GraphQL query are basically an arbitrary JSON object (let's assume there's no nesting). So for example, in my test code as Strings, here…

Tom Adams
- 143
- 1
- 10
3
votes
3 answers
Play 2.5 with Sangria
I want to try out Play with Sangria (and Relay and React on top). The Sangria examples I found so far work with Play 2.4.2, but there seem to be some bigger changes in Play 2.5. Would it be better to wait for a new Sangria version, or is it "safe"…

Landei
- 54,104
- 13
- 100
- 195
2
votes
0 answers
How to check for user entered value before passing the object to a function in Scala?
I'm using Scala and Sangria.
1) Let's say there is a
case class Student {
Int rollNo,
Int busNo,
Int phoneNo
}
2) I'm getting a request object within which
req
- School
- Home
- Student
- rollNo
- busNo
- phoneNo
3) I…

sofs1
- 3,834
- 11
- 51
- 89
2
votes
1 answer
Fetching relations with different types
I have following structures:
ObjectX:
(id: UUID, name: String, title: String)
ObjectY (mapping table):
(objectZId: UUID, objectXId: UUID)
And i'm trying to fetch ObjectX by objectZId with following code:
val objectXByZ = RelationIds[ObjectY,…

Vlad Z.
- 3,401
- 3
- 32
- 60
2
votes
1 answer
Scala. Sangria.Print json schema
I am using GraphQL on Scala via Sangria. Also I am using apollo-codegen.
I want to define my schema once, so I export my scheme from backend to frontend by:
schema.renderPretty
The problem is sangria's renderPretty prints schema in schemaAst…

Oleg
- 899
- 1
- 8
- 22
2
votes
1 answer
GraphQL pass @include logic to the repository call
I have a query
{
"query": "query($withComments: Boolean!) {feed(id: 2) {name comments @include(if: $withComments) {title text}}}",
"vars": {"withComments": true}
}
Based on the withComments variable I can grab the feed with or without…

fedorshishi
- 1,467
- 1
- 18
- 34
2
votes
1 answer
What is a proper signature of Executor.execute(????) in Sangria middleware to log slow GraphQL queries?
I am trying to integrate Sangria middleware to log slow GraphQL queries in my application but getting the following compilation
Error:
type mismatch;
found : sangria.schema.Schema[models.UserRepo,Unit]
required:…

user8504370
- 21
- 2
2
votes
0 answers
Is there a Scala.js / Relay library out there?
On the server side, there is Sangria, but there doesn't seem to be any GraphQL library for Scala.js, let alone a Relay binding. Am I just not looking hard enough or is there a technical issue?

Michael Lorton
- 43,060
- 26
- 103
- 144
2
votes
1 answer
How to perform Mutation in sangria-graphql?
Currently, I'm learning sangria-graphql from here. However, I could not find any documentation for Mutation (Add, Update, Delete). Also, google won't help me much. So, can you guys provide me with any good resources?

Ra Ka
- 2,995
- 3
- 23
- 31