Closed anacabbar closed 2 months ago
Error responses should be meaningful and helpful for handling the errors. It should not only inform about a problem, but also assist in dealing with it. Ideally, an error message provides a machine- and human-readable recommendation for the next step to be taken (e.g. as part of an automation).
How to define error responses in the OAS:
For example:
components:
responses:
429:
description: 'Response to be send whenever the number of currently executed requests reached the maximum defined in the instance of IntegerProfile with its name containing limitOfParallelRequestsAt and the service name.'
content:
application/json:
schema:
type: object
required:
- code
- message
- expectation-to-the-client
properties:
code:
type: integer
format: int32
message:
type: string
enum:
- 'The number of requests that can be handled by this service in parallel has been reached'
expectation-to-the-client:
type: string
enum:
- 'Please try again later'
Current Proposal For Errored Responses:
For general scenarios, which are covered by the standardized HTTP Status Codes, the following codes are used:
Code: 429 Message: Too many requests. The maximum amount of requests that can be executed in parallel or per minute has been reached Description: Response in case of errored service requests due to too many parallel requests or too many requests per minute
Code: 502 Message: The requested upstream server is unavailable. Description: A requested upstream server (e.g. MicrowaveDeviceInventory) is unavailable.
For scenarios which are specific to our domain, the following HTTP Status Codes have been defined. It has been attempted to keep the messages and descriptions general enough, so that these could be used accross several applications and APIs (and eventually integrated into the application pattern).
Code: 460 Message: Requested device is not found in the list of devices connected to the controller. Description: Response in case the mountName provided in the request is not found in the (internally) stored list of connected devices.
Code: 470 Message: The requested ressource does not exist within the referenced device. Description: 'Process disrupted because the requested ressource does not exist within the referenced device'
Error codes and messages added to the APTP v1.1.0 as per the proposal above
Currently the ALAP is providing an error response
for varied possible failure reasons (e.g. MDWI unavailable, invalid mount-name).
The error responses should be made more specific, so that more insight about the failure cause is provided to the consuming application.