Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Nested input types not being imported in generated files #426

Open
guidolodetti opened this issue Feb 2, 2019 · 1 comment
Open

Nested input types not being imported in generated files #426

guidolodetti opened this issue Feb 2, 2019 · 1 comment
Labels
bug/1-repro-available A reproduction exists and needs to be confirmed. kind/bug status/pr-welcome

Comments

@guidolodetti
Copy link

Description

In schemas like the following, MyType is not imported in the generated Flow file:

scalar String

input MyType {
  something: String
}

input MyInput {
  myType: MyType
}

type Mutation {
  test(customInput: MyInput): String
}
/* @flow */
// Code generated by github.com/prisma/graphqlgen, DO NOT EDIT.

import type { GraphQLResolveInfo } from "graphql";
// This line is missing: import type { MyType } from "../models";

type Context = any;

// Types for Mutation
export const Mutation_defaultResolvers = {};

export interface Mutation_MyInput {
  myType?: MyType | null;
}
export interface Mutation_MyType {
  something?: string | null;
}

export interface Mutation_Args_Test {
  customInput?: Mutation_MyInput | null;
}

export type Mutation_Test_Resolver = (
  parent: {},
  args: Mutation_Args_Test,
  ctx: Context,
  info: GraphQLResolveInfo
) => string | null | Promise<string | null>;

export interface Mutation_Resolvers {
  test: (
    parent: {},
    args: Mutation_Args_Test,
    ctx: Context,
    info: GraphQLResolveInfo
  ) => string | null | Promise<string | null>;
}

export interface Resolvers {
  Mutation: Mutation_Resolvers;
}

Steps to reproduce

Checkout this micro-repository containing the problem described

Expected results

MyType should be imported from models.js

Actual results

MyType is never imported, but it is used in the file

Versions

  • graphqlgen: 0.6.0-rc2
  • OS name and version: MacOS 10.14.2
@jasonkuhrt jasonkuhrt added bug/1-repro-available A reproduction exists and needs to be confirmed. status/pr-welcome area/language-flow labels Feb 3, 2019
@jasonkuhrt jasonkuhrt changed the title [Flow] Nested input types not being imported in generated files Nested input types not being imported in generated files Feb 3, 2019
@emmenko
Copy link

emmenko commented Mar 6, 2019

Having the same issue (also using the flow generator).

I can try looking into it but I don't know where to start (yet). Can someone with a bit more knowledge give us a couple of hints? Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/1-repro-available A reproduction exists and needs to be confirmed. kind/bug status/pr-welcome
Projects
None yet
Development

No branches or pull requests

4 participants