question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gql-gen runs without errors but no output generated

See original GitHub issue

Describe the bug The code generator is being run via npm run generate as recommended in your documentation. I have added this to my package.json file:

"scripts": {
    "generate": "gql-gen"
  }

The generator seems to complete without any errors however there is no output file generated.

To Reproduce Steps to reproduce the behavior:

  1. Use schema.graphql shown below
  2. Use codegen.yml shown below
  3. Run the following command: npm run generate and you will see output similar to this:
hub > npm run generate

> hub@0.0.0 generate /Users/anjumnaseer/workspace/angular/hub
> gql-gen

  ✔ Parse configuration
  ✔ Generate outputs

Expected behavior I expect to find the file schema-types.d.ts.

Schema/Documents

type Todo {
	id: ID!
	createdBy: String!
	todo: String!
	urgent: Boolean
}

type Query {
	todos: [Todo!]!
	todo(id: ID!): Todo!
}

type Mutation {
	addTodo(todo: String!, urgent: Boolean = false): Todo
	@aws_auth(cognito_groups: ["God", "Admin"])

	deleteTodo(id: ID!): Todo!
	@aws_auth(cognito_groups: ["God"])
}

type Subscription {
	addedTodo: Todo
	@aws_subscribe(mutations: ["addTodo"])
	
	deletedTodo: Todo
	@aws_subscribe(mutations: ["deleteTodo"])
}

schema {
	query: Query
	mutation: Mutation
	subscription: Subscription
}

directive @aws_auth(cognito_groups: [String]!) on FIELD_DEFINITION

directive @aws_subscribe(mutations: [String]!) on FIELD_DEFINITION

codegen.yml

schema: ./schema.graphql
overwrite: true
generates:
  ./schema-types.d.ts:
    plugins:
      - typescript-common
      - typescript-client
      - typescript-apollo-angular

Environment:

  • OS: Mac Mojave 10.14.1
  • Codegen: “graphql-code-generator”: “^0.14.3”, “graphql-codegen-typescript-apollo-angular”: “^0.14.3”, “graphql-codegen-typescript-client”: “^0.14.3”, “graphql-codegen-typescript-common”: “^0.14.3”,
  • Node: v8.11.3

Additional context N/A

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
asnaseer-resilientcommented, Nov 30, 2018

@kamilkisiela D’oh! Thanks for pointing out my obvious mistake. I changed documents to point to where I have defined all my gql queries and everything works perfectly now. I think term documents threw me a bit but now I understand it fully.

Many thanks for your patience.

0reactions
jreetercommented, Dec 7, 2018

@kamalgill I have ran into a similar problem above. Generator output says everything passed, but no code was generated. I’m generating a .ts code file, I don’t have any documents?

My config looks like:

schema: ./models/schema.graphql
overwrite: true
generates:
  .resolvers.ts:
    - graphql-neo4j-resolver-generator:
        template: ./models/resolver.handlebars
        cypherDirectory: ./models/cypher-queries
Read more comments on GitHub >

github_iconTop Results From Across the Web

gqlgen/Lobby - Gitter
Novice question I couldn't find an answer for - say I have a graphql schema file that I generate golang code from. I...
Read more >
Building GraphQL servers in golang - gqlgen
If you run into this error package github.com/99designs/gqlgen: no Go files while executing the generate command above, follow the instructions in this comment ......
Read more >
Trying to write a custom rule
I'm trying to write a custom rule for gqlgen. The idea is to run it to generate Go code from a GraphQL schema....
Read more >
How To Build a GraphQL API With Golang to Upload Files ...
If you do not have one, sign up for a new account. ... Running the gqlgen command above generates a server.go file for...
Read more >
GraphQL Code Libraries, Tools and Services
A simple and flexible JavaScript GraphQL client that works in all JavaScript ... No more render props hell; ⏳ Handle loading and error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found