From f97922d0dd79bcf80e3d8782dd42c91c534b0481 Mon Sep 17 00:00:00 2001 From: standy Date: Fri, 1 May 2020 00:35:39 +0300 Subject: [PATCH] Only operation types miss input types --- .../types.preResolveTypes.onlyOperationTypes.ts | 17 +++++++++++++++++ .../src/base-types-visitor.ts | 3 +-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts index f6213f7961f..8a936336efe 100644 --- a/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts +++ b/dev-test/star-wars/types.preResolveTypes.onlyOperationTypes.ts @@ -26,6 +26,23 @@ export enum LengthUnit { Foot = 'FOOT', } +/** The input object sent when someone is creating a new review */ +export type ReviewInput = { + /** 0-5 stars */ + stars: Scalars['Int']; + /** Comment about the movie, optional */ + commentary?: Maybe; + /** Favorite color, optional */ + favoriteColor?: Maybe; +}; + +/** The input object sent when passing a color */ +export type ColorInput = { + red: Scalars['Int']; + green: Scalars['Int']; + blue: Scalars['Int']; +}; + export type CreateReviewForEpisodeMutationVariables = { episode: Episode; review: ReviewInput; diff --git a/packages/plugins/other/visitor-plugin-common/src/base-types-visitor.ts b/packages/plugins/other/visitor-plugin-common/src/base-types-visitor.ts index 134804dc1ac..c5baa77bad3 100644 --- a/packages/plugins/other/visitor-plugin-common/src/base-types-visitor.ts +++ b/packages/plugins/other/visitor-plugin-common/src/base-types-visitor.ts @@ -164,7 +164,7 @@ export interface RawTypesConfig extends RawConfig { * ``` */ wrapFieldDefinitions?: boolean; - /** + /** * @name onlyOperationTypes * @type boolean * @description This will cause the generator to emit types for operations only (basically only enums and scalars) @@ -279,7 +279,6 @@ export class BaseTypesVisitor< } InputObjectTypeDefinition(node: InputObjectTypeDefinitionNode): string { - if (this.config.onlyOperationTypes) return ''; return this.getInputObjectDeclarationBlock(node).string; }