refactor: adjust code to new configuration

This commit is contained in:
Karl-Philipp Wulfert
2019-06-05 17:13:28 +02:00
parent e70d5dccab
commit 4d4f7bf7ac
9 changed files with 221 additions and 118 deletions

View File

@@ -53,14 +53,35 @@ export interface RouteWithMetaInformation {
* Instance of the route
*/
route: {
/**
* Error names of a route
*/
errorNames: Error[];
/**
* Method of the route
*/
method: string;
/**
* Obligatory parameters of the route
*/
obligatoryParameters: {
[k: string]: string;
}
};
/**
* Name of the request body
*/
requestBodyName: string;
/**
* Name of the response body
*/
responseBodyName: string;
/**
* Status code on success
*/
statusCodeSuccess: number;
/**
* URL fragment
*/
urlFragment: string;
};
}
@@ -93,13 +114,21 @@ export interface NodesWithMetaInformation {
* A schema with definitions
*/
interface SchemaWithDefinitions extends JSONSchema {
definitions: { [name: string]: Definition };
/**
* Definitions of the schema
*/
definitions: { [name: string]: Definition; };
}
/**
* An expectable error
*/
export type ExpectableValidationError = ValidationError & { expected: boolean };
export interface ExpectableValidationError extends ValidationError {
/**
* Whether or not the error is expected
*/
expected: boolean;
}
/**
* A map of files and their expectable validation errors
@@ -162,7 +191,9 @@ export function getTsconfigPath(startPath: string): string {
let tsconfigPath = startPath;
// see https://stackoverflow.com/questions/9652043/identifying-the-file-system-root-with-node-js
const root = (platform() === 'win32') ? process.cwd().split(sep)[0] : '/';
const root = (platform() === 'win32') ? process
.cwd()
.split(sep)[0] : '/';
// repeat until a tsconfig.json is found
while (!existsSync(join(tsconfigPath, 'tsconfig.json'))) {