diff --git a/graphql/core/types.lua b/graphql/core/types.lua index 236ff69..6279725 100644 --- a/graphql/core/types.lua +++ b/graphql/core/types.lua @@ -205,7 +205,7 @@ end types.int = types.scalar({ name = 'Int', - description = "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. ", + description = "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. ", serialize = coerceInt, parseValue = coerceInt, parseLiteral = function(node) @@ -226,6 +226,17 @@ types.float = types.scalar({ end }) +types.double = types.scalar({ + name = 'Double', + serialize = tonumber, + parseValue = tonumber, + parseLiteral = function(node) + if node.kind == 'float' or node.kind == 'int' then + return tonumber(node.value) + end + end +}) + types.string = types.scalar({ name = 'String', description = "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", diff --git a/graphql/tarantool_graphql.lua b/graphql/tarantool_graphql.lua index 8c220a4..cad1b8f 100644 --- a/graphql/tarantool_graphql.lua +++ b/graphql/tarantool_graphql.lua @@ -73,6 +73,18 @@ local function avro_type(avro_schema) return 'long' elseif avro_schema == 'long*' then return 'long*' + elseif avro_schema == 'double' then + return 'double' + elseif avro_schema == 'double*' then + return 'double*' + elseif avro_schema == 'float' then + return 'float' + elseif avro_schema == 'float*' then + return 'float*' + elseif avro_schema == 'boolean' then + return 'boolean' + elseif avro_schema == 'boolean*' then + return 'boolean*' elseif avro_schema == 'string' then return 'string' elseif avro_schema == 'string*' then @@ -136,6 +148,18 @@ local function convert_scalar_type(avro_schema, opts) return types_long.nonNull elseif avro_t == 'long*' then return types_long + elseif avro_t == 'float' then + return types.float.nonNull + elseif avro_t == 'float*' then + return types.float + elseif avro_t == 'double' then + return types.double.nonNull + elseif avro_t == 'double*' then + return types.double + elseif avro_t == 'boolean' then + return types.boolean.nonNull + elseif avro_t == 'boolean*' then + return types.boolean elseif avro_t == 'string' then return types.string.nonNull elseif avro_t == 'string*' then