graphql-code-generator icon indicating copy to clipboard operation
graphql-code-generator copied to clipboard

[cli] The --errorsOnly flag still produces non-error output

Open Tigge opened this issue 3 years ago • 11 comments

Describe the bug

While running the code generator with --errorsOnly it still produces output such as:

✔ Parse Configuration
✔ Generate outputs

Your Example Website or App

  • Default minimal reproduction

Steps to Reproduce the Bug or Issue

  1. Open default minimal reproduction repository
  2. Run npm run codgen --errorsOnly
  3. Notice the output.

Expected behavior

Since there are no errors in the schema or generation, it should not print any output with the --errorsOnly flag.

For very large configurations that runs e.g. in CI environments the output can be quite large. It would be nice if we in those cases could only print the errors, if any.

Screenshots or Videos

No response

Platform

  • OS: Linux
  • NodeJS: 16.17.1
  • graphql version: 16.3.0
  • @graphql-codegen/cli version(s): 2.13.5

Tigge avatar Oct 12 '22 18:10 Tigge

I am not sure if i follow the example here. Can you please share a reproduction?

saihaj avatar Oct 16 '22 14:10 saihaj

This is reproducible with the default minimal reproduction. I'll clarify things a bit. But running npm run godegen and npm run codegen --errorsOnly will give the same output. I would expect that if there are no errors the second command would not produce any output.

Tigge avatar Oct 17 '22 07:10 Tigge

It looks like it was removed here https://github.com/dotansimha/graphql-code-generator/pull/8005

marco2216 avatar Oct 26 '22 07:10 marco2216

Any movement on this? Would be really great to have this functionality back

adamperrry avatar Jan 17 '23 21:01 adamperrry

Would be really helpful to have this fixed, especially since there doesn't seem to be a workaround.

amannn avatar Sep 05 '23 08:09 amannn

I just came across this as well as we are trying to suppress output during builds.

@Tigge looks like you're using flag errorsOnly but it seems the actual flag is errors-only as seen here:

image

But even if you use the correct flag, the output is completely unaffected from what I am seeing.

thom801 avatar Nov 14 '23 16:11 thom801

Can someone create a reproduction using the latest version?

I'm labeling this according to our new Contribution Guide and issue flow to stage 0.

Now in order to advance to stage 1 we'll need a simple reproduction, maybe in code-sandbox?

Later to progress to stage 2, a failing test would be needed, would be great if someone could help progress the issues through the stages.

Thank you and sorry that this comment is not a complete solution (yet).

Urigo avatar Nov 19 '23 14:11 Urigo

@Urigo the functionality was removed (by mistake I guess) in this pr and as @Tigge said

This is reproducible with the default minimal reproduction. I'll clarify things a bit. But running npm run godegen and npm run codegen --errorsOnly will give the same output. I would expect that if there are no errors the second command would not produce any output.

marco2216 avatar Nov 20 '23 08:11 marco2216

@marco2216 yes I understand, thank you even if its reproducible easily, we still would want a repo or a codesandbox with the latest version that clearly demonstrates this

It would then make it easier to create a test to track this, which later we'll use when we'll fix it

Urigo avatar Nov 20 '23 22:11 Urigo

Right now seems output is either too verbose or too little, ideally codegen could say when it's started, and it's finished (with all generators), not spamming multiple started and successes for each generator.

re-implementing errorsOnly would be nice step, but maybe that's too far the other way? (not enough output, as it's good to know it's "working/done" states)

ecker00 avatar Dec 25 '23 21:12 ecker00

is there any workaround? it is unessecary verbose by default, but seeing errors would be crucial.

macrozone avatar Apr 19 '24 09:04 macrozone

is someone working in this? It's a regression, right?

macrozone avatar Jul 23 '24 08:07 macrozone