GRAPHQLGEN1000 error when referencing a project that uses GraphQlClientGenerator
See original GitHub issueHi,
I came across a problem when using GraphQlClientGenerator across multiple projects that reference each other.
I have a library project that references the GraphQlClientGenerator source generator to generate source files from a schema.json file, this works fine. The problem arises when creating a second projects that references the first library project. When trying to build it, i get this error:
GRAPHQLGEN1000: Either "GraphQlClientGenerator_ServiceUrl" parameter or GraphQL JSON schema additional file must be specified.
Now, I could copy the schema.json file to this second project and add the GraphQlClientGenerator_ServiceUrl but this would kind of defeat the purpose of having a single library project and it would also mean that I have to do this for each project that references the first one.
I think the problem is that the GraphQlClientGenerator analyzer is added as a dependency to all projects which reference a project with the analyzer added, which causes the source generator to run when it shouldn’t. Do you think this is fixable or can you think of any workaround ?
Thanks !
Issue Analytics
- State:
- Created 3 years ago
- Comments:21 (18 by maintainers)
we own the graphql service. so as part of the tests, we spin up an instance of the graphql service and gen a client proxy to be consumed by clients.
Seems to be simpler than that. Just mark the generator assets as private:
<PackageReference Include="GraphQlClientGenerator" Version="0.8.*" IncludeAssets="analyzers" PrivateAssets="all" />