GraphQL Union and Input Type?
As of September 2017, this is not possible. There is an ongoing discussion around this functionality.
As of September 2017, this is not possible. There is an ongoing discussion around this functionality.
You can pass a variable to your query and use a Directive to fetch a field conditionally, like name @include(if: $shouldFetchName). See the docs for Directives.
GraqhQL provides directives for this very purpose. Create a fragment to define common fields, use @include(if: Boolean) and @skip(if: Boolean) directives on that fragment to get dynamic fields. By dynamic fields we mean fields that are known at execution time. According to spec, it is best to avoid manual string interpolation to construct dynamic queries. … Read more
You can pass an array like this var MovieSchema = ` type Movie { name: String } input MovieInput { name: String } mutation { addMovies(movies: [MovieInput]): [Movie] } ` Then in your mutation, you can pass an array like mutation { addMovies(movies: [{name: ‘name1’}, {name: ‘name2′}]) { name } } Haven’t tested the code … Read more
The error is not caused by the code you have in your question. What you are doing is that you are creating a new HTTP server, that will listen to httpsPort and will bind to 0.0.0.0 which means all local IP addresses. I suggest you omit 0.0.0.0 when binding to all local IP addresses since … Read more
When useQuery is called by the component, it triggers the query subsequently. But when useLazyQuery is called, it does not trigger the query subsequently, and instead return a function that can be used to trigger the query manually. It is explained on this page: https://www.apollographql.com/docs/react/data/queries/#manual-execution-with-uselazyquery When React mounts and renders a component that calls the … Read more
The queries you specify in your schema behave just like any other field on a particular type (the main difference is that their type is linked to a particular operation). If you don’t want to declare any arguments for a particular field, you just omit the parentheses entirely. The same goes for queries and mutations: … Read more
Yes, this is possible, but not in this form. GraphQL server will reject such query as a field with the same name used multiple times, but with different arguments. You need to use aliases: query { item1: myItem(size: 100, type: 2) { id, name } item2: myItem(size: 150, type: 2) { id, name } item3: … Read more
OData is a similar specification to JSON API. Both of them describe a standard protocol for creation and consumption of RESTful APIs. GraphQL is a totally different approach to API design and specifies a different way of querying API resources. OData: Designed and developed at Microsoft since 2007, standardized by the OASIS consortium. The latest … Read more
You’ve got an error Argument ‘orderBy’ on Field ‘repositories’ has an invalid value. Expected type ‘RepositoryOrder’. You forget to specify direction which is marked as mandatory. This will work: { repositoryOwner(login: “Naramsim”) { login repositories(first: 3, isFork: true, orderBy: {field: CREATED_AT, direction: ASC}) { edges { node { description } } } } }