refactor: remove deprecated and unused methods

This commit is contained in:
Michel Jonathan Schmitz
2019-02-22 11:09:35 +01:00
parent 4984f78d95
commit 1dbb59b9d7
5 changed files with 272 additions and 273 deletions

View File

@@ -155,16 +155,6 @@ export function isSchemaWithDefinitions(schema: JSONSchema): schema is SchemaWit
return typeof schema.definitions !== 'undefined';
}
/**
* Guard method for determining if an object (a thing) has a type property with a type of string
*
* @param thing {any} Any object (thing)
* @returns {boolean} Is an object (a thing) with a type property with type of string
*/
export function isThingWithType(thing: any): thing is { type: string } {
return typeof thing.type === 'string';
}
/**
* Get path that contains a tsconfig.json
*

View File

@@ -20,7 +20,6 @@ import {basename, join, resolve} from 'path';
import {
ExpectableValidationErrors,
globPromisified,
isThingWithType,
logger,
readFilePromisified,
writeFilePromisified,
@@ -92,26 +91,6 @@ export class Validator {
return this.validator.validate(instance, this.schemas[schemaName]);
}
/**
* Validate an instance of a thing against the consumed schema files
*
* Only use this method for instances of the SC with a set type property
*
* @param instance Instance to validate
* @deprecated Use [[validate]] instead
*/
public validateThing<T>(instance: T): ValidatorResult {
if (!isThingWithType(instance)) {
throw new Error('Instance.type does not exist.');
}
const schemaName = 'SC' + instance.type.split(' ').map((part) => {
return part.substr(0, 1).toUpperCase() + part.substr(1);
}).join('');
return this.validate(instance, schemaName);
}
}
/**