Skip to content

Commit

Permalink
feat(uploads): Add File scalar to rootSchema (#11378)
Browse files Browse the repository at this point in the history
  • Loading branch information
dac09 committed Aug 28, 2024
1 parent 3484a1c commit 28c2daf
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changesets/11378.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- feat(uploads): Add File scalar to rootSchema (#11378) by @dac09

Adds `File` scalar to rootSchema, to enable parsing fields set to File as a https://developer.mozilla.org/en-US/docs/Web/API/File

The parsing and scalar is actually built in to GraphQL Yoga, this change just enables it by default instead of having to add `scalar File` to one or more of your SDLs.
1 change: 1 addition & 0 deletions __fixtures__/example-todo-main/web/src/graphql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type Scalars = {
Byte: { input: any; output: any; }
Date: { input: any; output: any; }
DateTime: { input: any; output: any; }
File: { input: any; output: any; }
JSON: { input: any; output: any; }
JSONObject: { input: any; output: any; }
Time: { input: any; output: any; }
Expand Down
1 change: 1 addition & 0 deletions packages/graphql-server/src/rootSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const schema = gql`
scalar JSON
scalar JSONObject
scalar Byte
scalar File
"""
The RedwoodJS Root Schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export type Scalars = {
Byte: Buffer;
Date: Date | string;
DateTime: Date | string;
File: File;
JSON: Prisma.JsonValue;
JSONObject: Prisma.JsonObject;
Time: Date | string;
Expand Down Expand Up @@ -164,6 +165,7 @@ export type ResolversTypes = {
Byte: ResolverTypeWrapper<Scalars['Byte']>;
Date: ResolverTypeWrapper<Scalars['Date']>;
DateTime: ResolverTypeWrapper<Scalars['DateTime']>;
File: ResolverTypeWrapper<Scalars['File']>;
Int: ResolverTypeWrapper<Scalars['Int']>;
JSON: ResolverTypeWrapper<Scalars['JSON']>;
JSONObject: ResolverTypeWrapper<Scalars['JSONObject']>;
Expand All @@ -182,6 +184,7 @@ export type ResolversParentTypes = {
Byte: Scalars['Byte'];
Date: Scalars['Date'];
DateTime: Scalars['DateTime'];
File: Scalars['File'];
Int: Scalars['Int'];
JSON: Scalars['JSON'];
JSONObject: Scalars['JSONObject'];
Expand Down Expand Up @@ -219,6 +222,10 @@ export interface DateTimeScalarConfig extends GraphQLScalarTypeConfig<ResolversT
name: 'DateTime';
}
export interface FileScalarConfig extends GraphQLScalarTypeConfig<ResolversTypes['File'], any> {
name: 'File';
}
export interface JSONScalarConfig extends GraphQLScalarTypeConfig<ResolversTypes['JSON'], any> {
name: 'JSON';
}
Expand Down Expand Up @@ -290,6 +297,7 @@ export type Resolvers<ContextType = RedwoodGraphQLContext> = {
Byte: GraphQLScalarType;
Date: GraphQLScalarType;
DateTime: GraphQLScalarType;
File: GraphQLScalarType;
JSON: GraphQLScalarType;
JSONObject: GraphQLScalarType;
Mutation: MutationResolvers<ContextType>;
Expand Down Expand Up @@ -324,6 +332,7 @@ export type Scalars = {
Byte: Buffer;
Date: string;
DateTime: string;
File: File;
JSON: Prisma.JsonValue;
JSONObject: Prisma.JsonObject;
Time: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ scalar Date
scalar DateTime
scalar File
scalar JSON
scalar JSONObject
Expand Down Expand Up @@ -84,6 +86,8 @@ scalar Date
scalar DateTime
scalar File
scalar JSON
scalar JSONObject
Expand Down

0 comments on commit 28c2daf

Please sign in to comment.