diff --git a/src/schema.ts b/src/schema.ts index 28b39795..f96fd1de 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -14,13 +14,13 @@ */ import Ajv from 'ajv'; import {JSONSchema7 as JSONSchema} from 'json-schema'; -import {filter} from 'lodash'; +import {chain} from 'lodash'; import {Config, DEFAULT_CONFIG, Definition, SchemaGenerator} from 'ts-json-schema-generator'; import {createFormatter} from 'ts-json-schema-generator/dist/factory/formatter'; import {createParser} from 'ts-json-schema-generator/dist/factory/parser'; import {createProgram} from 'ts-json-schema-generator/dist/factory/program'; import {getTsconfigPath} from './common'; -import {definitionsOf, isLightweightClass} from './easy-ast/ast-util'; +import {definitionsOf} from './easy-ast/ast-util'; import {lightweightProjectFromPath} from './easy-ast/easy-ast'; import {isSchemaWithDefinitions} from './util/guards'; import path from 'path'; @@ -113,7 +113,8 @@ export class Converter { * Get a list of validatable types from an API extractor file */ export function getValidatableTypesInPath(path: string): string[] { - return filter(definitionsOf(lightweightProjectFromPath(path)), isLightweightClass) - .filter(type => type.comment?.tags?.find(it => it.name === 'validatable')) - .map(type => type.name); + return chain(definitionsOf(lightweightProjectFromPath(path))) + .filter(type => !!type.comment?.tags?.find(it => it.name === 'validatable')) + .map(type => type.name) + .value(); }