Slide 10
Slide 10 text
Schema definition
from ariadne import make_executable_schema, MutationType, ObjectType, QueryType
type_defs = """
type Query {
user(id: ID!): User
}
type Mutation {
createPost(userId: ID!, content: String!): Post!
}
type User {
id: ID!
email: String!
name: String
posts: [Post!]!
}
type Post {
id: ID!
user: User!
content: String!
createdAt: String!
}
"""
mutation = MutationType()
query = QueryType()
post = ObjectType("Post")
user = ObjectType("User")
schema = make_executable_schema(type_defs, mutation, query, user, post)
Marcin Gębala - PyCon APAC 2024