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

Embed generation with plugins fails #2204

Closed
bakjos opened this issue May 25, 2022 · 3 comments · Fixed by #2214
Closed

Embed generation with plugins fails #2204

bakjos opened this issue May 25, 2022 · 3 comments · Fixed by #2214

Comments

@bakjos
Copy link

bakjos commented May 25, 2022

What happened?

When the config file includes generating the sources in the same directory where the schema is, and includes a plugin generating additional sources, like federation, it triggers an error during the validation phase:

validation failed: packages.Load: graphql_gen.go:298:29: pattern federation/directives.graphql: no matching files found

And the generated code contains the following in the line 298

//go:embed "schema.graphql" "federation/directives.graphql" "federation/entity.graphql"
var sourcesFS embed.FS

Here's the config:

schema:
  - "*.graphql"

# Where should the generated server code go?
exec:
  filename: graphql_gen.go
  package: graphql

# Uncomment to enable federation
federation:
  filename: federation_gen.go
  package: graphql
  version: 2

# Where should any generated models go?
model:
  filename: models_gen.go
  package: graphql

# Where should the resolver implementations go?
resolver:
  layout: follow-schema
  dir: .
  package: graphql
models:
  ID:
    model:
      - github.com/99designs/gqlgen/graphql.ID
      - github.com/99designs/gqlgen/graphql.Int
      - github.com/99designs/gqlgen/graphql.Int64
      - github.com/99designs/gqlgen/graphql.Int32
  Int:
    model:
      - github.com/99designs/gqlgen/graphql.Int
      - github.com/99designs/gqlgen/graphql.Int64
      - github.com/99designs/gqlgen/graphql.Int32
  Time:
    model:
      - github.com/99designs/gqlgen/graphql.Time
...

What did you expect?

To run as in the version v0.17.5, I think this error was introduced by the embedded PR #2119

Minimal graphql.schema and models to reproduce

Happens with any schema using federation

versions

  • go run github.com/99designs/gqlgen version? v0.17.8
  • go version? go version go1.18.2 darwin/amd64
@frederikhors
Copy link
Collaborator

@vikstrous

@vikstrous
Copy link
Contributor

Thanks for the bug report! I see the issue. I'll make a PR.

StevenACoffman pushed a commit that referenced this issue May 26, 2022
* dont't try to embed builtins

* add test

* generated code

* fix error message string
@bakjos
Copy link
Author

bakjos commented May 26, 2022

Wow, that was fast, looking forward to using the next release :)

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

Successfully merging a pull request may close this issue.

3 participants