๐ŸŒŠ A GraphQL implementation in Gleam

fix: parse integer and float literals to proper value types

Changed files
+15 -2
src
+1
CHANGELOG.md
··· 11 11 12 12 ### Fixed 13 13 14 + - Integer and float literal arguments are now correctly converted to `value.Int` and `value.Float` instead of `value.String` 14 15 - Fragment spread type condition matching now works correctly when parent type is wrapped in NonNull or List 15 16 - Inline fragment type condition matching now works correctly with wrapped types 16 17 - `__typename` introspection now returns the concrete type name without modifiers
+14 -2
src/swell/executor.gleam
··· 2 2 /// 3 3 /// Executes GraphQL queries against a schema 4 4 import gleam/dict.{type Dict} 5 + import gleam/float 6 + import gleam/int 5 7 import gleam/list 6 8 import gleam/option.{None, Some} 7 9 import gleam/set.{type Set} ··· 924 926 ctx: schema.Context, 925 927 ) -> value.Value { 926 928 case arg_value { 927 - parser.IntValue(s) -> value.String(s) 928 - parser.FloatValue(s) -> value.String(s) 929 + parser.IntValue(s) -> { 930 + case int.parse(s) { 931 + Ok(n) -> value.Int(n) 932 + Error(_) -> value.String(s) 933 + } 934 + } 935 + parser.FloatValue(s) -> { 936 + case float.parse(s) { 937 + Ok(f) -> value.Float(f) 938 + Error(_) -> value.String(s) 939 + } 940 + } 929 941 parser.StringValue(s) -> value.String(s) 930 942 parser.BooleanValue(b) -> value.Boolean(b) 931 943 parser.NullValue -> value.Null