Bug 16699: Reference new x-primitives in currently defined objects
authorLari Taskula <larit@student.uef.fi>
Tue, 14 Jun 2016 11:24:42 +0000 (14:24 +0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 26 Aug 2016 12:08:52 +0000 (12:08 +0000)
Since we have defined some basic x-primitives in x-primitives.json, we can now
start to reuse them in our currently defined objects.

To test:
1. Apply patch
2. Run minifySwagger.pl
3. Validate your Swagger specifications
4. Observe that validation passes

Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi>

My name is Olli-Antti Kivilahti and I approve this commit.
We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now
in production and I am certain we have a pretty good idea on how to work with
the limitations of Swagger2.0
We participated in the development of the Mojolicious::Plugin::Swagger and know
it well. We have made an extension to the plugin to provide full CORS support
and have been building all our in-house features on the new REST API.

Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com>

My name is Johanna Räisä and I approve this commit.
We have been using Swagger2.0-driven REST API in production successfully.

Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

api/v1/definitions/hold.json
api/v1/definitions/patron.json

index 5bbdd82..8703920 100644 (file)
@@ -2,22 +2,19 @@
   "type": "object",
   "properties": {
     "reserve_id": {
-      "description": "Internal hold identifier"
+      "$ref": "../x-primitives.json#/reserve_id"
     },
     "borrowernumber": {
-      "type": "string",
-      "description": "internally assigned user identifier"
+      "$ref": "../x-primitives.json#/borrowernumber"
     },
     "reservedate": {
       "description": "the date the hold was placed"
     },
     "biblionumber": {
-      "type": "string",
-      "description": "internally assigned biblio identifier"
+      "$ref": "../x-primitives.json#/biblionumber"
     },
     "branchcode": {
-      "type": ["string", "null"],
-      "description": "internally assigned branch identifier"
+      "$ref": "../x-primitives.json#/branchcode"
     },
     "notificationdate": {
       "description": "currently unused"
@@ -41,8 +38,7 @@
       "description": "date and time the hold was last updated"
     },
     "itemnumber": {
-      "type": ["string", "null"],
-      "description": "internally assigned item identifier"
+      "$ref": "../x-primitives.json#/itemnumber"
     },
     "waitingdate": {
       "description": "the date the item was marked as waiting for the patron at the library"
index 38cf8db..a021502 100644 (file)
@@ -2,20 +2,16 @@
   "type": "object",
   "properties": {
     "borrowernumber": {
-      "type": "string",
-      "description": "internally assigned user identifier"
+      "$ref": "../x-primitives.json#/borrowernumber"
     },
     "cardnumber": {
-      "type": ["string", "null"],
-      "description": "library assigned user identifier"
+      "$ref": "../x-primitives.json#/cardnumber"
     },
     "surname": {
-      "type": "string",
-      "description": "patron's last name"
+      "$ref": "../x-primitives.json#/surname"
     },
     "firstname": {
-      "type": ["string", "null"],
-      "description": "patron's first name"
+      "$ref": "../x-primitives.json#/firstname"
     },
     "title": {
       "type": ["string", "null"],
       "description": "country of patron's primary address"
     },
     "email": {
-      "type": ["string", "null"],
-      "description": "primary email address for patron's primary address"
+      "$ref": "../x-primitives.json#/email"
     },
     "phone": {
-      "type": ["string", "null"],
-      "description": "primary phone number for patron's primary address"
+      "$ref": "../x-primitives.json#/phone"
     },
     "mobile": {
       "type": ["string", "null"],
       "description": "patron's date of birth"
     },
     "branchcode": {
-      "type": "string",
-      "description": "code of patron's home branch"
+      "$ref": "../x-primitives.json#/branchcode"
     },
     "categorycode": {
       "type": "string",