[Bug 17032] New: REST API tests: Make sure Swagger object definition is up-to-date with database
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Bug ID: 17032 Summary: REST API tests: Make sure Swagger object definition is up-to-date with database Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Web services Assignee: koha-bugs@lists.koha-community.org Reporter: larit@student.uef.fi QA Contact: testopia@bugs.koha-community.org If a Swagger object definition is based on some database table, the definition should be covered by tests to ensure that it is up-to-date with database. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |13799, 13903 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13799 [Bug 13799] Add base for building RESTful API https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13903 [Bug 13903] Add API routes to list, create, update, delete holds -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 --- Comment #1 from Lari Taskula <larit@student.uef.fi> --- Created attachment 53936 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53936&action=edit Bug 17032: Make sure Swagger object definition is up-to-date with Koha-object If a definition in api/v1/definitions/*.json has a corresponding Koha-object by filename, compare properties of the definition and columns of the Koha-object and ensure that all columns are defined inside properties of the definition. To test: 1. Run t/db_dependent/api/v1/swagger/definitions.t 2. See that all of the tests pass. (If not, file a bug report to fix missing properties in the Swagger definition.) 3. Remove a property from api/v1/swagger/definitions/patron.json 4. Repeat step 1 5. See that test fails and lets you know that the property you just removed is missing from the definition. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |17041 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17041 [Bug 17041] Fix missing properties in Swagger definition for Patron -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |17042 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17042 [Bug 17042] Fix missing properties in Swagger definition for Hold -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 --- Comment #2 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Comment on attachment 53936 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53936 Bug 17032: Make sure Swagger object definition is up-to-date with Koha-object Review of attachment 53936: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=17032&attachment=53936) ----------------------------------------------------------------- ::: t/db_dependent/api/v1/swagger/definitions.t @@ +72,5 @@
+ + $name = "Koha::" . ucfirst $name; + + return eval { + Module::Load::load($name);
The correct way to do that is to use Module::Load::Conditional. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53936|0 |1 is obsolete| | --- Comment #3 from Lari Taskula <larit@student.uef.fi> --- Created attachment 53963 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53963&action=edit Bug 17032: Make sure Swagger object definition is up-to-date with Koha-object -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 --- Comment #4 from Lari Taskula <larit@student.uef.fi> --- (In reply to Jonathan Druart from comment #2)
The correct way to do that is to use Module::Load::Conditional. As requested, patch above.
By the way, at the moment tests are failing, because patron.json is missing 2 properties and hold.json is missing one. Apply bugs Bug 17041 and Bug 17042 to run this cleanly (also sign-off for them will be appreciated :). -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|17041 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17041 [Bug 17041] Fix missing properties in Swagger definition for Patron -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|17042 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17042 [Bug 17042] Fix missing properties in Swagger definition for Hold -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |17041, 17042 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17041 [Bug 17041] Fix missing properties in Swagger definition for Patron https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17042 [Bug 17042] Fix missing properties in Swagger definition for Hold -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53963|0 |1 is obsolete| | --- Comment #5 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 53980 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=53980&action=edit Bug 17032: Make sure Swagger object definition is up-to-date with Koha-object If a definition in api/v1/definitions/*.json has a corresponding Koha-object by filename, compare properties of the definition and columns of the Koha-object and ensure that all columns are defined inside properties of the definition. To test: 1. Run t/db_dependent/api/v1/swagger/definitions.t 2. See that all of the tests pass. (If not, file a bug report to fix missing properties in the Swagger definition.) 3. Remove a property from api/v1/swagger/definitions/patron.json 4. Repeat step 1 5. See that test fails and lets you know that the property you just removed is missing from the definition. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |benjamin.rokseth@kul.oslo.k | |ommune.no Status|Needs Signoff |Signed Off --- Comment #6 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Works as intended! Good work! -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53980|0 |1 is obsolete| | --- Comment #7 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 54022 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54022&action=edit Bug 17032: Make sure Swagger object definition is up-to-date with Koha-object If a definition in api/v1/definitions/*.json has a corresponding Koha-object by filename, compare properties of the definition and columns of the Koha-object and ensure that all columns are defined inside properties of the definition. To test: 1. Run t/db_dependent/api/v1/swagger/definitions.t 2. See that all of the tests pass. (If not, file a bug report to fix missing properties in the Swagger definition.) 3. Remove a property from api/v1/swagger/definitions/patron.json 4. Repeat step 1 5. See that test fails and lets you know that the property you just removed is missing from the definition. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 54023 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54023&action=edit Bug 17032: Remove warning "keys on reference is experimental" Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Thanks Lari! -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |larit@student.uef.fi |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=16825 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 --- Comment #10 from Lari Taskula <larit@student.uef.fi> --- In case this test doesn't always return the same result, and fails sometimes, you might be interested in this: I applied many API-related patches on top of master and ran this test multiple times. I noticed it didn't always have the same result; Swagger2 wasn't always able to find the type of definition because for some reason $ref was left unresolved for that definition - but after updating to the latest versions of Swagger2 (0.83) and JSON::Validator (0.82), it now seems to work. Looks like the author of JSON::Validator just patched some issues regarding to resolving $refs. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |17008 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17008 [Bug 17008] REST API: Correct data types in Swagger -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 --- Comment #11 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 55437 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=55437&action=edit Bug 17032 [QA Followup] - Update path to swagger.json file -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com Status|Passed QA |Pushed to Master --- Comment #12 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to master for 16.11, thanks Lari, Jonathan! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Bug 17032 depends on bug 13799, which changed state. Bug 13799 Summary: Add base for building RESTful API https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13799 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |17654 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17654 [Bug 17654] Add tests to enforce swagger definition files integrity -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17032 Mason James <mtj@kohaaloha.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtj@kohaaloha.com --- Comment #13 from Mason James <mtj@kohaaloha.com> --- Enhancement, skipping for 16.05.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org