Skip to content

Commit

Permalink
Merge pull request #3150 from aarontravass/aaron/jsdoc
Browse files Browse the repository at this point in the history
docs(graphql): added jsdoc for debug and introspection. closes #3142
  • Loading branch information
kamilmysliwiec authored Jul 2, 2024
2 parents 236a4e8 + aeab817 commit 6be01d7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
14 changes: 14 additions & 0 deletions packages/graphql/lib/interfaces/gql-module-options.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,20 @@ export interface GqlModuleOptions<TDriver extends GraphQLDriver = any> {
* Extra static metadata to be loaded into the specification
*/
metadata?: () => Promise<Record<string, any>>;

/**
* If `true`, enables development mode helpers and logs messages of all severity levels
* If `false`, only warn- and error-level messages are logged.
* @default true
*/
debug?: boolean;

/**
* If `true`, enables schema introspection by clients. Default is `true` unless `NODE_ENV` is
* set to `production`
* @default true
*/
introspection?: boolean;
}

export interface GqlOptionsFactory<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Type } from '@nestjs/common';
import { ResolveTypeFn } from '../../interfaces';

export interface UnionMetadata<T extends readonly Type<unknown>[] = readonly Type<unknown>[]> {
export interface UnionMetadata<
T extends readonly Type<unknown>[] = readonly Type<unknown>[],
> {
name: string;
typesFn: () => T;
id?: symbol;
Expand Down
10 changes: 6 additions & 4 deletions packages/graphql/lib/type-factories/create-union-type.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { TypeMetadataStorage } from '../schema-builder/storages/type-metadata.st
/**
* Interface defining options that can be passed to `createUnionType` function.
*/
export interface UnionOptions<T extends readonly Type<unknown>[] = Type<unknown>[]> {
export interface UnionOptions<
T extends readonly Type<unknown>[] = Type<unknown>[],
> {
/**
* Name of the union.
*/
Expand All @@ -40,9 +42,9 @@ export type Union<T extends readonly any[]> = InstanceType<ArrayElement<T>>;
* Creates a GraphQL union type composed of types references.
* @param options
*/
export function createUnionType<T extends readonly Type<unknown>[] = Type<unknown>[]>(
options: UnionOptions<T>,
): Union<T> {
export function createUnionType<
T extends readonly Type<unknown>[] = Type<unknown>[],
>(options: UnionOptions<T>): Union<T> {
const { name, description, types, resolveType } = options;
const id = Symbol(name);

Expand Down

0 comments on commit 6be01d7

Please sign in to comment.