ff790e1c06
There are a bunch of places in genqlient where we just kind of hope you don't have ridiculous casing conflicts in your schema. Apparently with enum values there are actual schemas that have this problem! Now we have an option to disable. I ended up putting it all under `casing` instead of in `bindings` so we can clearly document the list of algorithms we support, and so we can have an `all_enums` value if you're working with a schema with a lot of this; in the future we may want to add similar behavior for types/fields, add more possible algorithms (e.g. to make things unexported), etc. I added tests for the new feature, although the way the tests are set up it wasn't convenient to do so for a schema where this is actually required. I also added a check for case conflicts that points you to this option. (I don't want to do it automatically for reasons described in the issue; mainly it just seemed a bit too magical.) Fixes #265.
208 lines
4.5 KiB
GraphQL
208 lines
4.5 KiB
GraphQL
"""DateTime is a scalar.
|
|
|
|
We don't really have anything useful to do with this description though.
|
|
"""
|
|
scalar DateTime
|
|
scalar Date
|
|
scalar Junk
|
|
scalar ComplexJunk
|
|
|
|
"""Role is a type a user may have."""
|
|
enum Role {
|
|
"""What is a student?
|
|
|
|
A student is primarily a person enrolled in a school or other educational institution and who is under learning with goals of acquiring knowledge, developing professions and achieving employment at desired field. In the broader sense, a student is anyone who applies themselves to the intensive intellectual engagement with some matter necessary to master it as part of some practical affair in which such mastery is basic or decisive.
|
|
|
|
(from [Wikipedia](https://en.wikipedia.org/wiki/Student))
|
|
"""
|
|
STUDENT
|
|
|
|
"""Teacher is a teacher, who teaches the students."""
|
|
TEACHER
|
|
}
|
|
|
|
input PokemonInput {
|
|
species: String!
|
|
level: Int!
|
|
}
|
|
|
|
type Pokemon {
|
|
species: String!
|
|
level: Int!
|
|
}
|
|
|
|
"""UserQueryInput is the argument to Query.users.
|
|
|
|
Ideally this would support anything and everything!
|
|
Or maybe ideally it wouldn't.
|
|
Really I'm just talking to make this documentation longer.
|
|
"""
|
|
input UserQueryInput {
|
|
email: String
|
|
name: String
|
|
"""id looks the user up by ID. It's a great way to look up users."""
|
|
id: ID
|
|
role: Role
|
|
names: [String]
|
|
hasPokemon: PokemonInput
|
|
birthdate: Date
|
|
}
|
|
|
|
type AuthMethod {
|
|
provider: String
|
|
email: String
|
|
}
|
|
|
|
"""A User is a user!"""
|
|
type User {
|
|
"""id is the user's ID.
|
|
|
|
It is stable, unique, and opaque, like all good IDs."""
|
|
id: ID!
|
|
roles: [Role!]
|
|
name: String
|
|
emails: [String!]!
|
|
emailsOrNull: [String!]
|
|
emailsWithNulls: [String]!
|
|
emailsWithNullsOrNull: [String]
|
|
authMethods: [AuthMethod!]!
|
|
pokemon: [Pokemon!]
|
|
greeting: Clip
|
|
birthdate: Date
|
|
}
|
|
|
|
"""An audio clip, such as of a user saying hello."""
|
|
type Clip implements HasDuration {
|
|
id: ID!
|
|
duration: Int!
|
|
}
|
|
|
|
"""Content is implemented by various types like Article, Video, and Topic."""
|
|
interface Content {
|
|
"""ID is the identifier of the content."""
|
|
id: ID!
|
|
name: String!
|
|
parent: Topic
|
|
url: String!
|
|
next: Content
|
|
related: [Content!]
|
|
}
|
|
|
|
"""An object with a duration, like a video."""
|
|
interface HasDuration {
|
|
duration: Int!
|
|
}
|
|
|
|
"""LeafContent represents content items that can't have child-nodes."""
|
|
union LeafContent = Article | Video
|
|
|
|
type Article implements Content {
|
|
"""ID is documented in the Content interface."""
|
|
id: ID!
|
|
name: String!
|
|
parent: Topic!
|
|
url: String!
|
|
text: String!
|
|
thumbnail: StuffThumbnail
|
|
next: Content
|
|
related: [Content!]
|
|
}
|
|
|
|
type StuffThumbnail { # for articles, but let's give the name-generator a hard time.
|
|
id: ID!
|
|
thumbnailUrl: String!
|
|
}
|
|
|
|
type Video implements Content & HasDuration {
|
|
"""ID is documented in the Content interface."""
|
|
id: ID!
|
|
name: String!
|
|
parent: Topic!
|
|
url: String!
|
|
duration: Int!
|
|
thumbnail: Thumbnail
|
|
next: Content
|
|
related: [Content!]
|
|
}
|
|
|
|
type Thumbnail { # for videos, but let's give the name-generator a hard time.
|
|
id: ID!
|
|
timestampSec: Int!
|
|
}
|
|
|
|
type Topic implements Content {
|
|
"""ID is documented in the Content interface."""
|
|
id: ID!
|
|
name: String!
|
|
parent: Topic
|
|
url: String!
|
|
children: [Content!]!
|
|
videoChildren: [Video!]!
|
|
schoolGrade: String
|
|
next: Topic
|
|
related: [Topic!]
|
|
}
|
|
|
|
input RecursiveInput {
|
|
rec: [RecursiveInput]
|
|
}
|
|
|
|
type Recursive {
|
|
id: ID!
|
|
rec: Recursive
|
|
}
|
|
|
|
"""Query's description is probably ignored by almost all callers."""
|
|
type Query {
|
|
"""user looks up a user by some stuff.
|
|
|
|
See UserQueryInput for what stuff is supported.
|
|
If query is null, returns the current user.
|
|
"""
|
|
user(query: UserQueryInput): User
|
|
|
|
users(query: [UserQueryInput]): [User]
|
|
|
|
"""usersWithRole looks a user up by role."""
|
|
usersWithRole(role: Role!): [User!]!
|
|
|
|
usersBornOn(date: Date!): [User!]!
|
|
|
|
root: Topic!
|
|
randomItem: Content!
|
|
randomLeaf: LeafContent!
|
|
randomVideo: Video!
|
|
convert(dt: DateTime!, tz: String): DateTime!
|
|
maybeConvert(dt: DateTime, tz: String): DateTime
|
|
getJunk: Junk
|
|
getComplexJunk: ComplexJunk
|
|
listOfListsOfLists: [[[String!]!]!]!
|
|
listOfListsOfListsOfContent: [[[Content!]!]!]!
|
|
recur(input: RecursiveInput!): Recursive
|
|
acceptsListOfListOfListsOfDates(datesss: [[[Date!]!]!]!): Boolean
|
|
getPokemon(where: getPokemonBoolExp): [Pokemon!]!
|
|
}
|
|
|
|
type Mutation {
|
|
createUser(name: String!, email: String): User
|
|
}
|
|
|
|
input getPokemonBoolExp {
|
|
_and: [getPokemonBoolExp!]
|
|
_not: getPokemonBoolExp
|
|
_or: [getPokemonBoolExp!]
|
|
level: IntComparisonExp
|
|
}
|
|
|
|
input IntComparisonExp {
|
|
_eq: Int
|
|
_gt: Int
|
|
_gte: Int
|
|
_in: [Int!]
|
|
_isNull: Boolean
|
|
_lt: Int
|
|
_lte: Int
|
|
_neq: Int
|
|
_nin: [Int!]
|
|
}
|