# Test GraphQL Schema for trace-mcp GraphQL Support
# @see .context/ADR-P2-4-GRAPHQL-SUPPORT.md
"""
Root Query type - defines all available queries
"""
type Query {
"Get a user by ID"
user(id: ID!): User
"Get all users with pagination"
users(limit: Int = 10, offset: Int = 0): [User!]!
"Get posts, optionally filtered by author"
posts(authorId: ID): [Post!]!
"Search for content"
search(query: String!, type: ContentType): [SearchResult!]!
"Get the current viewer (authenticated user)"
viewer: User
}
"""
Root Mutation type - defines all available mutations
"""
type Mutation {
"Create a new user"
createUser(input: CreateUserInput!): User!
"Update an existing user"
updateUser(id: ID!, input: UpdateUserInput!): User
"Delete a user by ID"
deleteUser(id: ID!): Boolean!
"Create a new post"
createPost(input: CreatePostInput!): Post!
"Update an existing post"
updatePost(id: ID!, input: UpdatePostInput!): Post
"Delete a post by ID"
deletePost(id: ID!): Boolean!
}
"""
Root Subscription type - defines real-time subscriptions
"""
type Subscription {
"Subscribe to new user creation events"
userCreated: User!
"Subscribe to post additions, optionally filtered by author"
postAdded(authorId: ID): Post!
"Subscribe to user updates for a specific user"
userUpdated(id: ID!): User!
}
"""
User type representing a registered user
"""
type User {
"Unique identifier"
id: ID!
"User's display name"
name: String!
"User's email address"
email: String
"User's avatar URL"
avatar: String
"User's posts"
posts: [Post!]!
"User's account status"
status: UserStatus!
"When the user was created"
createdAt: DateTime!
"When the user was last updated"
updatedAt: DateTime
"User's profile settings"
settings: UserSettings
}
"""
Post type representing a blog post
"""
type Post {
"Unique identifier"
id: ID!
"Post title"
title: String!
"Post content body"
content: String
"Post author"
author: User!
"Whether the post is published"
published: Boolean!
"Post tags"
tags: [String!]!
"Comments on the post"
comments(limit: Int): [Comment!]!
"When the post was created"
createdAt: DateTime!
"When the post was published"
publishedAt: DateTime
}
"""
Comment type representing a comment on a post
"""
type Comment {
"Unique identifier"
id: ID!
"Comment body"
body: String!
"Comment author"
author: User!
"The post this comment belongs to"
post: Post!
"When the comment was created"
createdAt: DateTime!
}
"""
User settings type for user preferences
"""
type UserSettings {
"Email notification preference"
emailNotifications: Boolean!
"Theme preference"
theme: Theme!
"Language preference"
language: String!
}
"""
Search result union - can be User, Post, or Comment
"""
union SearchResult = User | Post | Comment
"""
Node interface for relay-style pagination
"""
interface Node {
"Unique identifier"
id: ID!
}
# =============================================================================
# Input Types
# =============================================================================
"""
Input for creating a new user
"""
input CreateUserInput {
"User's display name (required)"
name: String!
"User's email address (required)"
email: String!
"User's password (required)"
password: String!
"User's avatar URL (optional)"
avatar: String
}
"""
Input for updating an existing user
"""
input UpdateUserInput {
"User's display name"
name: String
"User's email address"
email: String
"User's avatar URL"
avatar: String
"User's account status"
status: UserStatus
}
"""
Input for creating a new post
"""
input CreatePostInput {
"Post title (required)"
title: String!
"Post content body"
content: String
"Whether to publish immediately"
published: Boolean = false
"Post tags"
tags: [String!]
}
"""
Input for updating an existing post
"""
input UpdatePostInput {
"Post title"
title: String
"Post content body"
content: String
"Whether the post is published"
published: Boolean
"Post tags"
tags: [String!]
}
"""
Pagination input for list queries
"""
input PaginationInput {
"Number of items to return"
limit: Int = 10
"Number of items to skip"
offset: Int = 0
"Cursor for cursor-based pagination"
cursor: String
}
# =============================================================================
# Enum Types
# =============================================================================
"""
User account status
"""
enum UserStatus {
"Active user"
ACTIVE
"Inactive user"
INACTIVE
"Pending verification"
PENDING
"Suspended user"
SUSPENDED
}
"""
Content type for search filtering
"""
enum ContentType {
"User type"
USER
"Post type"
POST
"Comment type"
COMMENT
}
"""
Theme preference
"""
enum Theme {
"Light theme"
LIGHT
"Dark theme"
DARK
"System theme"
SYSTEM
}
# =============================================================================
# Custom Scalars
# =============================================================================
"""
DateTime scalar for timestamp values
"""
scalar DateTime
"""
JSON scalar for arbitrary JSON data
"""
scalar JSON