Skip to content

Commit

Permalink
Merge pull request #104 from jlurien/chore/errors-alignment-with-guid…
Browse files Browse the repository at this point in the history
…elines

Align error format with Commonalities guidelines
  • Loading branch information
hdamker authored Feb 10, 2023
2 parents d25744f + 1e58c7f commit 39f9c9b
Showing 1 changed file with 188 additions and 82 deletions.
270 changes: 188 additions & 82 deletions code/API_definitions/qod-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,46 +50,53 @@ paths:
schema:
$ref: "#/components/schemas/SessionInfo"
"400":
description: Invalid input
description: Invalid input for createSession operation
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
$ref: "#/components/schemas/Error400"
examples:
Generic400:
summary: Schema validation failed
value:
code: INVALID_INPUT
value:
status: 400
code: INVALID_ARGUMENT
message: "Schema validation failed at ..."
MsisdnRequired:
summary: msisdn is required as part of ueId
value:
code: INVALID_INPUT
value:
status: 400
code: INVALID_ARGUMENT
message: "Expected property is missing: ueId.msisdn"
IPv4Required:
summary: ipv4addr is required as part of ueId
value:
code: INVALID_INPUT
value:
status: 400
code: INVALID_ARGUMENT
message: "Expected property is missing: ueId.ipv4addr"
IPRequired:
summary: Some IP address is required as part of ueId
value:
code: INVALID_INPUT
value:
status: 400
code: INVALID_ARGUMENT
message: "Expected property is missing: ueId.ipv4addr or ueId.ipv6addr"
UePortsRequired:
summary: uePorts is required
value:
code: INVALID_INPUT
value:
status: 400
code: INVALID_ARGUMENT
message: "Expected property is missing: uePorts"
QoSRequired:
summary: qos is required
value:
code: INVALID_INPUT
value:
status: 400
code: INVALID_ARGUMENT
message: "Expected property is missing: qos"
UePortsRangesNotAllowed:
summary: Ranges at uePorts are not allowed
value:
code: INVALID_INPUT
value:
status: 400
code: INVALID_ARGUMENT
message: "Ranges not allowed: uePorts"
"401":
$ref: "#/components/responses/Generic401"
Expand All @@ -100,19 +107,13 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
$ref: "#/components/schemas/Error409"
example:
status: 409
code: CONFLICT
message: "Another session is created for the same UE"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
code: INTERNAL
message: "Session could not be created"
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
/sessions/{sessionId}:
Expand Down Expand Up @@ -142,14 +143,7 @@ paths:
"404":
$ref: "#/components/responses/SessionNotFound404"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
code: INTERNAL
message: "Could not get session information"
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
delete:
Expand All @@ -174,14 +168,7 @@ paths:
"404":
$ref: "#/components/responses/SessionNotFound404"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
code: INTERNAL
message: "Session could not be deleted"
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
/notifications:
Expand Down Expand Up @@ -210,14 +197,7 @@ paths:
"403":
$ref: "#/components/responses/Generic403"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
example:
code: INTERNAL
message: "Failed to handle notification"
$ref: "#/components/responses/Generic500"
"503":
$ref: "#/components/responses/Generic503"
security:
Expand Down Expand Up @@ -410,18 +390,6 @@ components:
enum:
- QOS_STATUS_CHANGED

ErrorInfo:
type: object
required:
- code
- message
properties:
code:
type: string
description: Code given to this error
message:
type: string
description: Detailed error description
UeId:
type: object
minProperties: 1
Expand Down Expand Up @@ -490,61 +458,199 @@ components:
required:
- severity
- description

QosStatus:
type: string
enum:
- REQUESTED
- AVAILABLE
- UNAVAILABLE
description: |
* `REQUESTED` - QoS has been requested by creating a session
* `AVAILABLE` - The requested QoS has been provided by the network
* `UNAVAILABLE` - The requested QoS cannot be provided by the network due to some reason
ErrorInfo:
type: object
required:
- status
- code
- message
properties:
status:
type: integer
description: HTTP status code returned along with this error response
code:
type: string
description: Code given to this error
message:
type: string
description: Detailed error description
Error400:
type: object
required:
- status
- code
- message
properties:
status:
type: integer
enum:
- 400
code:
type: string
enum:
- INVALID_ARGUMENT
message:
type: string
Error401:
type: object
required:
- status
- code
- message
properties:
status:
type: integer
enum:
- 401
code:
type: string
enum:
- UNAUTHENTICATED
message:
type: string
Error403:
type: object
required:
- status
- code
- message
properties:
status:
type: integer
enum:
- 403
code:
type: string
enum:
- PERMISSION_DENIED
message:
type: string
Error404:
type: object
required:
- status
- code
- message
properties:
status:
type: integer
enum:
- 404
code:
type: string
enum:
- NOT_FOUND
message:
type: string
Error409:
type: object
required:
- status
- code
- message
properties:
status:
type: integer
enum:
- 409
code:
type: string
enum:
- CONFLICT
message:
type: string
Error500:
type: object
required:
- status
- code
- message
properties:
status:
type: integer
enum:
- 500
code:
type: string
enum:
- INTERNAL
message:
type: string
Error503:
type: object
required:
- status
- code
- message
properties:
status:
type: integer
enum:
- 503
code:
type: string
enum:
- UNAVAILABLE
message:
type: string
responses:
Generic400:
description: Invalid input
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
$ref: "#/components/schemas/Error400"
example:
code: INVALID_INPUT
status: 400
code: INVALID_ARGUMENT
message: "Schema validation failed at ..."
Generic401:
description: Unauthorized
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
$ref: "#/components/schemas/Error401"
example:
code: UNAUTHORIZED
status: 401
code: UNAUTHENTICATED
message: "Authorization failed: ..."
Generic403:
description: Forbidden
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
$ref: "#/components/schemas/Error403"
example:
code: FORBIDDEN
status: 403
code: PERMISSION_DENIED
message: "Operation not allowed: ..."
SessionNotFound404:
description: Session not found
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
$ref: "#/components/schemas/Error404"
example:
status: 404
code: NOT_FOUND
message: "Session Id does not exist"
Generic500:
description: Internal server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error500"
example:
status: 500
code: INTERNAL
message: "Internal server error: ..."
Generic503:
description: Service unavailable
content:
application/json:
schema:
$ref: "#/components/schemas/ErrorInfo"
$ref: "#/components/schemas/Error503"
example:
code: SERVICE_UNAVAILABLE
status: 503
code: UNAVAILABLE
message: "Service unavailable"

0 comments on commit 39f9c9b

Please sign in to comment.