graphql-java-generator / graphql-maven-plugin-project

graphql-maven-plugin is a Maven Plugin for GraphQL, based on graphql-java. It accelerates the development for both the client and the server, by generating the Java code. It allows a quicker development when in contract-first approach, by avoiding to code the boilerplate code.
https://graphql-maven-plugin-project.graphql-java-generator.com
MIT License
115 stars 47 forks source link

Missing break statements after VALUE_FALSE in deserialize method #200

Closed lukaszstempin closed 9 months ago

lukaszstempin commented 9 months ago

It looks like there is a missing 'break' after VALUE_FALSE. Without it, the boolean value always tries to parse as a number, which of course will never succeed.

case VALUE_FALSE:
case VALUE_TRUE:
   value = new BooleanValue(p.getBooleanValue());
case VALUE_NUMBER_FLOAT:
   value = new FloatValue(p.getDecimalValue());
   break;
case VALUE_NUMBER_INT:
   value = new IntValue(p.getBigIntegerValue());
   break;
case VALUE_STRING:
   value = new StringValue(p.getText());
   break;
case VALUE_NULL:
   value = null;
   break;
default:
   throw new JsonParseException(p, "Non managed JSON token: " + p.currentToken());
            }

My suggestion:

case VALUE_TRUE:
   value = new BooleanValue(p.getBooleanValue());
   break;
lukaszstempin commented 9 months ago

I wanted to raise a PR for this but looks like I am not able to do so.

Please make sure you have the correct access rights and the repository exists.

etienne-sf commented 9 months ago

Hello,

Thanks for the hint. I think everybody may submit PR. To do this:

Étienne

etienne-sf commented 9 months ago

And an additional note: I'd be happy to validate this PR.

What would be even greater, is if you add Junit test that would be ko before the correction, and become ok after it.

etienne-sf commented 9 months ago

Question : do you plan to do this PR ? Otherwise I commit the correction you pointed out.

lukaszstempin commented 9 months ago

Hey @etienne-sf unfortunately I have no access to raise a PR. Sorry for that : /

etienne-sf commented 9 months ago

Ok, no problem

I'll commit this correction. :)

etienne-sf commented 9 months ago

Solved in the 2.3.1 release. Along with a bug that would prevent to use alias on field which type is a custom scalar.