Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# SDL type definitions # Scalar types (built-in) # Int | Float | String | Boolean | ID # Object type type Product { id: ID! # non-null ID name: String! # non-null String price: Float! description: String # nullable String tags: [String!]! # non-null list of non-null strings category: Category! createdAt: String! } type Category { id: ID! name: String! products: [Product!]! } # Enum type enum OrderStatus { PENDING PROCESSING SHIPPED DELIVERED CANCELLED } # Interface interface Node { id: ID! } type User implements Node { id: ID! email: String! role: Role! } # Enum for roles enum Role { ADMIN EDITOR VIEWER } # Union type — returned value can be one of several types union SearchResult = Product | Category | User # The root Query type type Query { product(id: ID!): Product products(category: ID): [Product!]! search(term: String!): [SearchResult!]! }
Result
Open