feat: replace route markdown with openapi

This commit is contained in:
Rainer Killinger
2021-07-06 10:51:05 +02:00
parent a1e820336f
commit f4bf7abc89
9 changed files with 262 additions and 129 deletions

View File

@@ -56,9 +56,9 @@ export interface RouteWithMetaInformation {
*/
route: {
/**
* Error names of a route
* Possible errors on a route
*/
errorNames: Error[];
errors: SCErrorResponse[];
/**
* Method of the route
*/
@@ -69,10 +69,18 @@ export interface RouteWithMetaInformation {
obligatoryParameters: {
[k: string]: string;
};
/**
* Description of the request body
*/
requestBodyDescription: string;
/**
* Name of the request body
*/
requestBodyName: string;
/**
* Description of the response body
*/
responseBodyDescription: string;
/**
* Name of the response body
*/
@@ -86,6 +94,10 @@ export interface RouteWithMetaInformation {
*/
urlFragment: string;
};
/**
* Possible tags/keywords the route can be associated with
*/
tags?: [string];
}
/**
@@ -102,6 +114,21 @@ export interface NodeWithMetaInformation {
type: string;
}
/**
* A generic error that can be returned by the backend if somethings fails during the processing of a request
*/
export interface SCErrorResponse extends Error {
/**
* Additional data that describes the error
*/
additionalData?: unknown;
/**
* HTTP status code to return this error with
*/
statusCode: number;
}
/**
* A map of nodes indexed by their name
*/
@@ -345,3 +372,13 @@ export function getFullTypeName(type: LightweightType): string {
return fullName;
}
/**
* Creates sentence cased string
*
* @param str The string to capitalize
*/
export function capitalize(str?: string): string {
// tslint:disable-next-line: newline-per-chained-call
return `${str?.charAt(0).toUpperCase()}${str?.slice(1).toLowerCase()}`;
}