Skip to content

Commit

Permalink
EDGPATRON-144: Updated API doc for external_patron as per new modifie…
Browse files Browse the repository at this point in the history
…d error scenario (#127)

* EDGPATRON-144: updated API doc for external_patron as per new modified error scenario

---------

Co-authored-by: Kapil Verma <[email protected]>
  • Loading branch information
kapil-epam and kverma2013 authored Aug 8, 2024
1 parent 1835b01 commit 7365c9e
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 22 deletions.
30 changes: 20 additions & 10 deletions ramls/edge-patron.raml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ 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 schemas/external_patron_error.schema
external_patron_error_404: !include schemas/external_patron_error_404.schema
external_patron_error_get_422: !include schemas/external_patron_error_get_422.schema
external_patron_error_post_422: !include schemas/external_patron_error_post_422.schema
external_patron_error_put_422: !include schemas/external_patron_error_put_422.schema

/patron:
displayName: Patron Services
Expand Down Expand Up @@ -72,7 +75,7 @@ types:
description: Validation error
body:
application/json:
type: external_patron_error
type: external_patron_error_post_422
example: !include examples/external_patron_error.json
500:
description: |
Expand Down Expand Up @@ -154,8 +157,15 @@ types:
404:
description: Item with a given EMAIL not found
body:
text/plain:
example: account not found
application/json:
type: external_patron_error_404
example: !include examples/external_patron_error.json
422:
description: Validation error
body:
application/json:
type: external_patron_error_get_422
example: !include examples/external_patron_error.json
403:
description: Access Denied
body:
Expand Down Expand Up @@ -187,9 +197,8 @@ types:
400:
description: Bad request
body:
application/json:
type: external_patron_error
example: !include examples/external_patron_error.json
text/plain:
example: unable to process request
401:
description: Not authorized to perform requested action
body:
Expand All @@ -199,7 +208,7 @@ types:
description: Item with a given ID not found
body:
application/json:
type: external_patron_error
type: external_patron_error_404
example: !include examples/external_patron_error.json
403:
description: Access Denied
Expand All @@ -214,8 +223,9 @@ types:
422:
description: Validation error
body:
text/plain:
example: Validation error
application/json:
type: external_patron_error_put_422
example: !include examples/external_patron_error.json
500:
description: |
Internal server error, e.g. due to misconfiguration
Expand Down
26 changes: 26 additions & 0 deletions ramls/schemas/external_patron_error_404.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$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": "USER_NOT_FOUND",
"description": "User does not exist"
}
]
}
},
"required": [
"code",
"errorMessage"
]
}
26 changes: 26 additions & 0 deletions ramls/schemas/external_patron_error_get_422.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$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"
}
]
}
},
"required": [
"code",
"errorMessage"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,9 @@
"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"
}
]
}
Expand Down
34 changes: 34 additions & 0 deletions ramls/schemas/external_patron_error_put_422.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$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": "EMAIL_ALREADY_EXIST",
"description": "User already exists with email provided in payload"
},
{
"value": "PATRON_GROUP_NOT_APPLICABLE",
"description": "Required Patron group not applicable for user"
},
{
"value": "MULTIPLE_USER_WITH_EMAIL",
"description": "Multiple users found with the same email"
}
]
}
},
"required": [
"code",
"errorMessage"
]
}

0 comments on commit 7365c9e

Please sign in to comment.