From 1e29431b56e5814fc37380c51b39f65a26a7f16c Mon Sep 17 00:00:00 2001 From: John Wright Date: Fri, 22 Mar 2019 10:26:20 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20remove=20unused=20import?= =?UTF-8?q?=20declaration=20(#9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 remove unused import declaration * chore: 🤖 change circle ci so it'll build my branch --- .circleci/config.yml | 3 +-- README.md | 20 +++++++++++++++++-- .../output/ComplexExample.valiator.ts | 2 +- src/printValidator.ts | 3 +-- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 22b1af2..9da17ec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -55,7 +55,6 @@ workflows: all: jobs: - test: - context: common-env filters: branches: ignore: @@ -77,4 +76,4 @@ workflows: only: master jobs: - test: - context: common-env \ No newline at end of file + context: common-env diff --git a/README.md b/README.md index 285cdf4..8aca084 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,6 @@ Usage: typescript-json-schema Options: --help Show help [boolean] --version Show version number [boolean] - --collection Process the file as a collection of types, instead of - one single type. [boolean] [default: false] --refs Create shared ref definitions. [boolean] [default: true] --aliasRefs Create shared ref definitions for the type aliases. [boolean] [default: false] @@ -87,6 +85,24 @@ Options: --rejectDateType Rejects Date fields in type definitions. [boolean] [default: false] --id ID of schema. [string] [default: ""] + --uniqueItems Validate `uniqueItems` keyword [boolean] [default: true] + --unicode calculate correct length of strings with unicode pairs + (true by default). Pass false to use .length of strings + that is faster, but gives "incorrect" lengths of strings + with unicode pairs - each unicode pair is counted as two + characters. [boolean] [default: true] + --nullable support keyword "nullable" from Open API 3 + specification. [boolean] [default: true] + --format formats validation mode ('fast' by default). Pass 'full' + for more correct and slow validation or false not to + validate formats at all. E.g., 25:00:00 and 2015/14/33 + will be invalid time and date in 'full' mode but it will + be valid in 'fast' mode. + [choices: "fast", "full"] [default: "fast"] + --coerceTypes Change data type of data to match type keyword. e.g. + parse numbers in strings [boolean] [default: false] + --collection Process the file as a collection of types, instead of + one single type. [boolean] [default: false] --useNamedExport Type name is a named export, rather than the default export of the file [boolean] [default: false] -* [default: []] diff --git a/src/__tests__/output/ComplexExample.valiator.ts b/src/__tests__/output/ComplexExample.valiator.ts index cd25b04..eb4f9ca 100644 --- a/src/__tests__/output/ComplexExample.valiator.ts +++ b/src/__tests__/output/ComplexExample.valiator.ts @@ -1,6 +1,6 @@ -import {inspect} from 'util'; import Ajv = require('ajv'); import {Context} from 'koa'; +import {inspect} from 'util'; import {MyEnum, TypeA, TypeB, RequestA, RequestB} from '../../ComplexExample'; export const ajv = new Ajv({allErrors: true, coerceTypes: false}); diff --git a/src/printValidator.ts b/src/printValidator.ts index 548c284..a00d9a1 100644 --- a/src/printValidator.ts +++ b/src/printValidator.ts @@ -23,9 +23,8 @@ export function printTypeCollectionValidator( return isKoaType(schema.definitions && schema.definitions[typeName]); }); return [ - t.IMPORT_INSPECT, t.IMPORT_AJV, - ...(koaTypes.length ? [t.IMPORT_KOA_CONTEXT] : []), + ...(koaTypes.length ? [t.IMPORT_KOA_CONTEXT, t.IMPORT_INSPECT] : []), t.importNamedTypes(symbols, relativePath), t.declareAJV(options), t.exportNamed(symbols),