Decorators
A reference table of the @foadonis/graphql decorators, from @ObjectType, @Field and @Resolver to @Arg, @Ctx, @Root, @Directive and @UseMiddleware
| Decorator | Type | Description |
|---|---|---|
@Arg(name: string) | Parameter | Argument of the operation |
@Args() | Parameter | Arguments of the operation |
@ArgsType() | Class | Defines an Arguments Type |
@Authorized() | Method Property Class | Secure the resource |
@Ctx() | Parameter | Retrieve the HttpContext |
@Directive(directive: string) | * | Add a Schema Directive |
@Extension(metadata) | Method Property Class | Provides metadata |
@Field() | Method Property | Defines a Field |
@FieldResolver() | Method | Defines a Field resolver |
@Info() | Parameter | Provides Info |
@InputType() | Class | Defines an Input Type |
@InterfaceType() | Class | Defines an Interface Type |
@Mutation() | Method | Defines a Mutation |
@ObjectType() | Class | Defines an ObjectType |
@Query() | Method | Defines a Query |
@Resolver() | Class | Defines a Resolver |
@Root() | Parameter | Access the root document |
@Subscription() | Method | Not available |
@UseMiddleware() | Method, Property, Class | Add a middleware to the resource |
Configuration
Reference for config/graphql.ts, from resolver autoloading with HMR and emitSchemaFile SDL output to schema generation options and a custom scalarsMap.
Custom Decorators
Cut boilerplate by composing your own decorators: a FieldID wrapper, createMethodMiddlewareDecorator, and class level middleware decorators for resolvers