@@ -, +, @@ "paths": { "$ref": "paths.json" }, "definitions": { "$ref": "definitions.json" }, "parameters": { "$ref": "parameters.json" } -2: Apply the minifier-patch in Bug 16212. -1: Make sure you can validate your specification with Swagger2 validator at online.swagger.io/validator/debug?url=url_to_swaggerjson, or install it locally from https://github.com/swagger-api/validator-badge. with swagger.io-validator (or your local version, if you installed it) problem in swagger.min.json --- api/v1/definitions.json | 14 +++ api/v1/definitions/index.json | 6 -- api/v1/parameters.json | 8 ++ api/v1/parameters/hold.json | 9 ++ api/v1/parameters/patron.json | 9 ++ api/v1/paths.json | 14 +++ api/v1/paths/holds.json | 181 ++++++++++++++++++++++++++++++++ api/v1/paths/patrons.json | 61 +++++++++++ api/v1/swagger.json | 236 +----------------------------------------- 9 files changed, 299 insertions(+), 239 deletions(-) create mode 100644 api/v1/definitions.json delete mode 100644 api/v1/definitions/index.json create mode 100644 api/v1/parameters.json create mode 100644 api/v1/parameters/hold.json create mode 100644 api/v1/parameters/patron.json create mode 100644 api/v1/paths.json create mode 100644 api/v1/paths/holds.json create mode 100644 api/v1/paths/patrons.json --- a/api/v1/definitions.json +++ a/api/v1/definitions.json @@ -0,0 +1,14 @@ +{ + "patron": { + "$ref": "definitions/patron.json" + }, + "holds": { + "$ref": "definitions/holds.json" + }, + "hold": { + "$ref": "definitions/hold.json" + }, + "error": { + "$ref": "definitions/error.json" + } +} --- a/api/v1/definitions/index.json +++ a/api/v1/definitions/index.json @@ -1,6 +0,0 @@ -{ - "patron": { "$ref": "patron.json" }, - "holds": { "$ref": "holds.json" }, - "hold": { "$ref": "hold.json" }, - "error": { "$ref": "error.json" } -} --- a/api/v1/parameters.json +++ a/api/v1/parameters.json @@ -0,0 +1,8 @@ +{ + "borrowernumberPathParam": { + "$ref": "parameters/patron.json#/borrowernumberPathParam" + }, + "holdIdPathParam": { + "$ref": "parameters/hold.json#/holdIdPathParam" + } +} --- a/api/v1/parameters/hold.json +++ a/api/v1/parameters/hold.json @@ -0,0 +1,9 @@ +{ + "holdIdPathParam": { + "name": "reserve_id", + "in": "path", + "description": "Internal hold identifier", + "required": true, + "type": "integer" + } +} --- a/api/v1/parameters/patron.json +++ a/api/v1/parameters/patron.json @@ -0,0 +1,9 @@ +{ + "borrowernumberPathParam": { + "name": "borrowernumber", + "in": "path", + "description": "Internal patron identifier", + "required": true, + "type": "integer" + } +} --- a/api/v1/paths.json +++ a/api/v1/paths.json @@ -0,0 +1,14 @@ +{ + "/holds": { + "$ref": "paths/holds.json#/~1holds" + }, + "/holds/{reserve_id}": { + "$ref": "paths/holds.json#/~1holds~1{reserve_id}" + }, + "/patrons": { + "$ref": "paths/patrons.json#/~1patrons" + }, + "/patrons/{borrowernumber}": { + "$ref": "paths/patrons.json#/~1patrons~1{borrowernumber}" + } +} --- a/api/v1/paths/holds.json +++ a/api/v1/paths/holds.json @@ -0,0 +1,181 @@ +{ + "/holds": { + "get": { + "operationId": "listHolds", + "tags": ["borrowers", "holds"], + "parameters": [{ + "name": "borrowernumber", + "in": "query", + "description": "Internal borrower identifier", + "required": true, + "type": "integer" + } + ], + "produces": ["application/json"], + "responses": { + "200": { + "description": "A list of holds", + "schema": { + "$ref": "../definitions.json#/holds" + } + }, + "404": { + "description": "Borrower not found", + "schema": { + "$ref": "../definitions.json#/error" + } + } + } + }, + "post": { + "operationId": "addHold", + "tags": ["borrowers", "holds"], + "parameters": [{ + "name": "body", + "in": "body", + "description": "A JSON object containing informations about the new hold", + "required": true, + "schema": { + "type": "object", + "properties": { + "borrowernumber": { + "description": "Borrower internal identifier", + "type": "integer" + }, + "biblionumber": { + "description": "Biblio internal identifier", + "type": "integer" + }, + "itemnumber": { + "description": "Item internal identifier", + "type": "integer" + }, + "branchcode": { + "description": "Pickup location", + "type": "string" + }, + "expirationdate": { + "description": "Hold end date", + "type": "string", + "format": "date" + } + } + } + } + ], + "consumes": ["application/json"], + "produces": ["application/json"], + "responses": { + "201": { + "description": "Created hold", + "schema": { + "$ref": "../definitions.json#/hold" + } + }, + "400": { + "description": "Missing or wrong parameters", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "403": { + "description": "Hold not allowed", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "404": { + "description": "Borrower not found", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "500": { + "description": "Internal error", + "schema": { + "$ref": "../definitions.json#/error" + } + } + } + } + }, + "/holds/{reserve_id}": { + "put": { + "operationId": "editHold", + "tags": ["holds"], + "parameters": [{ + "$ref": "../parameters.json#/holdIdPathParam" + }, { + "name": "body", + "in": "body", + "description": "A JSON object containing fields to modify", + "required": true, + "schema": { + "type": "object", + "properties": { + "priority": { + "description": "Position in waiting queue", + "type": "integer", + "minimum": 1 + }, + "branchcode": { + "description": "Pickup location", + "type": "string" + }, + "suspend_until": { + "description": "Suspend until", + "type": "string", + "format": "date" + } + } + } + } + ], + "consumes": ["application/json"], + "produces": ["application/json"], + "responses": { + "200": { + "description": "Updated hold", + "schema": { + "$ref": "../definitions.json#/hold" + } + }, + "400": { + "description": "Missing or wrong parameters", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "404": { + "description": "Hold not found", + "schema": { + "$ref": "../definitions.json#/error" + } + } + } + }, + "delete": { + "operationId": "deleteHold", + "tags": ["holds"], + "parameters": [{ + "$ref": "../parameters.json#/holdIdPathParam" + } + ], + "produces": ["application/json"], + "responses": { + "200": { + "description": "Successful deletion", + "schema": { + "type": "object" + } + }, + "404": { + "description": "Hold not found", + "schema": { + "$ref": "../definitions.json#/error" + } + } + } + } + } +} --- a/api/v1/paths/patrons.json +++ a/api/v1/paths/patrons.json @@ -0,0 +1,61 @@ +{ + "/patrons": { + "get": { + "operationId": "listPatrons", + "tags": ["patrons"], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "A list of patrons", + "schema": { + "type": "array", + "items": { + "$ref": "../definitions.json#/patron" + } + } + }, + "403": { + "description": "Access forbidden", + "schema": { + "$ref": "../definitions.json#/error" + } + } + } + } + }, + "/patrons/{borrowernumber}": { + "get": { + "operationId": "getPatron", + "tags": ["patrons"], + "parameters": [{ + "$ref": "../parameters.json#/borrowernumberPathParam" + } + ], + "produces": [ + "application/json" + ], + "responses": { + "200": { + "description": "A patron", + "schema": { + "$ref": "../definitions.json#/patron" + } + }, + "403": { + "description": "Access forbidden", + "schema": { + "$ref": "../definitions.json#/error" + } + }, + "404": { + "description": "Patron not found", + "schema": { + "$ref": "../definitions.json#/error" + } + } + } + } + } +} --- a/api/v1/swagger.json +++ a/api/v1/swagger.json @@ -14,242 +14,12 @@ }, "basePath": "/api/v1", "paths": { - "/patrons": { - "get": { - "operationId": "listPatrons", - "tags": ["patrons"], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "A list of patrons", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/patron" - } - } - }, - "403": { - "description": "Access forbidden", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/patrons/{borrowernumber}": { - "get": { - "operationId": "getPatron", - "tags": ["patrons"], - "parameters": [ - { - "$ref": "#/parameters/borrowernumberPathParam" - } - ], - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "A patron", - "schema": { - "$ref": "#/definitions/patron" - } - }, - "403": { - "description": "Access forbidden", - "schema": { - "$ref": "#/definitions/error" - } - }, - "404": { - "description": "Patron not found", - "schema": { - "$ref": "#/definitions/error" - } - } - } - } - }, - "/holds": { - "get": { - "operationId": "listHolds", - "tags": ["borrowers", "holds"], - "parameters": [ - { - "name": "borrowernumber", - "in": "query", - "description": "Internal borrower identifier", - "required": true, - "type": "integer" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "A list of holds", - "schema": { "$ref": "#/definitions/holds" } - }, - "404": { - "description": "Borrower not found", - "schema": { "$ref": "#/definitions/error" } - } - } - }, - "post": { - "operationId": "addHold", - "tags": ["borrowers", "holds"], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "A JSON object containing informations about the new hold", - "required": true, - "schema": { - "type": "object", - "properties": { - "borrowernumber": { - "description": "Borrower internal identifier", - "type": "integer" - }, - "biblionumber": { - "description": "Biblio internal identifier", - "type": "integer" - }, - "itemnumber": { - "description": "Item internal identifier", - "type": "integer" - }, - "branchcode": { - "description": "Pickup location", - "type": "string" - }, - "expirationdate": { - "description": "Hold end date", - "type": "string", - "format": "date" - } - } - } - } - ], - "consumes": ["application/json"], - "produces": ["application/json"], - "responses": { - "201": { - "description": "Created hold", - "schema": { "$ref": "#/definitions/hold" } - }, - "400": { - "description": "Missing or wrong parameters", - "schema": { "$ref": "#/definitions/error" } - }, - "403": { - "description": "Hold not allowed", - "schema": { "$ref": "#/definitions/error" } - }, - "404": { - "description": "Borrower not found", - "schema": { "$ref": "#/definitions/error" } - }, - "500": { - "description": "Internal error", - "schema": { "$ref": "#/definitions/error" } - } - } - } - }, - "/holds/{reserve_id}": { - "put": { - "operationId": "editHold", - "tags": ["holds"], - "parameters": [ - { "$ref": "#/parameters/holdIdPathParam" }, - { - "name": "body", - "in": "body", - "description": "A JSON object containing fields to modify", - "required": true, - "schema": { - "type": "object", - "properties": { - "priority": { - "description": "Position in waiting queue", - "type": "integer", - "minimum": 1 - }, - "branchcode": { - "description": "Pickup location", - "type": "string" - }, - "suspend_until": { - "description": "Suspend until", - "type": "string", - "format": "date" - } - } - } - } - ], - "consumes": ["application/json"], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Updated hold", - "schema": { "$ref": "#/definitions/hold" } - }, - "400": { - "description": "Missing or wrong parameters", - "schema": { "$ref": "#/definitions/error" } - }, - "404": { - "description": "Hold not found", - "schema": { "$ref": "#/definitions/error" } - } - } - }, - "delete": { - "operationId": "deleteHold", - "tags": ["holds"], - "parameters": [ - { "$ref": "#/parameters/holdIdPathParam" } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successful deletion", - "schema": { - "type": "object" - } - }, - "404": { - "description": "Hold not found", - "schema": { "$ref": "#/definitions/error" } - } - } - } - } + "$ref": "paths.json" }, "definitions": { - "$ref": "./definitions/index.json" + "$ref": "definitions.json" }, "parameters": { - "borrowernumberPathParam": { - "name": "borrowernumber", - "in": "path", - "description": "Internal patron identifier", - "required": true, - "type": "integer" - }, - "holdIdPathParam": { - "name": "reserve_id", - "in": "path", - "description": "Internal hold identifier", - "required": true, - "type": "integer" - } + "$ref": "parameters.json" } } --