graphql-spec | query language and execution engine | GraphQL library
kandi X-RAY | graphql-spec Summary
kandi X-RAY | graphql-spec Summary
This is a Working Draft of the Specification for GraphQL, a query language for APIs created by Facebook. The target audience for this specification is not the client developer, but those who have, or are actively interested in, building their own GraphQL implementations and tools. In order to be broadly adopted, GraphQL will have to target a wide variety of backend environments, frameworks, and languages, which will necessitate a collaborative effort across projects and organizations. This specification serves as a point of coordination for this effort. Looking for help? Find resources from the community.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of graphql-spec
graphql-spec Key Features
graphql-spec Examples and Code Snippets
Community Discussions
Trending Discussions on graphql-spec
QUESTION
Assume a simple schema like
...ANSWER
Answered 2020-Jan-29 at 18:42(Copying response from issue)
Actually, I think that it is valid. The spec says :
- If selectionType is an interface, union, or object
The subselection set of that selection must NOT BE empty
It simply states that it must contain a subselection (could be an inline fragment as in your example). It doesn't specify that its subselections must be leaf field selections.
I agree that in essence it should actually contain leaf selections for every possible subtype of the field's return type (e.g Human
and Droid
in your scenario), otherwise it could return an empty response. For instance, if there are no humans and 3 droids in your database then it would return:
QUESTION
what's the difference between schema and documents in Graphql?
schema is like this:
...ANSWER
Answered 2019-Dec-19 at 22:55A document is really any string containing valid GraphQL syntax. According to the spec, a document contains one or more definitions, where a definition could be:
an operation definition
QUESTION
I'm documenting all my types, fields and parameters in my schema (SDL), including Query
and Mutation
at the top - but I can't work out how to add a single piece of documentation for the top-level of the whole schema.
I'm not sure if it's the spec or the tooling - Apollo for example allows me to write schema { }
, but not to put anything inside it, or documentation before it.
And there are no examples of it in the docs, particularly at https://graphql.github.io/graphql-spec/June2018/#sec-Descriptions, which shows a "well-described" schema without a top-top-level doc string.
Is this something the spec doesn't cover, or just the tooling?
...ANSWER
Answered 2019-Jun-24 at 22:03Unlike types, the SchemaDefinition
spec does not contain a Description
. The __Schema
introspection type also does not have a description
field. So there is no way to set or get a description for the entire schema.
It is, however, an upcoming feature.
QUESTION
How would you scan schema for missing resolver for queries and non-scalar fields ?
I'm trying to work with a dynamic schema so I need to be able to test this programmatically. I've been browsing graphql tools for few hours to find a way to do this, but I'm getting nowhere...
- checkForResolveTypeResolver - this only apply to interface and union resolveType resolver
- I can't find a way to know when a defaultFieldResolver is applied
- I tried working with custom directives to add @requiredResolver, to help identify those fields, but custom resolver are far from being fully supported:
- introspection & directives
- no graphql-js directives handler (can workaround this with graphql-tools tho)
any help is appreciated !
...ANSWER
Answered 2019-May-12 at 16:50Given an instance of GraphQLSchema (i.e. what's returned by makeExecutableSchema
) and your resolvers
object, you can just check it yourself. Something like this should work:
QUESTION
We are migrating our Apollo Graphql Server v1 projects to v2.
We noticed that there is a change in the error response format.
In v2, the errors list in the response is wrapped within an error object.
But, in v1, it is not so. We want to have a a consistent standard and not introduce the wrapping behaviour in v2.
I understand that GraphQL services may provide add additional fields via extensions as per below link. Link: https://graphql.github.io/graphql-spec/June2018/#sec-Errors
I have tested Apollo GraphQL V2 and this is how it is implemented there.
In v1 it is as expected.
In v1,we see error response as below,
...ANSWER
Answered 2019-May-11 at 10:54This behavior has not changed in version 2. Apollo Server produces spec-compliant responses and does not not wrap any resulting errors in an error
object. Instead, this is just a known bug with GraphQL Playground. With version 2.0, Apollo Server transition from GraphiQL to GraphQL Playground. GraphiQL did not have this same issue, which is why this looks like a bug with Apollo Server. Check the network tab and look at the actual response from your server -- it's actually in the expected format.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install graphql-spec
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page