Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Support schemas created using graphql package #264

Open
eddeee888 opened this issue May 1, 2024 · 0 comments
Open

[FEAT] Support schemas created using graphql package #264

eddeee888 opened this issue May 1, 2024 · 0 comments

Comments

@eddeee888
Copy link
Owner

Is your feature request related to a problem? Please describe.

Problem: Schemas created using graphql is being ignored by Server Preset.

For example, consider this file:

import {
  GraphQLEnumType,
  GraphQLObjectType,
  GraphQLSchema,
  GraphQLString,
} from "graphql";

const languageType = new GraphQLEnumType({
  name: "ISOLanguage",
  values: {
    EN: {
      value: "en",
    },
    ES: {
      value: "es",
    },
    RU: {
      value: "ru",
    },
  },
});
const userType = new GraphQLObjectType({
  name: "User",
  fields: {
    id: { type: GraphQLString },
    name: { type: GraphQLString },
    language: { type: languageType },
  },
});

// Define the Query type
const queryType = new GraphQLObjectType({
  name: "Query",
  fields: {
    user: {
      type: userType,
      // `args` describes the arguments that the `user` query accepts
      args: {
        id: { type: GraphQLString },
      },
      resolve: (_, { id }) => {
        return id;
      },
    },
  },
});

const schema = new GraphQLSchema({
  query: queryType,
});

export { schema };
export default schema;

Running codegen with Server Preset results in the following error:

Empty Sources. Make sure schema files are parsed correctly.

Describe the solution you'd like

Support schemas created from graphql package

Related: dotansimha/graphql-code-generator#9932

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant