Note: I am filing this as a bug, because it seems to me like this was working differently in an old release, but I do not know the history of this tool and I am quite a new user, so I am sorry if this should be "Feature request" instead.
When there are multiple generates outputs, if any one of them fails, no output is generated from either of them, even though the CLI output suggests something was generated (see image below).
This happens because if an error happens in any of the sub-tasks, an exception is thrown here, while file generation happens later based on results variable (see here).
It looks like this behavior was introduced in this release (quite a while ago): https://github.com/dotansimha/graphql-code-generator/commit/f13d3554ed838047b62285281d0f87fd3ab20035
The last 3 lines would suggest that schemas/api.graphql, components/types.generated.ts and components/ succeeded in generating, but no files are changed:
I'd either expect for the indicated generations to actually happen, or at least for the CLI output to be changed to reflect nothing was actually changed on disk.
Optionally, there could be a config flag choosing which behavior to use.
Personally, I'd prefer for the tool to be changed to generate something even if there were errors, because it would greatly help with our use-case (I can describe this in more detail if anyone is interested, but it is unrelated to the issue at hand).
I'm also having issues due to this bug (fetching types from multiple development microservices that aren't always all running). Has there been any progress or workarounds since this was posted?
Which packages are impacted by your issue?
@graphql-codegen/cli
Describe the bug
Note: I am filing this as a bug, because it seems to me like this was working differently in an old release, but I do not know the history of this tool and I am quite a new user, so I am sorry if this should be "Feature request" instead.
When there are multiple
generates
outputs, if any one of them fails, no output is generated from either of them, even though the CLI output suggests something was generated (see image below). This happens because if an error happens in any of the sub-tasks, an exception is thrown here, while file generation happens later based onresults
variable (see here). It looks like this behavior was introduced in this release (quite a while ago): https://github.com/dotansimha/graphql-code-generator/commit/f13d3554ed838047b62285281d0f87fd3ab20035The last 3 lines would suggest that
schemas/api.graphql
,components/types.generated.ts
andcomponents/
succeeded in generating, but no files are changed:Your Example Website or App
https://codesandbox.io/p/sandbox/magical-tree-nm4fs9?file=%2Fcodegen.ts%3A15%2C5
Steps to Reproduce the Bug or Issue
See linked Codesandbox example
Expected behavior
I'd either expect for the indicated generations to actually happen, or at least for the CLI output to be changed to reflect nothing was actually changed on disk. Optionally, there could be a config flag choosing which behavior to use.
Screenshots or Videos
No response
Platform
@graphql-codegen/cli
version: 5.0.0graphql
version: irrelevantCodegen Config File
Additional context
Personally, I'd prefer for the tool to be changed to generate something even if there were errors, because it would greatly help with our use-case (I can describe this in more detail if anyone is interested, but it is unrelated to the issue at hand).