-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates for GraphQL schema ordering and TypeScript type generation #9258
Conversation
user(where: UserWhereUniqueInput!): User | ||
users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be a noisy update for developers, but, this has been an inconsistency in our code for many moons, and is annoying to uphold.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 9594b52:
|
|
||
const name = type.name | ||
if (type instanceof GraphQLScalarType) { | ||
if (scalars[name] === undefined) return 'any' | ||
return `Scalars['${stringify(name)}']` // TODO: inline? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why we needed to refer to this Scalars
object continually for our resolved types; this isn't helpful to developers.
@@ -84,7 +74,7 @@ export type TodoUpdateArgs = { | |||
} | |||
|
|||
export type TodoCreateInput = { | |||
readonly title?: Scalars['String'] | null | |||
readonly title?: string | null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is easier on the eyes from a developer documentation point of view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been annoyed by this scalar in generating types to be used with separate frontend app.
6c65ac8
to
097c846
Compare
097c846
to
9594b52
Compare
This pull request changes some of the ordering in our GraphQL types, and begins to introduces a differentiation between GraphQL types and resolved (or Prisma) types in our generated Typescript types.
This change is important as it begins to address a state where these types do not always match. The reason for that will be evident in #2480, but additionally, it refactors the Typescript type generation to start accounting for separate Typescript types for a
sudo()
context.Primarily for now though, this pull request inlines parts of the
printGeneratedTypes
and orders the outputs more consistently.