Skip to content

Commit c19bad0

Browse files
committed
Add type information to fields api
It is useful to know both the name and type information of fields. Expose the database type in the API, clients can read.
1 parent 4e21895 commit c19bad0

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lnt/server/ui/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def get():
7171
ts = request.get_testsuite()
7272

7373
result = common_fields_factory()
74-
result['fields'] = [{'column_id': i, 'column_name': f.column.name}
74+
result['fields'] = [{'column_id': i, 'column_name': f.column.name, 'column_type': str(f.column.type)}
7575
for i, f in enumerate(ts.sample_fields)]
7676

7777
return result

tests/server/ui/test_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ def test_fields_api(self):
256256
f0 = fields[0]
257257
self.assertEqual(0, f0['column_id'])
258258
self.assertEqual('compile_time', f0['column_name'])
259+
self.assertEqual('FLOAT', f0['column_type'])
259260

260261
def test_tests_api(self):
261262
"""Tests API."""

0 commit comments

Comments
 (0)