Bug 17927: Fix /holds and /patrons data types
authorLari Taskula <larit@student.uef.fi>
Tue, 16 Aug 2016 10:37:29 +0000 (13:37 +0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Tue, 7 Feb 2017 17:55:43 +0000 (17:55 +0000)
This patch changes current Swagger definitions for patrons and holds to have
data types corresponding to column data types in their database tables.

To test:
1. GET http://yourlibrary/api/v1/patrons/YYY where YYY is existing borrowernumber
2. Observe that numbers / integers are in string data type.
3. Apply this patch
4. Repeat step 1.
5. Observe that numbers / integers are now actually numbers / integers.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
api/v1/swagger/definitions/hold.json
api/v1/swagger/definitions/patron.json
api/v1/swagger/x-primitives.json

index 8703920..a1d82fa 100644 (file)
@@ -8,51 +8,65 @@
       "$ref": "../x-primitives.json#/borrowernumber"
     },
     "reservedate": {
+      "type": ["string", "null"],
       "description": "the date the hold was placed"
     },
     "biblionumber": {
       "$ref": "../x-primitives.json#/biblionumber"
     },
     "branchcode": {
-      "$ref": "../x-primitives.json#/branchcode"
+      "type": ["string", "null"],
+      "description": "code of patron's home branch"
     },
     "notificationdate": {
+      "type": ["string", "null"],
       "description": "currently unused"
     },
     "reminderdate": {
+      "type": ["string", "null"],
       "description": "currently unused"
     },
     "cancellationdate": {
+      "type": ["string", "null"],
       "description": "the date the hold was cancelled"
     },
     "reservenotes": {
+      "type": ["string", "null"],
       "description": "notes related to this hold"
     },
     "priority": {
+      "type": ["integer", "null"],
       "description": "where in the queue the patron sits"
     },
     "found": {
+      "type": ["string", "null"],
       "description": "a one letter code defining what the status of the hold is after it has been confirmed"
     },
     "timestamp": {
+      "type": "string",
       "description": "date and time the hold was last updated"
     },
     "itemnumber": {
       "$ref": "../x-primitives.json#/itemnumber"
     },
     "waitingdate": {
+      "type": ["string", "null"],
       "description": "the date the item was marked as waiting for the patron at the library"
     },
     "expirationdate": {
+      "type": ["string", "null"],
       "description": "the date the hold expires"
     },
     "lowestPriority": {
+      "type": "integer",
       "description": ""
     },
     "suspend": {
+      "type": "integer",
       "description": ""
     },
     "suspend_until": {
+      "type": ["string", "null"],
       "description": ""
     },
     "itemtype": {
index c93c4ba..6becabc 100644 (file)
       "description": "patron's date of birth"
     },
     "branchcode": {
-      "$ref": "../x-primitives.json#/branchcode"
+      "type": "string",
+      "description": "code of patron's home branch"
     },
     "categorycode": {
       "type": "string",
       "description": "date the patron's card is set to expire"
     },
     "gonenoaddress": {
-      "type": ["string", "null"],
+      "type": ["integer", "null"],
       "description": "set to 1 if library marked this patron as having an unconfirmed address"
     },
     "lost": {
-      "type": ["string", "null"],
+      "type": ["integer", "null"],
       "description": "set to 1 if library marked this patron as having lost his card"
     },
     "debarred": {
       "description": "used for children to include title of guarantor"
     },
     "guarantorid": {
-      "type": ["string", "null"],
+      "type": ["integer", "null"],
       "description": "borrowernumber used for children or professionals to link them to guarantor or organizations"
     },
     "borrowernotes": {
       "description": "patron's encrypted password"
     },
     "flags": {
-      "type": ["string", "null"],
+      "type": ["integer", "null"],
       "description": "a number associated with the patron's permissions"
     },
     "userid": {
       "description": "the mobile phone number where the patron would like to receive notices (if SMS turned on)"
     },
     "sms_provider_id": {
-      "type": ["string", "null"],
+      "type": ["integer", "null"],
       "description": "the provider of the mobile phone number defined in smsalertnumber"
     },
     "privacy": {
-      "type": "string",
+      "type": "integer",
       "description": "patron's privacy settings related to their reading history"
     },
     "privacy_guarantor_checkouts": {
-      "type": "string",
+      "type": "integer",
       "description": "controls if relatives can see this patron's checkouts"
     },
     "checkprevcheckout": {
index 1b90b30..ded911f 100644 (file)
@@ -1,16 +1,12 @@
 {
   "biblionumber": {
-    "type": "string",
+    "type": "integer",
     "description": "internally assigned biblio identifier"
   },
   "borrowernumber": {
-    "type": "string",
+    "type": "integer",
     "description": "internally assigned user identifier"
   },
-  "branchcode": {
-    "type": ["string", "null"],
-    "description": "code of patron's home branch"
-  },
   "cardnumber": {
     "type": ["string", "null"],
     "description": "library assigned user identifier"
@@ -29,7 +25,7 @@
     "description": "patron's first name"
   },
   "itemnumber": {
-    "type": ["string", "null"],
+    "type": ["integer", "null"],
     "description": "internally assigned item identifier"
   },
   "phone": {
@@ -37,6 +33,7 @@
     "description": "primary phone number for patron's primary address"
   },
   "reserve_id": {
+    "type": "integer",
     "description": "Internal hold identifier"
   },
   "surname": {