Documentation error on Schema basics topic
See original GitHub issueIn the schema basics topic we defined the next schema structure:
const typeDefs = gql`
type Book {
title: String
author: Author
}
type Author {
name: String
books: [Book]
}
type Query {
getBooks: [Book]
getAuthors: [Author]
}
type Mutation {
addBook(title: String, author: String): Book
}
`;
But, with that structure and this data (provided by the documentation):
const books = [
{
title: 'Harry Potter and the Chamber of Secrets',
author: 'J.K. Rowling',
},
{
title: 'Jurassic Park',
author: 'Michael Crichton',
},
];
Is not possible to obtain the data as the documentation displays.
Doc result:
{
"data": {
"getBooks": [
{
"title": "Jurassic Park",
"author": {
"name": "Michael Crichton"
}
},
...
]
}
}
My result:
{
"data": {
"getBooks": [
{
"title": "Harry Potter and the Chamber of Secrets",
"author": {
"name": null
}
},
{
"title": "Jurassic Park",
"author": {
"name": null
}
}
]
}
}
am I doing something wrong or is it a doc error?
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Understanding schema errors | HESA
What is a schema error? The schema describes the structure of the XML document (number of elements, whether an element can be empty,...
Read more >Manage Schemas for Topics in Control Center
Review the step-by-step tutorial for using Schema Registry. For comprehensive information on Schema Registry, see the Schema Registry documentation. The Schema ...
Read more >Handling operation errors - Apollo GraphQL Docs
Validation errors (e.g., a query included a schema field that doesn't exist); Resolver errors (e.g., an error occurred while attempting to populate a...
Read more >Step 5: Response example and schema (API reference tutorial)
The response schema documents the response in a more comprehensive, general way, listing each property that could possibly be returned, what ...
Read more >Errors occurred while compiling the XML schemas in the project
To correct this error · Double-click the warning in the Errors List window. · Ensure that all required XSD schema (. · If...
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
@enbermudas Hope you are mixing the contents from getting-started and schema-basics. My suggestion is if you follow the getting-started first, then you can solve the issue yourself. FYI,
const books = [ { title: 'Harry Potter and the Chamber of Secrets', author: 'J.K. Rowling', }, { title: 'Jurassic Park', author: 'Michael Crichton', }, ];
this is from getting-started, but it won’t work with queries that you have mentioned in this issue. This data is not enough to work with your problem, you need to add some more data to work with your problem.@abernix @enbermudas Please excuse me if I’m wrong.
@enbermudas Understood. But the getting-started is an overall idea about how to develop a server (create a project) and the schema-basics is just schema basics, so if you want to define data for the schema do it yourself, because we can do it in different ways. So that decision is always up to you. And I hope once you covered all the topics you will get the answer for your question. Now let me show you a few examples: example 1
example 1
We can define data for the schema in different ways as I stated above. Hope this will help you. Correct me if I’m wrong