Open JohnnyDeeee opened 1 year ago
The api docs don't contain any error response schemas, only successful responses.
I'm using a openapi generated typescript sdk which uses a generic ResponseError class for the errors
ResponseError
export declare class ResponseError extends Error { response: Response; name: "ResponseError"; constructor(response: Response, msg?: string); }
But this means i have to guess the schema like this
api.getMyShips() .then(response => console.log(response)) .catch(async (err: ResponseError) => { const json = await err.response.json(); console.error(err.message, json.error.code); });
Would be better if we had something like
api.getMyShips() .then(response => console.log(response)) .catch((response: GetMyShips401Response) => console.log(response.error.message));
Just like GetMyShips200Response
GetMyShips200Response
export interface GetMyShips200Response { /** * * @type {Array<Ship>} * @memberof GetMyShips200Response */ data: Array<Ship>; /** * * @type {Meta} * @memberof GetMyShips200Response */ meta: Meta; }
Absolutely, we'll add all the error codes as response objects in the schema.
The api docs don't contain any error response schemas, only successful responses.
I'm using a openapi generated typescript sdk which uses a generic
ResponseError
class for the errorsBut this means i have to guess the schema like this
Would be better if we had something like
Just like
GetMyShips200Response