Skip to content

Commit

Permalink
Merge pull request graphql-java#238 from graphql-java/pcarrier/0._is_…
Browse files Browse the repository at this point in the history
…float

4. parses as FloatValue
  • Loading branch information
Pierre Carrier authored Oct 31, 2016
2 parents bef5072 + 62b57cb commit d6ef614
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/antlr/Graphql.g4
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ NAME: [_A-Za-z][_0-9A-Za-z]* ;

IntValue : Sign? IntegerPart;

FloatValue : Sign? IntegerPart ('.' Digit+)? ExponentPart?;
FloatValue : Sign? IntegerPart ('.' Digit*)? ExponentPart?;

Sign : '-';

Expand Down
3 changes: 2 additions & 1 deletion src/test/groovy/graphql/parser/ParserTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,14 @@ class ParserTest extends Specification {
given:
def input = """
query myQuery {
hello(arg: {intKey:1, stringKey: \"world\", subObject: {subKey:true} } ) }
hello(arg: {intKey:1, floatKey: 4., stringKey: \"world\", subObject: {subKey:true} } ) }
"""

and: "expected query"

def objectValue = new ObjectValue()
objectValue.getObjectFields().add(new ObjectField("intKey", new IntValue(1)))
objectValue.getObjectFields().add(new ObjectField("floatKey", new FloatValue(4)))
objectValue.getObjectFields().add(new ObjectField("stringKey", new StringValue("world")))
def subObject = new ObjectValue()
subObject.getObjectFields().add(new ObjectField("subKey", new BooleanValue(true)))
Expand Down

0 comments on commit d6ef614

Please sign in to comment.