schema {
query: RootSchemaQuery
}
directive @filter(
"""Name of the filter operation to perform."""
op: String!
"""List of string operands for the operator."""
value: [String!]
) repeatable on FIELD | INLINE_FRAGMENT
directive @tag(
"""Name to apply to the given property field."""
name: String
) on FIELD
directive @output(
"""What to designate the output field generated from this property field."""
name: String
) on FIELD
directive @optional on FIELD
directive @recurse(
"""
Recurse up to this many times on this edge. A depth of 1 produces the current
vertex and its immediate neighbors along the given edge.
"""
depth: Int!
) on FIELD
directive @fold on FIELD
directive @transform(
"""
Name of the transformation operation to perform.
"""
op: String!
) on FIELD
type RootSchemaQuery {
FrontPage: [Item!]!
Top(max: Int): [Item!]!
Latest(max: Int): [Story!]!
User(name: String!): User
}
interface Item {
id: Int!
unixTime: Int!
url: String!
}
type Job implements Item {
# properties from Item
id: Int!
unixTime: Int!
url: String!
# own properties
title: String!
score: Int!
}
type Story implements Item {
# properties from Item
id: Int!
unixTime: Int!
url: String! # the URL of the HackerNews page for this story
# own properties
byUsername: String!
score: Int!
submittedUrl: String # the URL this story is about, if any
text: String
title: String!
commentsCount: Int!
# edges
byUser: User!
comment: [Comment!]
}
type Comment implements Item {
# properties from Item
id: Int!
unixTime: Int!
url: String!
# own properties
text: String!
byUsername: String!
childCount: Int!
# edges
byUser: User!
reply: [Comment!]
parent: Item! # either a parent comment or the story being commented on
}
type Poll implements Item {
# properties from Item
id: Int!
unixTime: Int!
url: String!
}
type PollOption implements Item {
# properties from Item
id: Int!
unixTime: Int!
url: String!
}
type User {
id: String!
karma: Int!
about: String
unixCreatedAt: Int!
delay: Int
# The HackerNews API treats submissions of comments and stories the same way.
# The way to get only a user's submitted stories is to use this edge then
# apply a type coercion on the `Item` vertex on edge endpoint: `... on Story`
submitted: [Item!]
}