-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
#16 Similar Error Definitions with Same & Different Names in Swagger Specs
There are several similar error definitions across Azure Swagger specs with same & different names.
In languages like Java and C#, similar error definitions with same & different names generate similar, multiple exception class definitions with same & different names in different name spaces.
Azure libraries for Java and other such languages carry a large surface area. A major part of API ergonomics is consistent naming themes, uniform definition of errors, uniform error handling, etc. Consistency makes it easier to use and memorize and also enables portability of learning. Having learnt a part of the library, developers can apply that learning across other parts of the libraries.
In Swagger specifications, designers should avoid duplicate definition of errors with same or different names. This, in turn, helps language-specific client library generators to choose an already existing exception class for each kind of abnormal condition that may cause an operation to thrown an error; define new exception classes, if needed.
The table below describes the current state - 16 similar error definitions with different names. These definitions can be represented with a single base error definition that comprises of {code, message, source-of-error, description, details} and Swagger specs MAY extend the definition to differentiate or pack additional info.
| # | Service | Error | Code | Message | Source-of-error | Description | Details | Additional-info |
|---|---|---|---|---|---|---|---|---|
| 1 | CDN | ErrorResponse | Y | Y | ||||
| 2 | Compute | ApiError | Y | Y | Y | Y | Y | |
| 3 | Data Lake Analytics Account | Error | Y | Y | Y | Y | Y | |
| 4 | Data Lake Job | Job Error Details | Y | Y | Y | Plenty of info | ||
| 5 | Data Lake Store Account | Error | Y | Y | Y | Y | Y | Y |
| 6 | Intune | Error | Y | Y | ||||
| 7 | Mobile Management | ApiError | Y | Y | ||||
| 8 | Network | Error | Y | Y | Y | Y | Y | |
| 9 | Resources - Resources | ResourceManagementErrorWithDetails | Y | Y | Y | Y | ||
| 10 | Batch | DeleteCertificateError | Y | Y | Y | Y | ||
| 11 | Batch | JobSchedulingError | Y | Y | Y | Y | ||
| 12 | Batch | TaskSchedulingError | Y | Y | Y | Y | ||
| 13 | Batch | AutoScaleRunError | Y | Y | Y | Y | ||
| 14 | Batch | ResizeError | Y | Y | Y | Y | ||
| 15 | Batch | ComputeNodeError | Y | Y | Y | Y | ||
| 16 | Batch | BatchError | Y | Y | Y | Y |