Complete the code to define a subgraph with a name.
subgraph [1] {
// schema details here
}The subgraph name is required after the subgraph keyword to identify it uniquely.
Complete the code to specify the GraphQL schema inside the subgraph.
subgraph MySubgraph {
[1] {
query: Query
}
}type instead of schema for the schema block.The schema block defines the entry points like query for the subgraph.
Fix the error in the subgraph definition by completing the type declaration.
type Query [1]
product(id: ID!): Product
}implements Node without defining the interface.The type declaration must open with a curly brace { to define fields.
Complete the code to define a Product type with an ID and a name field.
type Product {
id: [1]!
name: String
}Int or String for the id field instead of ID.The type fields must be inside curly braces { and the ID field uses the ID scalar type.
Fill both blanks to define a subgraph with a schema and a Product type with id and name.
subgraph [1] { [2] { query: Query } type Product { id: ID! name: String } }
type instead of schema for the schema block.The subgraph name is MySubgraph, the schema block is schema, and the type fields start with {.