Skip to content

Commit 21e0a74

Browse files
no1semanTotktonada
authored andcommitted
Specify custom types description URL
1 parent bc070c3 commit 21e0a74

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

graphql/types.lua

+3
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ types.long = types.scalar({
309309
name = 'Long',
310310
description = "The `Long` scalar type represents non-fractional signed whole numeric values. " ..
311311
"Long can represent values from -(2^52) to 2^52 - 1, inclusive.",
312+
specifiedByURL = 'https://github.com/tarantool/graphql/wiki/Long',
312313
serialize = coerceLong,
313314
parseLiteral = function(node)
314315
return coerceLong(node.value)
@@ -331,6 +332,8 @@ end
331332

332333
types.float = types.scalar({
333334
name = 'Float',
335+
description = "The `Float` scalar type represents signed double-"..
336+
"precision fractional values as specified by IEEE 754.",
334337
serialize = coerceFloat,
335338
parseLiteral = function(node)
336339
return coerceFloat(node.value)

test/integration/graphql_test.lua

+18
Original file line numberDiff line numberDiff line change
@@ -1697,3 +1697,21 @@ function g.test_arguments_default_values()
16971697
local nested_enum_arg_defaults = util.find_by_name(test_input_object.inputFields, 'nested_enum_arg_defaults')
16981698
t.assert_equals(nested_enum_arg_defaults.defaultValue, 'write')
16991699
end
1700+
1701+
function g.test_specifiedByURL_long_scalar()
1702+
local query_schema = {
1703+
['test'] = {
1704+
kind = types.string.nonNull,
1705+
arguments = {
1706+
arg = types.long,
1707+
},
1708+
resolve = '',
1709+
}
1710+
}
1711+
1712+
local data, errors = check_request(introspection.query, query_schema)
1713+
local long_type_schema = util.find_by_name(data.__schema.types, 'Long')
1714+
t.assert_type(long_type_schema, 'table', 'Long scalar type found on introspection')
1715+
t.assert_equals(long_type_schema.specifiedByURL, 'https://github.com/tarantool/graphql/wiki/Long')
1716+
t.assert_equals(errors, nil)
1717+
end

0 commit comments

Comments
 (0)