mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-09 19:22:51 +00:00
refactor: remove deprecated and unused methods
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user