String is one of the built-in scalar types - these are types that resolve to a single scalar object, and can't have sub-selections in the query.That means that name and appearsIn are the only fields that can appear in any part of a GraphQL query that operates on the Character type. name and appearsIn are fields on the Character type.Most of the types in your schema will be object types. Character is a GraphQL Object Type, meaning it's a type with some fields.The language is pretty readable, but let's go over it so that we can have a shared vocabulary: In the GraphQL schema language, we might represent it like this: The most basic components of a GraphQL schema are object types, which just represent a kind of object you can fetch from your service, and what fields it has. We'll use the "GraphQL schema language" - it's similar to the query language, and allows us to talk about GraphQL schemas in a language-agnostic way. ![]() Since we can't rely on a specific programming language syntax, like JavaScript, to talk about GraphQL schemas, we'll define our own simple language. GraphQL services can be written in any language. Then, when queries come in, they are validated and executed against that schema. But it's useful to have an exact description of the data we can ask for - what fields can we select? What kinds of objects might they return? What fields are available on those sub-objects? That's where the schema comes in.Įvery GraphQL service defines a set of types which completely describe the set of possible data you can query on that service.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |