diff --git a/ramls/edge-patron.raml b/ramls/edge-patron.raml index 2941523..26a6db6 100644 --- a/ramls/edge-patron.raml +++ b/ramls/edge-patron.raml @@ -22,6 +22,7 @@ types: allowedServicePoints: !include allowed-service-points-response.json hold-cancellation: !include hold-cancellation.json errors: !include raml-util/schemas/errors.schema + external_patron_error: !include raml-util/schemas/external_patron_error.schema /patron: displayName: Patron Services @@ -70,8 +71,9 @@ types: 422: description: Validation error body: - text/plain: - example: Validation error + application/json: + type: external_patron_error + example: !include examples/external_patron_error.json 500: description: | Internal server error, e.g. due to misconfiguration @@ -185,8 +187,9 @@ types: 400: description: Bad request body: - text/plain: - example: unable to process request + application/json: + type: external_patron_error + example: !include examples/external_patron_error.json 401: description: Not authorized to perform requested action body: @@ -195,8 +198,9 @@ types: 404: description: Item with a given ID not found body: - text/plain: - example: item not found + application/json: + type: external_patron_error + example: !include examples/external_patron_error.json 403: description: Access Denied body: diff --git a/ramls/examples/external_patron_error.json b/ramls/examples/external_patron_error.json new file mode 100644 index 0000000..6bd017a --- /dev/null +++ b/ramls/examples/external_patron_error.json @@ -0,0 +1,4 @@ +{ + "code": 422, + "errorMessage": "USER_ALREADY_EXIST" +} diff --git a/ramls/raml-util b/ramls/raml-util deleted file mode 160000 index 4aaeffa..0000000 --- a/ramls/raml-util +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4aaeffa22d5461b41ac761870dcfce58bf8db387 diff --git a/ramls/raml-util/schemas/external_patron_error.schema b/ramls/raml-util/schemas/external_patron_error.schema new file mode 100644 index 0000000..71feda7 --- /dev/null +++ b/ramls/raml-util/schemas/external_patron_error.schema @@ -0,0 +1,50 @@ +{ + "$schema":"http://json-schema.org/draft-04/schema#", + "id":"external_patron_error.schema", + "description":"An external_patron user error", + "type":"object", + "properties":{ + "code":{ + "type":"integer", + "description":"Error code" + }, + "errorMessage":{ + "type":"string", + "description":"Error message text", + "examples":[ + { + "value":"MULTIPLE_USER_WITH_EMAIL", + "description":"Multiple users found with the same email" + }, + { + "value":"USER_ACCOUNT_INACTIVE", + "description":"User account is not active" + }, + { + "value":"USER_ALREADY_EXIST", + "description":"User already exists" + }, + { + "value":"USER_NOT_FOUND", + "description":"User does not exist" + }, + { + "value":"EMAIL_ALREADY_EXIST", + "description":"User already exists with email provided in payload" + }, + { + "value":"INVALID_PATRON_GROUP", + "description":"User does not belong to the required patron group" + }, + { + "value":"PATRON_GROUP_NOT_APPLICABLE", + "description":"Required Patron group not applicable for user" + } + ] + } + }, + "required":[ + "code", + "errorMessage" + ] +}