[Koha-bugs] [Bug 17008] REST API: Correct data types in Swagger

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Aug 15 18:16:33 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17008

--- Comment #1 from Lari Taskula <larit at student.uef.fi> ---
Created attachment 54486
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54486&action=edit
Bug 17008: Test to compare Swagger property types against column data types

This patch adds a test that iterates through each definition-object in Swagger
and compares their properties' data types to corresponding Koha-object's
column's
data type. For this to succeed, we need a SQL data type => Swagger data type
mapping. See "_sql_to_swagger_data_type_mapping" in definitions.t. SQL data
types
currently defined in the mapping are extracted with a simple script that
iterates
through each column from each schema's resultset and storing the data type, so
the mapping covers at least all currently defined data types and some manually
added ones as well.

This test will also check if the column is nullable and will complain
unless property has also "null" defined in its type.

To test:
1. Run t/db_dependent/api/v1/swagger/definitions.t
2. Observe that tests pass (if not, open a Bug to fix issues)
3. Modify api/v1/definitions/patron.json cardnumber to be type "integer".
4. Run the test again.
5. Observe that test fails and will complain about incorrect data type.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list