From 1e4e705c32478612608b5b1d4a730918bedb9e03 Mon Sep 17 00:00:00 2001 From: Ferdi Koomen Date: Tue, 3 Dec 2019 16:34:27 +0100 Subject: [PATCH] - Added some helpers --- src/openApi/v2/parser/constants.ts | 2 +- src/openApi/v2/parser/getType.spec.ts | 8 +- src/openApi/v2/parser/getType.ts | 6 +- src/openApi/v3/parser/getType.spec.ts | 8 +- src/openApi/v3/parser/getType.ts | 6 +- .../javascript/partials/validationArray.hbs | 6 +- .../javascript/partials/validationBasics.hbs | 1 + .../javascript/partials/validationEnum.hbs | 6 +- .../javascript/partials/validationGeneric.hbs | 10 +- .../partials/validationInterface.hbs | 9 +- .../partials/validationReference.hbs | 4 +- .../typescript/partials/validationArray.hbs | 6 +- .../typescript/partials/validationBasics.hbs | 1 + .../typescript/partials/validationEnum.hbs | 6 +- .../typescript/partials/validationGeneric.hbs | 10 +- .../partials/validationInterface.hbs | 9 +- .../partials/validationReference.hbs | 4 +- test/__snapshots__/index.spec.js.snap | 1594 ++++++++--------- yarn.lock | 231 ++- 19 files changed, 944 insertions(+), 983 deletions(-) create mode 100644 src/templates/javascript/partials/validationBasics.hbs create mode 100644 src/templates/typescript/partials/validationBasics.hbs diff --git a/src/openApi/v2/parser/constants.ts b/src/openApi/v2/parser/constants.ts index 6336efda..74156e57 100644 --- a/src/openApi/v2/parser/constants.ts +++ b/src/openApi/v2/parser/constants.ts @@ -1,7 +1,7 @@ export enum PrimaryType { FILE = 'File', OBJECT = 'any', - ARRAY = 'any[]', + ARRAY = 'any', BOOLEAN = 'boolean', NUMBER = 'number', STRING = 'string', diff --git a/src/openApi/v2/parser/getType.spec.ts b/src/openApi/v2/parser/getType.spec.ts index a3e7e422..9f4ab9a4 100644 --- a/src/openApi/v2/parser/getType.spec.ts +++ b/src/openApi/v2/parser/getType.spec.ts @@ -19,10 +19,10 @@ describe('getType', () => { it('should convert string array', () => { const type = getType('Array[String]'); - expect(type.type).toEqual('Array'); - expect(type.base).toEqual('Array'); - expect(type.template).toEqual('string'); - expect(type.imports).toEqual(['Array']); + expect(type.type).toEqual('string[]'); + expect(type.base).toEqual('string'); + expect(type.template).toEqual(null); + expect(type.imports).toEqual([]); }); it('should convert template with primary', () => { diff --git a/src/openApi/v2/parser/getType.ts b/src/openApi/v2/parser/getType.ts index 3c12cc67..617d68fd 100644 --- a/src/openApi/v2/parser/getType.ts +++ b/src/openApi/v2/parser/getType.ts @@ -24,7 +24,11 @@ export function getType(value?: string, template?: string): Type { const match1 = getType(matches[1]); const match2 = getType(matches[2]); - if (match2.type) { + if (match1.type === PrimaryType.ARRAY) { + result.type = `${match2.type}[]`; + result.base = `${match2.type}`; + match1.imports = []; + } else if (match2.type) { result.type = `${match1.type}<${match2.type}>`; result.base = match1.type; result.template = match2.type; diff --git a/src/openApi/v3/parser/getType.spec.ts b/src/openApi/v3/parser/getType.spec.ts index 70c061e3..a620b21a 100644 --- a/src/openApi/v3/parser/getType.spec.ts +++ b/src/openApi/v3/parser/getType.spec.ts @@ -19,10 +19,10 @@ describe('getType', () => { it('should convert string array', () => { const type = getType('Array[String]'); - expect(type.type).toEqual('Array'); - expect(type.base).toEqual('Array'); - expect(type.template).toEqual('string'); - expect(type.imports).toEqual(['Array']); + expect(type.type).toEqual('string[]'); + expect(type.base).toEqual('string'); + expect(type.template).toEqual(null); + expect(type.imports).toEqual([]); }); it('should convert template with primary', () => { diff --git a/src/openApi/v3/parser/getType.ts b/src/openApi/v3/parser/getType.ts index 3c12cc67..617d68fd 100644 --- a/src/openApi/v3/parser/getType.ts +++ b/src/openApi/v3/parser/getType.ts @@ -24,7 +24,11 @@ export function getType(value?: string, template?: string): Type { const match1 = getType(matches[1]); const match2 = getType(matches[2]); - if (match2.type) { + if (match1.type === PrimaryType.ARRAY) { + result.type = `${match2.type}[]`; + result.base = `${match2.type}`; + match1.imports = []; + } else if (match2.type) { result.type = `${match1.type}<${match2.type}>`; result.base = match1.type; result.template = match2.type; diff --git a/src/templates/javascript/partials/validationArray.hbs b/src/templates/javascript/partials/validationArray.hbs index 13abd35d..17565e0b 100644 --- a/src/templates/javascript/partials/validationArray.hbs +++ b/src/templates/javascript/partials/validationArray.hbs @@ -1,5 +1,7 @@ +{{~#>validationBasics~}} {{~#if link~}} -yup.array().of({{>validation link}}){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.array().of({{>validation link}}) {{~else~}} -yup.array().of({{{base}}}.schema){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.array().of({{{base}}}.schema) {{~/if~}} +{{~/validationBasics~}} diff --git a/src/templates/javascript/partials/validationBasics.hbs b/src/templates/javascript/partials/validationBasics.hbs new file mode 100644 index 00000000..4bd27569 --- /dev/null +++ b/src/templates/javascript/partials/validationBasics.hbs @@ -0,0 +1 @@ +{{>@partial-block}}{{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} diff --git a/src/templates/javascript/partials/validationEnum.hbs b/src/templates/javascript/partials/validationEnum.hbs index bbfc99ed..ab0e5893 100644 --- a/src/templates/javascript/partials/validationEnum.hbs +++ b/src/templates/javascript/partials/validationEnum.hbs @@ -1,13 +1,15 @@ +{{~#>validationBasics~}} {{~#equals parent name~}} yup.mixed().oneOf([ {{#each enum}} {{{../parent}}}.{{{name}}}{{>comma}} {{/each}} -]){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +]) {{~else~}} yup.mixed().oneOf([ {{#each enum}} {{{value}}}{{>comma}} {{/each}} -]){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +]) {{~/equals~}} +{{~/validationBasics~}} diff --git a/src/templates/javascript/partials/validationGeneric.hbs b/src/templates/javascript/partials/validationGeneric.hbs index 142aed6d..67f129c3 100644 --- a/src/templates/javascript/partials/validationGeneric.hbs +++ b/src/templates/javascript/partials/validationGeneric.hbs @@ -1,9 +1,11 @@ +{{~#>validationBasics~}} {{~#equals type 'boolean'~}} -yup.boolean(){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.boolean() {{~else equals type 'number'~}} -yup.number(){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.number() {{~else equals type 'string'~}} -yup.string(){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.string() {{~else~}} -yup.mixed(){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.mixed() {{~/equals~}} +{{~/validationBasics~}} diff --git a/src/templates/javascript/partials/validationInterface.hbs b/src/templates/javascript/partials/validationInterface.hbs index b2fe8356..3650f85a 100644 --- a/src/templates/javascript/partials/validationInterface.hbs +++ b/src/templates/javascript/partials/validationInterface.hbs @@ -1,9 +1,10 @@ +{{~#>validationBasics~}} {{#if extends}} {{#each extends}} {{{this}}}.schema.concat( {{/each}} {{/if}} -{{#if properties}} +{{~#if properties~}} yup.object().shape({ {{#each properties}} {{#equals ../parent name}} @@ -13,12 +14,12 @@ yup.object().shape({ {{/equals}} {{/each}} }).noUnknown() -{{else}} +{{~else~}} yup.object() -{{/if}} +{{~/if~}} {{#if extends}} {{#each extends}} ) {{/each}} {{/if}} -{{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +{{~/validationBasics~}} diff --git a/src/templates/javascript/partials/validationReference.hbs b/src/templates/javascript/partials/validationReference.hbs index 4d3124c7..2db6d704 100644 --- a/src/templates/javascript/partials/validationReference.hbs +++ b/src/templates/javascript/partials/validationReference.hbs @@ -1 +1,3 @@ -{{{base}}}.schema{{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +{{~#>validationBasics~}} +{{{base}}}.schema +{{~/validationBasics~}} diff --git a/src/templates/typescript/partials/validationArray.hbs b/src/templates/typescript/partials/validationArray.hbs index 3b30e605..435af8ab 100644 --- a/src/templates/typescript/partials/validationArray.hbs +++ b/src/templates/typescript/partials/validationArray.hbs @@ -1,5 +1,7 @@ +{{~#>validationBasics~}} {{~#if link~}} -yup.array<{{>type link}}>().of({{>validation link}}){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.array<{{>type link}}>().of({{>validation link}}) {{~else~}} -yup.array<{{#>isNullable}}{{{type}}}{{/isNullable}}>().of({{{base}}}.schema){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.array<{{#>isNullable}}{{{type}}}{{/isNullable}}>().of({{{base}}}.schema) {{~/if~}} +{{~/validationBasics~}} diff --git a/src/templates/typescript/partials/validationBasics.hbs b/src/templates/typescript/partials/validationBasics.hbs new file mode 100644 index 00000000..4bd27569 --- /dev/null +++ b/src/templates/typescript/partials/validationBasics.hbs @@ -0,0 +1 @@ +{{>@partial-block}}{{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} diff --git a/src/templates/typescript/partials/validationEnum.hbs b/src/templates/typescript/partials/validationEnum.hbs index 4a0b91ce..ac67ec64 100644 --- a/src/templates/typescript/partials/validationEnum.hbs +++ b/src/templates/typescript/partials/validationEnum.hbs @@ -1,13 +1,15 @@ +{{~#>validationBasics~}} {{~#equals parent name~}} yup.mixed<{{{name}}}>().oneOf([ {{#each enum}} {{{../parent}}}.{{{name}}}{{>comma}} {{/each}} -]){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +]) {{~else~}} yup.mixed<{{#>isNullable}}{{{type}}}{{/isNullable}}>().oneOf([ {{#each enum}} {{{value}}}{{>comma}} {{/each}} -]){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +]) {{~/equals~}} +{{~/validationBasics~}} diff --git a/src/templates/typescript/partials/validationGeneric.hbs b/src/templates/typescript/partials/validationGeneric.hbs index bef4c31b..bbe3d6d5 100644 --- a/src/templates/typescript/partials/validationGeneric.hbs +++ b/src/templates/typescript/partials/validationGeneric.hbs @@ -1,9 +1,11 @@ +{{~#>validationBasics~}} {{~#equals type 'boolean'~}} -yup.boolean(){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.boolean() {{~else equals type 'number'~}} -yup.number(){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.number() {{~else equals type 'string'~}} -yup.string(){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.string() {{~else~}} -yup.mixed<{{#>isNullable}}{{{type}}}{{/isNullable}}>(){{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +yup.mixed<{{#>isNullable}}{{{type}}}{{/isNullable}}>() {{~/equals~}} +{{~/validationBasics~}} diff --git a/src/templates/typescript/partials/validationInterface.hbs b/src/templates/typescript/partials/validationInterface.hbs index 6ff84040..5745498c 100644 --- a/src/templates/typescript/partials/validationInterface.hbs +++ b/src/templates/typescript/partials/validationInterface.hbs @@ -1,9 +1,10 @@ +{{~#>validationBasics~}} {{#if extends}} {{#each extends}} {{{this}}}.schema.concat( {{/each}} {{/if}} -{{#if properties}} +{{~#if properties~}} yup.object{{#unless isProperty}}{{#if name}}<{{{name}}}>{{/if}}{{/unless}}().shape({ {{#each properties}} {{#equals ../parent name}} @@ -13,12 +14,12 @@ yup.object{{#unless isProperty}}{{#if name}}<{{{name}}}>{{/if}}{{/unless}}().sha {{/equals}} {{/each}} }).noUnknown() -{{else}} +{{~else~}} yup.object() -{{/if}} +{{~/if~}} {{#if extends}} {{#each extends}} ) {{/each}} {{/if}} -{{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +{{~/validationBasics~}} diff --git a/src/templates/typescript/partials/validationReference.hbs b/src/templates/typescript/partials/validationReference.hbs index 4d3124c7..2db6d704 100644 --- a/src/templates/typescript/partials/validationReference.hbs +++ b/src/templates/typescript/partials/validationReference.hbs @@ -1 +1,3 @@ -{{{base}}}.schema{{#if isNullable}}.nullable(){{/if}}{{#if isRequired}}.required(){{/if}} +{{~#>validationBasics~}} +{{{base}}}.schema +{{~/validationBasics~}} diff --git a/test/__snapshots__/index.spec.js.snap b/test/__snapshots__/index.spec.js.snap index 903b92f1..57dfe6f7 100644 --- a/test/__snapshots__/index.spec.js.snap +++ b/test/__snapshots__/index.spec.js.snap @@ -500,12 +500,10 @@ import * as yup from 'yup'; export let ArrayWithProperties; (function (ArrayWithProperties) { - ArrayWithProperties.schema = yup.array().of(( - yup.object().shape({ - foo: yup.lazy(() => yup.string().default(undefined)), - bar: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - )); + ArrayWithProperties.schema = yup.array().of(yup.object().shape({ + foo: yup.string(), + bar: yup.string() + }).noUnknown()); ArrayWithProperties.validate = async function(value) { return ArrayWithProperties.schema.validate(value, { strict: true }); @@ -588,11 +586,11 @@ export let DictionaryWithArray; DictionaryWithArray.schema = yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.array().of(ModelWithString.schema) + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.array().of(ModelWithString.schema) }), {}) - ); + ).noUnknown(); }); DictionaryWithArray.validate = async function(value) { @@ -622,18 +620,18 @@ export let DictionaryWithDictionary; DictionaryWithDictionary.schema = yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.lazy(value => { + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() }), {}) - ); + ).noUnknown(); }) }), {}) - ); + ).noUnknown(); }); DictionaryWithDictionary.validate = async function(value) { @@ -663,16 +661,14 @@ export let DictionaryWithProperties; DictionaryWithProperties.schema = yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: ( - yup.object().shape({ - foo: yup.lazy(() => yup.string().default(undefined)), - bar: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ) + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.object().shape({ + foo: yup.string(), + bar: yup.string() + }).noUnknown() }), {}) - ); + ).noUnknown(); }); DictionaryWithProperties.validate = async function(value) { @@ -703,11 +699,11 @@ export let DictionaryWithReference; DictionaryWithReference.schema = yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: ModelWithString.schema + Object.keys(value).reduce((key, item) => ({ + ...object, + [key]: ModelWithString.schema }), {}) - ); + ).noUnknown(); }); DictionaryWithReference.validate = async function(value) { @@ -737,11 +733,11 @@ export let DictionaryWithString; DictionaryWithString.schema = yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() }), {}) - ); + ).noUnknown(); }); DictionaryWithString.validate = async function(value) { @@ -870,11 +866,9 @@ import * as yup from 'yup'; export let ModelLink; (function (ModelLink) { - ModelLink.schema = ( - yup.object().shape({ - id: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + ModelLink.schema = yup.object().shape({ + id: yup.string() + }).noUnknown(); ModelLink.validate = async function(value) { return ModelLink.schema.validate(value, { strict: true }); @@ -901,24 +895,22 @@ import * as yup from 'yup'; export let ModelThatExtends; (function (ModelThatExtends) { - ModelThatExtends.schema = ( - ModelWithString.schema.concat( - yup.object().shape({ - propExtendsA: yup.lazy(() => yup.string().default(undefined)), - propExtendsB: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ) - ); + ModelThatExtends.schema = ModelWithString.schema.concat( + yup.object().shape({ + propExtendsA: yup.string(), + propExtendsB: ModelWithString.schema + }).noUnknown()) + ; - ModelThatExtends.validate = async function(value) { - return ModelThatExtends.schema.validate(value, { strict: true }); - }; + ModelThatExtends.validate = async function(value) { + return ModelThatExtends.schema.validate(value, { strict: true }); + }; - ModelThatExtends.validateSync = function(value) { - return ModelThatExtends.schema.validateSync(value, { strict: true }); - }; + ModelThatExtends.validateSync = function(value) { + return ModelThatExtends.schema.validateSync(value, { strict: true }); + }; -})(ModelThatExtends || (ModelThatExtends = {}));" + })(ModelThatExtends || (ModelThatExtends = {}));" `; exports[`generation v2 javascript file(./test/result/v2/javascript/models/ModelThatExtendsExtends.js): ./test/result/v2/javascript/models/ModelThatExtendsExtends.js 1`] = ` @@ -936,26 +928,24 @@ import * as yup from 'yup'; export let ModelThatExtendsExtends; (function (ModelThatExtendsExtends) { - ModelThatExtendsExtends.schema = ( - ModelWithString.schema.concat( - ModelThatExtends.schema.concat( - yup.object().shape({ - propExtendsC: yup.lazy(() => yup.string().default(undefined)), - propExtendsD: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ) + ModelThatExtendsExtends.schema = ModelWithString.schema.concat( + ModelThatExtends.schema.concat( + yup.object().shape({ + propExtendsC: yup.string(), + propExtendsD: ModelWithString.schema + }).noUnknown()) ) - ); + ; - ModelThatExtendsExtends.validate = async function(value) { - return ModelThatExtendsExtends.schema.validate(value, { strict: true }); - }; + ModelThatExtendsExtends.validate = async function(value) { + return ModelThatExtendsExtends.schema.validate(value, { strict: true }); + }; - ModelThatExtendsExtends.validateSync = function(value) { - return ModelThatExtendsExtends.schema.validateSync(value, { strict: true }); - }; + ModelThatExtendsExtends.validateSync = function(value) { + return ModelThatExtendsExtends.schema.validateSync(value, { strict: true }); + }; -})(ModelThatExtendsExtends || (ModelThatExtendsExtends = {}));" + })(ModelThatExtendsExtends || (ModelThatExtendsExtends = {}));" `; exports[`generation v2 javascript file(./test/result/v2/javascript/models/ModelWithArray.js): ./test/result/v2/javascript/models/ModelWithArray.js 1`] = ` @@ -972,13 +962,11 @@ import * as yup from 'yup'; export let ModelWithArray; (function (ModelWithArray) { - ModelWithArray.schema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.array().of(ModelWithString.schema).default(undefined)), - propWithFile: yup.lazy(() => yup.array().of(yup.mixed()).default(undefined)), - propWithNumber: yup.lazy(() => yup.array().of(yup.number()).default(undefined)) - }).noUnknown() - ); + ModelWithArray.schema = yup.object().shape({ + prop: yup.array().of(ModelWithString.schema), + propWithFile: yup.array().of(yup.mixed()), + propWithNumber: yup.array().of(yup.number()) + }).noUnknown(); ModelWithArray.validate = async function(value) { return ModelWithArray.schema.validate(value, { strict: true }); @@ -1004,11 +992,9 @@ import * as yup from 'yup'; export let ModelWithBoolean; (function (ModelWithBoolean) { - ModelWithBoolean.schema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.boolean().default(undefined)) - }).noUnknown() - ); + ModelWithBoolean.schema = yup.object().shape({ + prop: yup.boolean() + }).noUnknown(); ModelWithBoolean.validate = async function(value) { return ModelWithBoolean.schema.validate(value, { strict: true }); @@ -1034,11 +1020,9 @@ import * as yup from 'yup'; export let ModelWithCircularReference; (function (ModelWithCircularReference) { - ModelWithCircularReference.schema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithCircularReference.schema.default(undefined)) - }).noUnknown() - ); + ModelWithCircularReference.schema = yup.object().shape({ + prop: ModelWithCircularReference.schema + }).noUnknown(); ModelWithCircularReference.validate = async function(value) { return ModelWithCircularReference.schema.validate(value, { strict: true }); @@ -1065,18 +1049,16 @@ import * as yup from 'yup'; export let ModelWithDictionary; (function (ModelWithDictionary) { - ModelWithDictionary.schema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.lazy(value => { - return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() - }), {}) - ); - }).default(undefined)) - }).noUnknown() - ); + ModelWithDictionary.schema = yup.object().shape({ + prop: yup.lazy(value => { + return yup.object().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() + }), {}) + ).noUnknown(); + }) + }).noUnknown(); ModelWithDictionary.validate = async function(value) { return ModelWithDictionary.schema.validate(value, { strict: true }); @@ -1103,13 +1085,11 @@ import * as yup from 'yup'; export let ModelWithDuplicateImports; (function (ModelWithDuplicateImports) { - ModelWithDuplicateImports.schema = ( - yup.object().shape({ - propA: yup.lazy(() => ModelWithString.schema.default(undefined)), - propB: yup.lazy(() => ModelWithString.schema.default(undefined)), - propC: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + ModelWithDuplicateImports.schema = yup.object().shape({ + propA: ModelWithString.schema, + propB: ModelWithString.schema, + propC: ModelWithString.schema + }).noUnknown(); ModelWithDuplicateImports.validate = async function(value) { return ModelWithDuplicateImports.schema.validate(value, { strict: true }); @@ -1136,11 +1116,9 @@ import * as yup from 'yup'; export let ModelWithDuplicateProperties; (function (ModelWithDuplicateProperties) { - ModelWithDuplicateProperties.schema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + ModelWithDuplicateProperties.schema = yup.object().shape({ + prop: ModelWithString.schema + }).noUnknown(); ModelWithDuplicateProperties.validate = async function(value) { return ModelWithDuplicateProperties.schema.validate(value, { strict: true }); @@ -1175,15 +1153,13 @@ export let ModelWithEnum; ERROR: 'Error' }; - ModelWithEnum.schema = ( - yup.object().shape({ - test: yup.lazy(() => yup.mixed().oneOf([ - test.SUCCESS, - test.WARNING, - test.ERROR - ]).default(undefined)) - }).noUnknown() - ); + ModelWithEnum.schema = yup.object().shape({ + test: yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ]) + }).noUnknown(); ModelWithEnum.validate = async function(value) { return ModelWithEnum.schema.validate(value, { strict: true }); @@ -1218,15 +1194,13 @@ export let ModelWithEnumFromDescription; ERROR: 3 }; - ModelWithEnumFromDescription.schema = ( - yup.object().shape({ - test: yup.lazy(() => yup.mixed().oneOf([ - test.SUCCESS, - test.WARNING, - test.ERROR - ]).default(undefined)) - }).noUnknown() - ); + ModelWithEnumFromDescription.schema = yup.object().shape({ + test: yup.mixed().oneOf([ + 1, + 2, + 3 + ]) + }).noUnknown(); ModelWithEnumFromDescription.validate = async function(value) { return ModelWithEnumFromDescription.schema.validate(value, { strict: true }); @@ -1252,11 +1226,9 @@ import * as yup from 'yup'; export let ModelWithInteger; (function (ModelWithInteger) { - ModelWithInteger.schema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.number().default(undefined)) - }).noUnknown() - ); + ModelWithInteger.schema = yup.object().shape({ + prop: yup.number() + }).noUnknown(); ModelWithInteger.validate = async function(value) { return ModelWithInteger.schema.validate(value, { strict: true }); @@ -1284,11 +1256,9 @@ import * as yup from 'yup'; export let ModelWithLink; (function (ModelWithLink) { - ModelWithLink.schema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelLink.schema.default(undefined)) - }).noUnknown() - ); + ModelWithLink.schema = yup.object().shape({ + prop: ModelLink.schema + }).noUnknown(); ModelWithLink.validate = async function(value) { return ModelWithLink.schema.validate(value, { strict: true }); @@ -1306,7 +1276,6 @@ exports[`generation v2 javascript file(./test/result/v2/javascript/models/ModelW /* eslint-disable */ /* prettier-ignore */ -import { array } from '../models/array'; import * as yup from 'yup'; @@ -1316,36 +1285,42 @@ import * as yup from 'yup'; export let ModelWithNestedEnums; (function (ModelWithNestedEnums) { - ModelWithNestedEnums.schema = ( - yup.object().shape({ - arrayWithDescription: yup.lazy(() => yup.mixed().default(undefined)), - arrayWithEnum: yup.lazy(() => yup.mixed().default(undefined)), - dictionaryWithEnum: yup.lazy(() => yup.lazy(value => { - return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.mixed().oneOf([ - 'Success', - 'Warning', - 'Error' - ]) - }), {}) - ); - }).default(undefined)), - dictionaryWithEnumFromDescription: yup.lazy(() => yup.lazy(value => { - return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.mixed().oneOf([ - 1, - 2, - 3 - ]) - }), {}) - ); - }).default(undefined)) - }).noUnknown() - ); + ModelWithNestedEnums.schema = yup.object().shape({ + arrayWithDescription: yup.array().of(yup.mixed().oneOf([ + 1, + 2, + 3 + ])), + arrayWithEnum: yup.array().of(yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ])), + dictionaryWithEnum: yup.lazy(value => { + return yup.object().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ]) + }), {}) + ).noUnknown(); + }), + dictionaryWithEnumFromDescription: yup.lazy(value => { + return yup.object().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.mixed().oneOf([ + 1, + 2, + 3 + ]) + }), {}) + ).noUnknown(); + }) + }).noUnknown(); ModelWithNestedEnums.validate = async function(value) { return ModelWithNestedEnums.schema.validate(value, { strict: true }); @@ -1371,19 +1346,13 @@ import * as yup from 'yup'; export let ModelWithNestedProperties; (function (ModelWithNestedProperties) { - ModelWithNestedProperties.schema = ( - yup.object().shape({ - first: yup.lazy(() => ( - yup.object().shape({ - second: yup.lazy(() => ( - yup.object().shape({ - third: yup.lazy(() => yup.string().default(undefined)).isRequired() - }).noUnknown() - ).default(undefined)).isRequired() - }).noUnknown() - ).default(undefined)).isRequired() - }).noUnknown() - ); + ModelWithNestedProperties.schema = yup.object().shape({ + first: yup.object().shape({ + second: yup.object().shape({ + third: yup.string().required() + }).noUnknown().required() + }).noUnknown().required() + }).noUnknown(); ModelWithNestedProperties.validate = async function(value) { return ModelWithNestedProperties.schema.validate(value, { strict: true }); @@ -1410,16 +1379,14 @@ import * as yup from 'yup'; export let ModelWithProperties; (function (ModelWithProperties) { - ModelWithProperties.schema = ( - yup.object().shape({ - boolean: yup.lazy(() => yup.boolean().default(undefined)), - number: yup.lazy(() => yup.number().default(undefined)), - reference: yup.lazy(() => ModelWithString.schema.default(undefined)), - required: yup.lazy(() => yup.string().default(undefined)).isRequired(), - requiredAndreadOnly: yup.lazy(() => yup.string().default(undefined)).isRequired(), - string: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + ModelWithProperties.schema = yup.object().shape({ + boolean: yup.boolean(), + number: yup.number(), + reference: ModelWithString.schema, + required: yup.string().required(), + requiredAndReadOnly: yup.string().required(), + string: yup.string() + }).noUnknown(); ModelWithProperties.validate = async function(value) { return ModelWithProperties.schema.validate(value, { strict: true }); @@ -1446,11 +1413,9 @@ import * as yup from 'yup'; export let ModelWithReference; (function (ModelWithReference) { - ModelWithReference.schema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + ModelWithReference.schema = yup.object().shape({ + prop: ModelWithString.schema + }).noUnknown(); ModelWithReference.validate = async function(value) { return ModelWithReference.schema.validate(value, { strict: true }); @@ -1476,11 +1441,9 @@ import * as yup from 'yup'; export let ModelWithString; (function (ModelWithString) { - ModelWithString.schema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + ModelWithString.schema = yup.object().shape({ + prop: yup.string() + }).noUnknown(); ModelWithString.validate = async function(value) { return ModelWithString.schema.validate(value, { strict: true }); @@ -2584,12 +2547,10 @@ export namespace ArrayWithProperties { export const schema = yup.array<{ foo?: string, bar?: string - }>().of(( - yup.object().shape({ - foo: yup.lazy(() => yup.string().default(undefined)), - bar: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - )); + }>().of(yup.object().shape({ + foo: yup.string(), + bar: yup.string() + }).noUnknown()); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -2687,11 +2648,11 @@ export namespace DictionaryWithArray { export const schema = yup.lazy>>(value => { return yup.object>>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.array().of(ModelWithString.schema) + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.array().of(ModelWithString.schema) }), {}) - ); + ).noUnknown(); }); export async function validate(value: any): Promise { @@ -2722,18 +2683,18 @@ export namespace DictionaryWithDictionary { export const schema = yup.lazy>>(value => { return yup.object>>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.lazy>(value => { + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.lazy>(value => { return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() }), {}) - ); + ).noUnknown(); }) }), {}) - ); + ).noUnknown(); }); export async function validate(value: any): Promise { @@ -2773,16 +2734,14 @@ export namespace DictionaryWithProperties { foo?: string, bar?: string }>>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: ( - yup.object().shape({ - foo: yup.lazy(() => yup.string().default(undefined)), - bar: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ) + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.object().shape({ + foo: yup.string(), + bar: yup.string() + }).noUnknown() }), {}) - ); + ).noUnknown(); }); export async function validate(value: any): Promise { @@ -2814,11 +2773,11 @@ export namespace DictionaryWithReference { export const schema = yup.lazy>(value => { return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: ModelWithString.schema + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: ModelWithString.schema }), {}) - ); + ).noUnknown(); }); export async function validate(value: any): Promise { @@ -2849,11 +2808,11 @@ export namespace DictionaryWithString { export const schema = yup.lazy>(value => { return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() }), {}) - ); + ).noUnknown(); }); export async function validate(value: any): Promise { @@ -2988,11 +2947,9 @@ export interface ModelLink { export namespace ModelLink { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - id: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + id: yup.string() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3023,23 +2980,21 @@ export interface ModelThatExtends extends ModelWithString { export namespace ModelThatExtends { - export const schema: yup.ObjectSchema = ( - ModelWithString.schema.concat( - yup.object().shape({ - propExtendsA: yup.lazy(() => yup.string().default(undefined)), - propExtendsB: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ) - ); + export const schema: yup.ObjectSchema = ModelWithString.schema.concat( + yup.object().shape({ + propExtendsA: yup.string(), + propExtendsB: ModelWithString.schema + }).noUnknown()) + ; - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } - export function validateSync(value: any): ModelThatExtends { - return schema.validateSync(value, { strict: true }); - } -}" + export function validateSync(value: any): ModelThatExtends { + return schema.validateSync(value, { strict: true }); + } + }" `; exports[`generation v2 typescript file(./test/result/v2/typescript/models/ModelThatExtendsExtends.ts): ./test/result/v2/typescript/models/ModelThatExtendsExtends.ts 1`] = ` @@ -3062,25 +3017,23 @@ export interface ModelThatExtendsExtends extends ModelWithString, ModelThatExten export namespace ModelThatExtendsExtends { - export const schema: yup.ObjectSchema = ( - ModelWithString.schema.concat( - ModelThatExtends.schema.concat( - yup.object().shape({ - propExtendsC: yup.lazy(() => yup.string().default(undefined)), - propExtendsD: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ) + export const schema: yup.ObjectSchema = ModelWithString.schema.concat( + ModelThatExtends.schema.concat( + yup.object().shape({ + propExtendsC: yup.string(), + propExtendsD: ModelWithString.schema + }).noUnknown()) ) - ); + ; - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } - export function validateSync(value: any): ModelThatExtendsExtends { - return schema.validateSync(value, { strict: true }); - } -}" + export function validateSync(value: any): ModelThatExtendsExtends { + return schema.validateSync(value, { strict: true }); + } + }" `; exports[`generation v2 typescript file(./test/result/v2/typescript/models/ModelWithArray.ts): ./test/result/v2/typescript/models/ModelWithArray.ts 1`] = ` @@ -3103,13 +3056,11 @@ export interface ModelWithArray { export namespace ModelWithArray { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.array().of(ModelWithString.schema).default(undefined)), - propWithFile: yup.lazy(() => yup.array().of(yup.mixed()).default(undefined)), - propWithNumber: yup.lazy(() => yup.array().of(yup.number()).default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: yup.array().of(ModelWithString.schema), + propWithFile: yup.array().of(yup.mixed()), + propWithNumber: yup.array().of(yup.number()) + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3141,11 +3092,9 @@ export interface ModelWithBoolean { export namespace ModelWithBoolean { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.boolean().default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: yup.boolean() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3174,11 +3123,9 @@ export interface ModelWithCircularReference { export namespace ModelWithCircularReference { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithCircularReference.schema.default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: ModelWithCircularReference.schema + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3208,18 +3155,16 @@ export interface ModelWithDictionary { export namespace ModelWithDictionary { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.lazy>(value => { - return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() - }), {}) - ); - }).default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: yup.lazy>(value => { + return yup.object>().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() + }), {}) + ).noUnknown(); + }) + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3251,13 +3196,11 @@ export interface ModelWithDuplicateImports { export namespace ModelWithDuplicateImports { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - propA: yup.lazy(() => ModelWithString.schema.default(undefined)), - propB: yup.lazy(() => ModelWithString.schema.default(undefined)), - propC: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + propA: ModelWithString.schema, + propB: ModelWithString.schema, + propC: ModelWithString.schema + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3287,11 +3230,9 @@ export interface ModelWithDuplicateProperties { export namespace ModelWithDuplicateProperties { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: ModelWithString.schema + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3332,15 +3273,13 @@ export namespace ModelWithEnum { ERROR = 'Error' } - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - test: yup.lazy(() => yup.mixed().oneOf([ - test.SUCCESS, - test.WARNING, - test.ERROR - ]).default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + test: yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ]) + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3381,15 +3320,13 @@ export namespace ModelWithEnumFromDescription { ERROR = 3 } - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - test: yup.lazy(() => yup.mixed().oneOf([ - test.SUCCESS, - test.WARNING, - test.ERROR - ]).default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + test: yup.mixed().oneOf([ + 1, + 2, + 3 + ]) + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3421,11 +3358,9 @@ export interface ModelWithInteger { export namespace ModelWithInteger { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.number().default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: yup.number() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3456,11 +3391,9 @@ export interface ModelWithLink { export namespace ModelWithLink { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelLink.schema.default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: ModelLink.schema + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3478,7 +3411,6 @@ exports[`generation v2 typescript file(./test/result/v2/typescript/models/ModelW /* eslint-disable */ /* prettier-ignore */ -import { array } from '../models/array'; import { Dictionary } from '../models/Dictionary'; import * as yup from 'yup'; @@ -3486,44 +3418,50 @@ import * as yup from 'yup'; * This is a model with nested enums */ export interface ModelWithNestedEnums { - arrayWithDescription?: array; - arrayWithEnum?: array; + arrayWithDescription?: Array<(1 | 2 | 3)>; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; dictionaryWithEnum?: Dictionary<('Success' | 'Warning' | 'Error')>; dictionaryWithEnumFromDescription?: Dictionary<(1 | 2 | 3)>; } export namespace ModelWithNestedEnums { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - arrayWithDescription: yup.lazy(() => yup.mixed().default(undefined)), - arrayWithEnum: yup.lazy(() => yup.mixed().default(undefined)), - dictionaryWithEnum: yup.lazy(() => yup.lazy>(value => { - return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.mixed().oneOf([ - 'Success', - 'Warning', - 'Error' - ]) - }), {}) - ); - }).default(undefined)), - dictionaryWithEnumFromDescription: yup.lazy(() => yup.lazy>(value => { - return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.mixed().oneOf([ - 1, - 2, - 3 - ]) - }), {}) - ); - }).default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + arrayWithDescription: yup.array<(1 | 2 | 3)>().of(yup.mixed().oneOf([ + 1, + 2, + 3 + ])), + arrayWithEnum: yup.array<('Success' | 'Warning' | 'Error')>().of(yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ])), + dictionaryWithEnum: yup.lazy>(value => { + return yup.object>().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ]) + }), {}) + ).noUnknown(); + }), + dictionaryWithEnumFromDescription: yup.lazy>(value => { + return yup.object>().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.mixed().oneOf([ + 1, + 2, + 3 + ]) + }), {}) + ).noUnknown(); + }) + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3556,19 +3494,13 @@ export interface ModelWithNestedProperties { export namespace ModelWithNestedProperties { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - first: yup.lazy(() => ( - yup.object().shape({ - second: yup.lazy(() => ( - yup.object().shape({ - third: yup.lazy(() => yup.string().default(undefined).required()) - }).noUnknown() - ).default(undefined).required()) - }).noUnknown() - ).default(undefined).required()) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + first: yup.object().shape({ + second: yup.object().shape({ + third: yup.string().required() + }).noUnknown().required() + }).noUnknown().required() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3597,22 +3529,20 @@ export interface ModelWithProperties { number?: number; reference?: ModelWithString; required: string; - readonly requiredAndreadOnly: string; + readonly requiredAndReadOnly: string; string?: string; } export namespace ModelWithProperties { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - boolean: yup.lazy(() => yup.boolean().default(undefined)), - number: yup.lazy(() => yup.number().default(undefined)), - reference: yup.lazy(() => ModelWithString.schema.default(undefined)), - required: yup.lazy(() => yup.string().default(undefined).required()), - requiredAndreadOnly: yup.lazy(() => yup.string().default(undefined).required()), - string: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + boolean: yup.boolean(), + number: yup.number(), + reference: ModelWithString.schema, + required: yup.string().required(), + requiredAndReadOnly: yup.string().required(), + string: yup.string() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3642,11 +3572,9 @@ export interface ModelWithReference { export namespace ModelWithReference { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: ModelWithString.schema + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -3678,11 +3606,9 @@ export interface ModelWithString { export namespace ModelWithString { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: yup.string() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -4639,6 +4565,7 @@ export { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; export { ModelWithProperties } from './models/ModelWithProperties'; export { ModelWithReference } from './models/ModelWithReference'; export { ModelWithString } from './models/ModelWithString'; +export { ProblemDetails } from './models/ProblemDetails'; export { SimpleBoolean } from './models/SimpleBoolean'; export { SimpleFile } from './models/SimpleFile'; export { SimpleInteger } from './models/SimpleInteger'; @@ -4746,12 +4673,10 @@ import * as yup from 'yup'; export let ArrayWithProperties; (function (ArrayWithProperties) { - ArrayWithProperties.schema = yup.array().of(( - yup.object().shape({ - foo: yup.lazy(() => yup.string().default(undefined)), - bar: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - )); + ArrayWithProperties.schema = yup.array().of(yup.object().shape({ + foo: yup.string(), + bar: yup.string() + }).noUnknown()); ArrayWithProperties.validate = async function(value) { return ArrayWithProperties.schema.validate(value, { strict: true }); @@ -4834,11 +4759,11 @@ export let DictionaryWithArray; DictionaryWithArray.schema = yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.array().of(ModelWithString.schema) + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.array().of(ModelWithString.schema) }), {}) - ); + ).noUnknown(); }); DictionaryWithArray.validate = async function(value) { @@ -4868,18 +4793,18 @@ export let DictionaryWithDictionary; DictionaryWithDictionary.schema = yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.lazy(value => { + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() }), {}) - ); + ).noUnknown(); }) }), {}) - ); + ).noUnknown(); }); DictionaryWithDictionary.validate = async function(value) { @@ -4909,16 +4834,14 @@ export let DictionaryWithProperties; DictionaryWithProperties.schema = yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: ( - yup.object().shape({ - foo: yup.lazy(() => yup.string().default(undefined)), - bar: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ) + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.object().shape({ + foo: yup.string(), + bar: yup.string() + }).noUnknown() }), {}) - ); + ).noUnknown(); }); DictionaryWithProperties.validate = async function(value) { @@ -4949,11 +4872,11 @@ export let DictionaryWithReference; DictionaryWithReference.schema = yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: ModelWithString.schema + Object.keys(value).reduce((key, item) => ({ + ...object, + [key]: ModelWithString.schema }), {}) - ); + ).noUnknown(); }); DictionaryWithReference.validate = async function(value) { @@ -4983,11 +4906,11 @@ export let DictionaryWithString; DictionaryWithString.schema = yup.lazy(value => { return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() }), {}) - ); + ).noUnknown(); }); DictionaryWithString.validate = async function(value) { @@ -5116,11 +5039,9 @@ import * as yup from 'yup'; export let ModelLink; (function (ModelLink) { - ModelLink.schema = ( - yup.object().shape({ - id: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + ModelLink.schema = yup.object().shape({ + id: yup.string() + }).noUnknown(); ModelLink.validate = async function(value) { return ModelLink.schema.validate(value, { strict: true }); @@ -5147,24 +5068,22 @@ import * as yup from 'yup'; export let ModelThatExtends; (function (ModelThatExtends) { - ModelThatExtends.schema = ( - ModelWithString.schema.concat( - yup.object().shape({ - propExtendsA: yup.lazy(() => yup.string().default(undefined)), - propExtendsB: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ) - ); + ModelThatExtends.schema = ModelWithString.schema.concat( + yup.object().shape({ + propExtendsA: yup.string(), + propExtendsB: ModelWithString.schema + }).noUnknown()) + ; - ModelThatExtends.validate = async function(value) { - return ModelThatExtends.schema.validate(value, { strict: true }); - }; + ModelThatExtends.validate = async function(value) { + return ModelThatExtends.schema.validate(value, { strict: true }); + }; - ModelThatExtends.validateSync = function(value) { - return ModelThatExtends.schema.validateSync(value, { strict: true }); - }; + ModelThatExtends.validateSync = function(value) { + return ModelThatExtends.schema.validateSync(value, { strict: true }); + }; -})(ModelThatExtends || (ModelThatExtends = {}));" + })(ModelThatExtends || (ModelThatExtends = {}));" `; exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelThatExtendsExtends.js): ./test/result/v3/javascript/models/ModelThatExtendsExtends.js 1`] = ` @@ -5182,26 +5101,24 @@ import * as yup from 'yup'; export let ModelThatExtendsExtends; (function (ModelThatExtendsExtends) { - ModelThatExtendsExtends.schema = ( - ModelWithString.schema.concat( - ModelThatExtends.schema.concat( - yup.object().shape({ - propExtendsC: yup.lazy(() => yup.string().default(undefined)), - propExtendsD: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ) + ModelThatExtendsExtends.schema = ModelWithString.schema.concat( + ModelThatExtends.schema.concat( + yup.object().shape({ + propExtendsC: yup.string(), + propExtendsD: ModelWithString.schema + }).noUnknown()) ) - ); + ; - ModelThatExtendsExtends.validate = async function(value) { - return ModelThatExtendsExtends.schema.validate(value, { strict: true }); - }; + ModelThatExtendsExtends.validate = async function(value) { + return ModelThatExtendsExtends.schema.validate(value, { strict: true }); + }; - ModelThatExtendsExtends.validateSync = function(value) { - return ModelThatExtendsExtends.schema.validateSync(value, { strict: true }); - }; + ModelThatExtendsExtends.validateSync = function(value) { + return ModelThatExtendsExtends.schema.validateSync(value, { strict: true }); + }; -})(ModelThatExtendsExtends || (ModelThatExtendsExtends = {}));" + })(ModelThatExtendsExtends || (ModelThatExtendsExtends = {}));" `; exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelWithArray.js): ./test/result/v3/javascript/models/ModelWithArray.js 1`] = ` @@ -5218,13 +5135,11 @@ import * as yup from 'yup'; export let ModelWithArray; (function (ModelWithArray) { - ModelWithArray.schema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.array().of(ModelWithString.schema).default(undefined)), - propWithFile: yup.lazy(() => yup.array().of(yup.mixed()).default(undefined)), - propWithNumber: yup.lazy(() => yup.array().of(yup.number()).default(undefined)) - }).noUnknown() - ); + ModelWithArray.schema = yup.object().shape({ + prop: yup.array().of(ModelWithString.schema), + propWithFile: yup.array().of(yup.mixed()), + propWithNumber: yup.array().of(yup.number()) + }).noUnknown(); ModelWithArray.validate = async function(value) { return ModelWithArray.schema.validate(value, { strict: true }); @@ -5250,11 +5165,9 @@ import * as yup from 'yup'; export let ModelWithBoolean; (function (ModelWithBoolean) { - ModelWithBoolean.schema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.boolean().default(undefined)) - }).noUnknown() - ); + ModelWithBoolean.schema = yup.object().shape({ + prop: yup.boolean() + }).noUnknown(); ModelWithBoolean.validate = async function(value) { return ModelWithBoolean.schema.validate(value, { strict: true }); @@ -5280,11 +5193,9 @@ import * as yup from 'yup'; export let ModelWithCircularReference; (function (ModelWithCircularReference) { - ModelWithCircularReference.schema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithCircularReference.schema.default(undefined)) - }).noUnknown() - ); + ModelWithCircularReference.schema = yup.object().shape({ + prop: ModelWithCircularReference.schema + }).noUnknown(); ModelWithCircularReference.validate = async function(value) { return ModelWithCircularReference.schema.validate(value, { strict: true }); @@ -5311,18 +5222,16 @@ import * as yup from 'yup'; export let ModelWithDictionary; (function (ModelWithDictionary) { - ModelWithDictionary.schema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.lazy(value => { - return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() - }), {}) - ); - }).default(undefined)) - }).noUnknown() - ); + ModelWithDictionary.schema = yup.object().shape({ + prop: yup.lazy(value => { + return yup.object().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() + }), {}) + ).noUnknown(); + }) + }).noUnknown(); ModelWithDictionary.validate = async function(value) { return ModelWithDictionary.schema.validate(value, { strict: true }); @@ -5349,13 +5258,11 @@ import * as yup from 'yup'; export let ModelWithDuplicateImports; (function (ModelWithDuplicateImports) { - ModelWithDuplicateImports.schema = ( - yup.object().shape({ - propA: yup.lazy(() => ModelWithString.schema.default(undefined)), - propB: yup.lazy(() => ModelWithString.schema.default(undefined)), - propC: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + ModelWithDuplicateImports.schema = yup.object().shape({ + propA: ModelWithString.schema, + propB: ModelWithString.schema, + propC: ModelWithString.schema + }).noUnknown(); ModelWithDuplicateImports.validate = async function(value) { return ModelWithDuplicateImports.schema.validate(value, { strict: true }); @@ -5382,11 +5289,9 @@ import * as yup from 'yup'; export let ModelWithDuplicateProperties; (function (ModelWithDuplicateProperties) { - ModelWithDuplicateProperties.schema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + ModelWithDuplicateProperties.schema = yup.object().shape({ + prop: ModelWithString.schema + }).noUnknown(); ModelWithDuplicateProperties.validate = async function(value) { return ModelWithDuplicateProperties.schema.validate(value, { strict: true }); @@ -5421,15 +5326,13 @@ export let ModelWithEnum; ERROR: 'Error' }; - ModelWithEnum.schema = ( - yup.object().shape({ - Test: yup.lazy(() => yup.mixed().oneOf([ - Test.SUCCESS, - Test.WARNING, - Test.ERROR - ]).default(undefined)) - }).noUnknown() - ); + ModelWithEnum.schema = yup.object().shape({ + Test: yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ]) + }).noUnknown(); ModelWithEnum.validate = async function(value) { return ModelWithEnum.schema.validate(value, { strict: true }); @@ -5464,15 +5367,13 @@ export let ModelWithEnumFromDescription; ERROR: 3 }; - ModelWithEnumFromDescription.schema = ( - yup.object().shape({ - Test: yup.lazy(() => yup.mixed().oneOf([ - Test.SUCCESS, - Test.WARNING, - Test.ERROR - ]).default(undefined)) - }).noUnknown() - ); + ModelWithEnumFromDescription.schema = yup.object().shape({ + Test: yup.mixed().oneOf([ + 1, + 2, + 3 + ]) + }).noUnknown(); ModelWithEnumFromDescription.validate = async function(value) { return ModelWithEnumFromDescription.schema.validate(value, { strict: true }); @@ -5498,11 +5399,9 @@ import * as yup from 'yup'; export let ModelWithInteger; (function (ModelWithInteger) { - ModelWithInteger.schema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.number().default(undefined)) - }).noUnknown() - ); + ModelWithInteger.schema = yup.object().shape({ + prop: yup.number() + }).noUnknown(); ModelWithInteger.validate = async function(value) { return ModelWithInteger.schema.validate(value, { strict: true }); @@ -5530,11 +5429,9 @@ import * as yup from 'yup'; export let ModelWithLink; (function (ModelWithLink) { - ModelWithLink.schema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelLink.schema.default(undefined)) - }).noUnknown() - ); + ModelWithLink.schema = yup.object().shape({ + prop: ModelLink.schema + }).noUnknown(); ModelWithLink.validate = async function(value) { return ModelWithLink.schema.validate(value, { strict: true }); @@ -5552,7 +5449,6 @@ exports[`generation v3 javascript file(./test/result/v3/javascript/models/ModelW /* eslint-disable */ /* prettier-ignore */ -import { array } from '../models/array'; import * as yup from 'yup'; @@ -5562,36 +5458,42 @@ import * as yup from 'yup'; export let ModelWithNestedEnums; (function (ModelWithNestedEnums) { - ModelWithNestedEnums.schema = ( - yup.object().shape({ - arrayWithDescription: yup.lazy(() => yup.mixed().default(undefined)), - arrayWithEnum: yup.lazy(() => yup.mixed().default(undefined)), - dictionaryWithEnum: yup.lazy(() => yup.lazy(value => { - return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.mixed().oneOf([ - 'Success', - 'Warning', - 'Error' - ]) - }), {}) - ); - }).default(undefined)), - dictionaryWithEnumFromDescription: yup.lazy(() => yup.lazy(value => { - return yup.object().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.mixed().oneOf([ - 1, - 2, - 3 - ]) - }), {}) - ); - }).default(undefined)) - }).noUnknown() - ); + ModelWithNestedEnums.schema = yup.object().shape({ + arrayWithDescription: yup.array().of(yup.mixed().oneOf([ + 1, + 2, + 3 + ])), + arrayWithEnum: yup.array().of(yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ])), + dictionaryWithEnum: yup.lazy(value => { + return yup.object().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ]) + }), {}) + ).noUnknown(); + }), + dictionaryWithEnumFromDescription: yup.lazy(value => { + return yup.object().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.mixed().oneOf([ + 1, + 2, + 3 + ]) + }), {}) + ).noUnknown(); + }) + }).noUnknown(); ModelWithNestedEnums.validate = async function(value) { return ModelWithNestedEnums.schema.validate(value, { strict: true }); @@ -5617,19 +5519,13 @@ import * as yup from 'yup'; export let ModelWithNestedProperties; (function (ModelWithNestedProperties) { - ModelWithNestedProperties.schema = ( - yup.object().shape({ - first: yup.lazy(() => ( - yup.object().shape({ - second: yup.lazy(() => ( - yup.object().shape({ - third: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired() - }).noUnknown() - ).default(undefined).isNullable()).isRequired() - }).noUnknown() - ).default(undefined).isNullable()).isRequired() - }).noUnknown() - ); + ModelWithNestedProperties.schema = yup.object().shape({ + first: yup.object().shape({ + second: yup.object().shape({ + third: yup.string().nullable().required() + }).noUnknown().nullable().required() + }).noUnknown().nullable().required() + }).noUnknown(); ModelWithNestedProperties.validate = async function(value) { return ModelWithNestedProperties.schema.validate(value, { strict: true }); @@ -5656,17 +5552,15 @@ import * as yup from 'yup'; export let ModelWithProperties; (function (ModelWithProperties) { - ModelWithProperties.schema = ( - yup.object().shape({ - boolean: yup.lazy(() => yup.boolean().default(undefined)), - number: yup.lazy(() => yup.number().default(undefined)), - reference: yup.lazy(() => ModelWithString.schema.default(undefined)), - required: yup.lazy(() => yup.string().default(undefined)).isRequired(), - requiredAndNullable: yup.lazy(() => yup.string().default(undefined).isNullable()).isRequired(), - requiredAndReadOnly: yup.lazy(() => yup.string().default(undefined)).isRequired(), - string: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + ModelWithProperties.schema = yup.object().shape({ + boolean: yup.boolean(), + number: yup.number(), + reference: ModelWithString.schema, + required: yup.string().required(), + requiredAndNullable: yup.string().nullable().required(), + requiredAndReadOnly: yup.string().required(), + string: yup.string() + }).noUnknown(); ModelWithProperties.validate = async function(value) { return ModelWithProperties.schema.validate(value, { strict: true }); @@ -5693,11 +5587,9 @@ import * as yup from 'yup'; export let ModelWithReference; (function (ModelWithReference) { - ModelWithReference.schema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + ModelWithReference.schema = yup.object().shape({ + prop: ModelWithString.schema + }).noUnknown(); ModelWithReference.validate = async function(value) { return ModelWithReference.schema.validate(value, { strict: true }); @@ -5723,11 +5615,9 @@ import * as yup from 'yup'; export let ModelWithString; (function (ModelWithString) { - ModelWithString.schema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + ModelWithString.schema = yup.object().shape({ + prop: yup.string() + }).noUnknown(); ModelWithString.validate = async function(value) { return ModelWithString.schema.validate(value, { strict: true }); @@ -5740,6 +5630,44 @@ export let ModelWithString; })(ModelWithString || (ModelWithString = {}));" `; +exports[`generation v3 javascript file(./test/result/v3/javascript/models/ProblemDetails.js): ./test/result/v3/javascript/models/ProblemDetails.js 1`] = ` +"/* istanbul ignore file */ +/* eslint-disable */ +/* prettier-ignore */ + + +import * as yup from 'yup'; + +export let ProblemDetails; +(function (ProblemDetails) { + + ProblemDetails.schema = yup.object().shape({ + detail: yup.string().nullable(), + extensions: yup.lazy(value => { + return yup.object().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.object() + }), {}) + ).noUnknown(); + }), + instance: yup.string().nullable(), + status: yup.number().nullable(), + title: yup.string().nullable(), + type: yup.string().nullable() + }).noUnknown(); + + ProblemDetails.validate = async function(value) { + return ProblemDetails.schema.validate(value, { strict: true }); + }; + + ProblemDetails.validateSync = function(value) { + return ProblemDetails.schema.validateSync(value, { strict: true }); + }; + +})(ProblemDetails || (ProblemDetails = {}));" +`; + exports[`generation v3 javascript file(./test/result/v3/javascript/models/SimpleBoolean.js): ./test/result/v3/javascript/models/SimpleBoolean.js 1`] = ` "/* istanbul ignore file */ /* eslint-disable */ @@ -6721,6 +6649,7 @@ export { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; export { ModelWithProperties } from './models/ModelWithProperties'; export { ModelWithReference } from './models/ModelWithReference'; export { ModelWithString } from './models/ModelWithString'; +export { ProblemDetails } from './models/ProblemDetails'; export { SimpleBoolean } from './models/SimpleBoolean'; export { SimpleFile } from './models/SimpleFile'; export { SimpleInteger } from './models/SimpleInteger'; @@ -6839,12 +6768,10 @@ export namespace ArrayWithProperties { export const schema = yup.array<{ foo?: string, bar?: string - }>().of(( - yup.object().shape({ - foo: yup.lazy(() => yup.string().default(undefined)), - bar: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - )); + }>().of(yup.object().shape({ + foo: yup.string(), + bar: yup.string() + }).noUnknown()); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -6942,11 +6869,11 @@ export namespace DictionaryWithArray { export const schema = yup.lazy>>(value => { return yup.object>>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.array().of(ModelWithString.schema) + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.array().of(ModelWithString.schema) }), {}) - ); + ).noUnknown(); }); export async function validate(value: any): Promise { @@ -6977,18 +6904,18 @@ export namespace DictionaryWithDictionary { export const schema = yup.lazy>>(value => { return yup.object>>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.lazy>(value => { + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.lazy>(value => { return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() }), {}) - ); + ).noUnknown(); }) }), {}) - ); + ).noUnknown(); }); export async function validate(value: any): Promise { @@ -7028,16 +6955,14 @@ export namespace DictionaryWithProperties { foo?: string, bar?: string }>>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: ( - yup.object().shape({ - foo: yup.lazy(() => yup.string().default(undefined)), - bar: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ) + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.object().shape({ + foo: yup.string(), + bar: yup.string() + }).noUnknown() }), {}) - ); + ).noUnknown(); }); export async function validate(value: any): Promise { @@ -7069,11 +6994,11 @@ export namespace DictionaryWithReference { export const schema = yup.lazy>(value => { return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: ModelWithString.schema + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: ModelWithString.schema }), {}) - ); + ).noUnknown(); }); export async function validate(value: any): Promise { @@ -7104,11 +7029,11 @@ export namespace DictionaryWithString { export const schema = yup.lazy>(value => { return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() }), {}) - ); + ).noUnknown(); }); export async function validate(value: any): Promise { @@ -7243,11 +7168,9 @@ export interface ModelLink { export namespace ModelLink { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - id: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + id: yup.string() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7278,23 +7201,21 @@ export interface ModelThatExtends extends ModelWithString { export namespace ModelThatExtends { - export const schema: yup.ObjectSchema = ( - ModelWithString.schema.concat( - yup.object().shape({ - propExtendsA: yup.lazy(() => yup.string().default(undefined)), - propExtendsB: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ) - ); + export const schema: yup.ObjectSchema = ModelWithString.schema.concat( + yup.object().shape({ + propExtendsA: yup.string(), + propExtendsB: ModelWithString.schema + }).noUnknown()) + ; - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } - export function validateSync(value: any): ModelThatExtends { - return schema.validateSync(value, { strict: true }); - } -}" + export function validateSync(value: any): ModelThatExtends { + return schema.validateSync(value, { strict: true }); + } + }" `; exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelThatExtendsExtends.ts): ./test/result/v3/typescript/models/ModelThatExtendsExtends.ts 1`] = ` @@ -7317,25 +7238,23 @@ export interface ModelThatExtendsExtends extends ModelWithString, ModelThatExten export namespace ModelThatExtendsExtends { - export const schema: yup.ObjectSchema = ( - ModelWithString.schema.concat( - ModelThatExtends.schema.concat( - yup.object().shape({ - propExtendsC: yup.lazy(() => yup.string().default(undefined)), - propExtendsD: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ) + export const schema: yup.ObjectSchema = ModelWithString.schema.concat( + ModelThatExtends.schema.concat( + yup.object().shape({ + propExtendsC: yup.string(), + propExtendsD: ModelWithString.schema + }).noUnknown()) ) - ); + ; - export async function validate(value: any): Promise { - return schema.validate(value, { strict: true }); - } + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } - export function validateSync(value: any): ModelThatExtendsExtends { - return schema.validateSync(value, { strict: true }); - } -}" + export function validateSync(value: any): ModelThatExtendsExtends { + return schema.validateSync(value, { strict: true }); + } + }" `; exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelWithArray.ts): ./test/result/v3/typescript/models/ModelWithArray.ts 1`] = ` @@ -7358,13 +7277,11 @@ export interface ModelWithArray { export namespace ModelWithArray { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.array().of(ModelWithString.schema).default(undefined)), - propWithFile: yup.lazy(() => yup.array().of(yup.mixed()).default(undefined)), - propWithNumber: yup.lazy(() => yup.array().of(yup.number()).default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: yup.array().of(ModelWithString.schema), + propWithFile: yup.array().of(yup.mixed()), + propWithNumber: yup.array().of(yup.number()) + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7396,11 +7313,9 @@ export interface ModelWithBoolean { export namespace ModelWithBoolean { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.boolean().default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: yup.boolean() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7429,11 +7344,9 @@ export interface ModelWithCircularReference { export namespace ModelWithCircularReference { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithCircularReference.schema.default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: ModelWithCircularReference.schema + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7463,18 +7376,16 @@ export interface ModelWithDictionary { export namespace ModelWithDictionary { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.lazy>(value => { - return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.string() - }), {}) - ); - }).default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: yup.lazy>(value => { + return yup.object>().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.string() + }), {}) + ).noUnknown(); + }) + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7506,13 +7417,11 @@ export interface ModelWithDuplicateImports { export namespace ModelWithDuplicateImports { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - propA: yup.lazy(() => ModelWithString.schema.default(undefined)), - propB: yup.lazy(() => ModelWithString.schema.default(undefined)), - propC: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + propA: ModelWithString.schema, + propB: ModelWithString.schema, + propC: ModelWithString.schema + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7542,11 +7451,9 @@ export interface ModelWithDuplicateProperties { export namespace ModelWithDuplicateProperties { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: ModelWithString.schema + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7587,15 +7494,13 @@ export namespace ModelWithEnum { ERROR = 'Error' } - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - Test: yup.lazy(() => yup.mixed().oneOf([ - Test.SUCCESS, - Test.WARNING, - Test.ERROR - ]).default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + Test: yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ]) + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7636,15 +7541,13 @@ export namespace ModelWithEnumFromDescription { ERROR = 3 } - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - Test: yup.lazy(() => yup.mixed().oneOf([ - Test.SUCCESS, - Test.WARNING, - Test.ERROR - ]).default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + Test: yup.mixed().oneOf([ + 1, + 2, + 3 + ]) + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7676,11 +7579,9 @@ export interface ModelWithInteger { export namespace ModelWithInteger { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.number().default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: yup.number() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7711,11 +7612,9 @@ export interface ModelWithLink { export namespace ModelWithLink { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelLink.schema.default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: ModelLink.schema + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7733,7 +7632,6 @@ exports[`generation v3 typescript file(./test/result/v3/typescript/models/ModelW /* eslint-disable */ /* prettier-ignore */ -import { array } from '../models/array'; import { Dictionary } from '../models/Dictionary'; import * as yup from 'yup'; @@ -7741,44 +7639,50 @@ import * as yup from 'yup'; * This is a model with nested enums */ export interface ModelWithNestedEnums { - arrayWithDescription?: array; - arrayWithEnum?: array; + arrayWithDescription?: Array<(1 | 2 | 3)>; + arrayWithEnum?: Array<('Success' | 'Warning' | 'Error')>; dictionaryWithEnum?: Dictionary<('Success' | 'Warning' | 'Error')>; dictionaryWithEnumFromDescription?: Dictionary<(1 | 2 | 3)>; } export namespace ModelWithNestedEnums { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - arrayWithDescription: yup.lazy(() => yup.mixed().default(undefined)), - arrayWithEnum: yup.lazy(() => yup.mixed().default(undefined)), - dictionaryWithEnum: yup.lazy(() => yup.lazy>(value => { - return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.mixed().oneOf([ - 'Success', - 'Warning', - 'Error' - ]) - }), {}) - ); - }).default(undefined)), - dictionaryWithEnumFromDescription: yup.lazy(() => yup.lazy>(value => { - return yup.object>().shape( - Object.entries(value).reduce((obj, item) => ({ - ...obj, - [item[0]]: yup.mixed().oneOf([ - 1, - 2, - 3 - ]) - }), {}) - ); - }).default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + arrayWithDescription: yup.array<(1 | 2 | 3)>().of(yup.mixed().oneOf([ + 1, + 2, + 3 + ])), + arrayWithEnum: yup.array<('Success' | 'Warning' | 'Error')>().of(yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ])), + dictionaryWithEnum: yup.lazy>(value => { + return yup.object>().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.mixed().oneOf([ + 'Success', + 'Warning', + 'Error' + ]) + }), {}) + ).noUnknown(); + }), + dictionaryWithEnumFromDescription: yup.lazy>(value => { + return yup.object>().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.mixed().oneOf([ + 1, + 2, + 3 + ]) + }), {}) + ).noUnknown(); + }) + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7811,19 +7715,13 @@ export interface ModelWithNestedProperties { export namespace ModelWithNestedProperties { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - first: yup.lazy(() => ( - yup.object().shape({ - second: yup.lazy(() => ( - yup.object().shape({ - third: yup.lazy(() => yup.string().default(undefined).nullable().required()) - }).noUnknown() - ).default(undefined).nullable().required()) - }).noUnknown() - ).default(undefined).nullable().required()) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + first: yup.object().shape({ + second: yup.object().shape({ + third: yup.string().nullable().required() + }).noUnknown().nullable().required() + }).noUnknown().nullable().required() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7859,17 +7757,15 @@ export interface ModelWithProperties { export namespace ModelWithProperties { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - boolean: yup.lazy(() => yup.boolean().default(undefined)), - number: yup.lazy(() => yup.number().default(undefined)), - reference: yup.lazy(() => ModelWithString.schema.default(undefined)), - required: yup.lazy(() => yup.string().default(undefined).required()), - requiredAndNullable: yup.lazy(() => yup.string().default(undefined).nullable().required()), - requiredAndReadOnly: yup.lazy(() => yup.string().default(undefined).required()), - string: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + boolean: yup.boolean(), + number: yup.number(), + reference: ModelWithString.schema, + required: yup.string().required(), + requiredAndNullable: yup.string().nullable().required(), + requiredAndReadOnly: yup.string().required(), + string: yup.string() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7899,11 +7795,9 @@ export interface ModelWithReference { export namespace ModelWithReference { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => ModelWithString.schema.default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: ModelWithString.schema + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7935,11 +7829,9 @@ export interface ModelWithString { export namespace ModelWithString { - export const schema: yup.ObjectSchema = ( - yup.object().shape({ - prop: yup.lazy(() => yup.string().default(undefined)) - }).noUnknown() - ); + export const schema: yup.ObjectSchema = yup.object().shape({ + prop: yup.string() + }).noUnknown(); export async function validate(value: any): Promise { return schema.validate(value, { strict: true }); @@ -7951,6 +7843,52 @@ export namespace ModelWithString { }" `; +exports[`generation v3 typescript file(./test/result/v3/typescript/models/ProblemDetails.ts): ./test/result/v3/typescript/models/ProblemDetails.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/* prettier-ignore */ + +import { Dictionary } from '../models/Dictionary'; +import * as yup from 'yup'; + +export interface ProblemDetails { + detail?: string | null; + readonly extensions?: Dictionary | null; + instance?: string | null; + status?: number | null; + title?: string | null; + type?: string | null; +} + +export namespace ProblemDetails { + + export const schema: yup.ObjectSchema = yup.object().shape({ + detail: yup.string().nullable(), + extensions: yup.lazy>(value => { + return yup.object>().shape( + Object.keys(value).reduce((object, key) => ({ + ...object, + [key]: yup.object() + }), {}) + ).noUnknown(); + }), + instance: yup.string().nullable(), + status: yup.number().nullable(), + title: yup.string().nullable(), + type: yup.string().nullable() + }).noUnknown(); + + export async function validate(value: any): Promise { + return schema.validate(value, { strict: true }); + } + + export function validateSync(value: any): ProblemDetails { + return schema.validateSync(value, { strict: true }); + } +}" +`; + exports[`generation v3 typescript file(./test/result/v3/typescript/models/SimpleBoolean.ts): ./test/result/v3/typescript/models/SimpleBoolean.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -8163,11 +8101,11 @@ export class DefaultsService { * @throws ApiError */ public static async callWithDefaultParameters( - parameterString: string | null = 'Hello World!', - parameterNumber: number | null = 123, - parameterBoolean: boolean | null = true, - parameterEnum: ('Success' | 'Warning' | 'Error') = 'Success', - parameterModel: ModelWithString | null = { + parameterString?: string | null = 'Hello World!', + parameterNumber?: number | null = 123, + parameterBoolean?: boolean | null = true, + parameterEnum?: ('Success' | 'Warning' | 'Error') = 'Success', + parameterModel?: ModelWithString | null = { \\"prop\\": \\"Hello World\\" } ): Promise { diff --git a/yarn.lock b/yarn.lock index 35aa6c9c..2c512fd3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -654,9 +654,9 @@ "@babel/plugin-transform-typescript" "^7.7.4" "@babel/runtime@^7.0.0": - version "7.7.1" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.1.tgz#b223497bbfbcbbb38116673904debc71470ca528" - integrity sha512-SQ0sS7KUJDvgCI2cpZG0nJygO6002oTbhgSuw4WcocsnbxLwL5Q8I3fqbJdyBAc3uFrWZiR2JomseuxSuci3SQ== + version "7.7.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.4.tgz#b23a856751e4bf099262f867767889c0e3fe175b" + integrity sha512-r24eVUUr0QqNZa+qrImUk8fn5SPhHq+IfYvIoIMg0do3GdK9sMdiLKP3GYVVaxpPKORgm8KRKaNTEhAjgIpLMw== dependencies: regenerator-runtime "^0.13.2" @@ -876,9 +876,9 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.0.7" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.7.tgz#2496e9ff56196cc1429c72034e07eab6121b6f3f" - integrity sha512-CeBpmX1J8kWLcDEnI3Cl2Eo6RfbGvzUctA+CjZUhOKDFbLfcr7fc4usEqLNWetrlJd7RhAkyYe2czXop4fICpw== + version "7.0.8" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.8.tgz#479a4ee3e291a403a1096106013ec22cf9b64012" + integrity sha512-yGeB2dHEdvxjP0y4UbRtQaSkXJ9649fYCmIdRoul5kfAoGCwxuCbMhag0k3RPfnuh9kPGm8x89btcfDEXdVWGw== dependencies: "@babel/types" "^7.3.0" @@ -1034,9 +1034,9 @@ tsutils "^3.17.1" abab@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.2.tgz#a2fba1b122c69a85caa02d10f9270c7219709a9d" - integrity sha512-2scffjvioEmNz0OyDSLGWDfKCVwaKc6l9Pm9kOIREU13ClXZvHpg/nRL5xyjSSSLhOnXqft2HpsAzNEEA8cFFg== + version "2.0.3" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.3.tgz#623e2075e02eb2d3f2475e49f99c91846467907a" + integrity sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg== abbrev@1: version "1.1.1" @@ -1067,9 +1067,9 @@ acorn@^5.5.3: integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== acorn@^6.0.1: - version "6.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" - integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== + version "6.4.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.0.tgz#b659d2ffbafa24baf5db1cdbb2c94a983ecd2784" + integrity sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw== acorn@^7.1.0: version "7.1.0" @@ -1092,11 +1092,11 @@ ansi-escapes@^3.0.0: integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== ansi-escapes@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.2.1.tgz#4dccdb846c3eee10f6d64dea66273eab90c37228" - integrity sha512-Cg3ymMAdN10wOk/VYfLV7KCQyv7EDirJ64500sU7n9UlmioEtDuU5Gd+hj73hXSU/ex7tHJSssmyftDdkMLO8Q== + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.0.tgz#a4ce2b33d6b214b7950d8595c212f12ac9cc569d" + integrity sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg== dependencies: - type-fest "^0.5.2" + type-fest "^0.8.1" ansi-regex@^2.0.0: version "2.1.1" @@ -1113,6 +1113,11 @@ ansi-regex@^4.0.0, ansi-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + ansi-styles@^3.2.0, ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" @@ -1224,9 +1229,9 @@ aws-sign2@~0.7.0: integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= aws4@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.8.0.tgz#f0e003d9ca9e7f59c7a508945d7b2ef9a04a542f" - integrity sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ== + version "1.9.0" + resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.0.tgz#24390e6ad61386b0a747265754d2a17219de862c" + integrity sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A== babel-jest@^24.9.0: version "24.9.0" @@ -1334,14 +1339,14 @@ browser-resolve@^1.11.3: dependencies: resolve "1.1.7" -browserslist@^4.6.0, browserslist@^4.7.2: - version "4.7.2" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.7.2.tgz#1bb984531a476b5d389cedecb195b2cd69fb1348" - integrity sha512-uZavT/gZXJd2UTi9Ov7/Z340WOSQ3+m1iBVRUknf+okKxonL9P83S3ctiBDtuRmRu8PiCHjqyueqQ9HYlJhxiw== +browserslist@^4.6.0, browserslist@^4.8.0: + version "4.8.0" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.0.tgz#6f06b0f974a7cc3a84babc2ccc56493668e3c789" + integrity sha512-HYnxc/oLRWvJ3TsGegR0SRL/UDnknGq2s/a8dYYEO+kOQ9m9apKoS5oiathLKZdh/e9uE+/J3j92qPlGD/vTqA== dependencies: - caniuse-lite "^1.0.30001004" - electron-to-chromium "^1.3.295" - node-releases "^1.1.38" + caniuse-lite "^1.0.30001012" + electron-to-chromium "^1.3.317" + node-releases "^1.1.41" bser@^2.0.0: version "2.1.1" @@ -1380,10 +1385,10 @@ camelcase@5.3.1, camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -caniuse-lite@^1.0.30001004: - version "1.0.30001008" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001008.tgz#b8841b1df78a9f5ed9702537ef592f1f8772c0d9" - integrity sha512-b8DJyb+VVXZGRgJUa30cbk8gKHZ3LOZTBLaUEEVr2P4xpmFigOCc62CO4uzquW641Ouq1Rm9N+rWLWdSYDaDIw== +caniuse-lite@^1.0.30001012: + version "1.0.30001013" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001013.tgz#da2440d4d266a17d40eb79bd19c0c8cc1d029c72" + integrity sha512-hOAXaWKuq/UVFgYawxIOdPdyMQdYcwOCDOjnZcKn7wCgFUrhP7smuNZjGLuJlPSgE6aRA4cRJ+bGSrhtEt7ZAg== capture-exit@^2.0.0: version "2.0.0" @@ -1547,11 +1552,11 @@ copy-descriptor@^0.1.0: integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= core-js-compat@^3.1.1: - version "3.3.6" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.3.6.tgz#70c30dbeb582626efe9ecd6f49daa9ff4aeb136c" - integrity sha512-YnwZG/+0/f7Pf6Lr3jxtVAFjtGBW9lsLYcqrxhYJai1GfvrP8DEyEpnNzj/FRQfIkOOfk1j5tTBvPBLWVVJm4A== + version "3.4.7" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.4.7.tgz#39f8080b1d92a524d6d90505c42b9c5c1eb90611" + integrity sha512-57+mgz/P/xsGdjwQYkwtBZR3LuISaxD1dEwVDtbk8xJMqAmwqaxLOvnNT7kdJ7jYE/NjNptyzXi+IQFMi/2fCw== dependencies: - browserslist "^4.7.2" + browserslist "^4.8.0" semver "^6.3.0" core-util-is@1.0.2, core-util-is@~1.0.0: @@ -1715,10 +1720,10 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -electron-to-chromium@^1.3.295: - version "1.3.304" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.304.tgz#49b47d961f8143116174c2f70fbfee3aabf43015" - integrity sha512-a5mqa13jCdBc+Crgk3Gyr7vpXCiFWfFq23YDCEmrPYeiDOQKZDVE6EX/Q4Xdv97n3XkcjiSBDOY0IS19yP2yeA== +electron-to-chromium@^1.3.317: + version "1.3.322" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.322.tgz#a6f7e1c79025c2b05838e8e344f6e89eb83213a8" + integrity sha512-Tc8JQEfGQ1MzfSzI/bTlSr7btJv/FFO7Yh6tanqVmIWOuNCu6/D1MilIEgLtmWqIrsv+o4IjpLAhgMBr/ncNAA== emoji-regex@^7.0.1: version "7.0.3" @@ -1745,25 +1750,25 @@ error-ex@^1.3.1: is-arrayish "^0.2.1" es-abstract@^1.5.1: - version "1.16.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.0.tgz#d3a26dc9c3283ac9750dca569586e976d9dcc06d" - integrity sha512-xdQnfykZ9JMEiasTAJZJdMWCQ1Vm00NBw79/AWi7ELfZuuPCSOMDZbT9mkOfSctVtfhb+sAAzrm+j//GjjLHLg== + version "1.16.2" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.16.2.tgz#4e874331645e9925edef141e74fc4bd144669d34" + integrity sha512-jYo/J8XU2emLXl3OLwfwtuFfuF2w6DYPs+xy9ZfVyPkDcrauu6LYrw/q2TyCtrbc/KUdCiC5e9UajRhgNkVopA== dependencies: - es-to-primitive "^1.2.0" + es-to-primitive "^1.2.1" function-bind "^1.1.1" has "^1.0.3" - has-symbols "^1.0.0" + has-symbols "^1.0.1" is-callable "^1.1.4" is-regex "^1.0.4" - object-inspect "^1.6.0" + object-inspect "^1.7.0" object-keys "^1.1.1" string.prototype.trimleft "^2.1.0" string.prototype.trimright "^2.1.0" -es-to-primitive@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" - integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== dependencies: is-callable "^1.1.4" is-date-object "^1.0.1" @@ -1914,9 +1919,9 @@ esutils@^2.0.2: integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== exec-sh@^0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" - integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== + version "0.3.4" + resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.4.tgz#3a018ceb526cc6f6df2bb504b2bfe8e3a4934ec5" + integrity sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A== execa@^1.0.0: version "1.0.0" @@ -2197,7 +2202,7 @@ glob-parent@^5.0.0: dependencies: is-glob "^4.0.1" -glob@7.1.6, glob@^7.1.6: +glob@7.1.6, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -2209,18 +2214,6 @@ glob@7.1.6, glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3: - version "7.1.5" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.5.tgz#6714c69bee20f3c3e64c4dd905553e532b40cdc0" - integrity sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" @@ -2277,10 +2270,10 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -has-symbols@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" - integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= +has-symbols@^1.0.0, has-symbols@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" + integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== has-unicode@^2.0.0: version "2.0.1" @@ -2366,9 +2359,9 @@ ignore@^4.0.6: integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== import-fresh@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.1.0.tgz#6d33fa1dcef6df930fae003446f33415af905118" - integrity sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ== + version "3.2.1" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" + integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== dependencies: parent-module "^1.0.0" resolve-from "^4.0.0" @@ -2586,11 +2579,11 @@ is-stream@^1.1.0: integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= is-symbol@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" - integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" + integrity sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ== dependencies: - has-symbols "^1.0.0" + has-symbols "^1.0.1" is-typedarray@~1.0.0: version "1.0.0" @@ -3278,17 +3271,17 @@ micromatch@^3.1.10, micromatch@^3.1.4: snapdragon "^0.8.1" to-regex "^3.0.2" -mime-db@1.40.0: - version "1.40.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" - integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== +mime-db@1.42.0: + version "1.42.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.42.0.tgz#3e252907b4c7adb906597b4b65636272cf9e7bac" + integrity sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ== mime-types@^2.1.12, mime-types@~2.1.19: - version "2.1.24" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" - integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== + version "2.1.25" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.25.tgz#39772d46621f93e2a80a856c53b86a62156a6437" + integrity sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg== dependencies: - mime-db "1.40.0" + mime-db "1.42.0" mimic-fn@^2.1.0: version "2.1.0" @@ -3445,10 +3438,10 @@ node-pre-gyp@^0.12.0: semver "^5.3.0" tar "^4" -node-releases@^1.1.38: - version "1.1.39" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.39.tgz#c1011f30343aff5b633153b10ff691d278d08e8d" - integrity sha512-8MRC/ErwNCHOlAFycy9OPca46fQYUjbJRDcZTHVWIGXIjYLM73k70vv3WkYutVnM4cCo4hE0MqBVVZjP6vjISA== +node-releases@^1.1.41: + version "1.1.41" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.41.tgz#57674a82a37f812d18e3b26118aefaf53a00afed" + integrity sha512-+IctMa7wIs8Cfsa8iYzeaLTFwv5Y4r5jZud+4AnfymzeEXKBCavFX0KBgzVaPVqf0ywa6PrO8/b+bPqdwjGBSg== dependencies: semver "^6.3.0" @@ -3536,10 +3529,10 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" -object-inspect@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" - integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ== +object-inspect@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" + integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw== object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: version "1.1.1" @@ -3813,9 +3806,9 @@ progress@^2.0.0: integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== prompts@^2.0.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.2.1.tgz#f901dd2a2dfee080359c0e20059b24188d75ad35" - integrity sha512-VObPvJiWPhpZI6C5m60XOzTfnYg/xc/an+r9VYymj9WJW3B/DIH+REzjpAACPf8brwPeP+7vz3bIim3S+AaMjw== + version "2.3.0" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.3.0.tgz#a444e968fa4cc7e86689a74050685ac8006c4cc4" + integrity sha512-NfbbPPg/74fT7wk2XYQ7hAIp9zJyZp5Fu19iRbORqqy1BhtrkZ0fPafBU+7bmn8ie69DpT0R6QpJIN2oisYjJg== dependencies: kleur "^3.0.3" sisteransi "^1.0.3" @@ -3826,9 +3819,9 @@ property-expr@^1.5.0: integrity sha512-CGuc0VUTGthpJXL36ydB6jnbyOf/rAHFvmVrJlH+Rg0DqqLFQGAP6hIaxD/G0OAmBJPhXDHuEJigrp0e0wFV6g== psl@^1.1.24, psl@^1.1.28: - version "1.4.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2" - integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw== + version "1.5.0" + resolved "https://registry.yarnpkg.com/psl/-/psl-1.5.0.tgz#47fd1292def7fdb1e138cd78afa8814cebcf7b13" + integrity sha512-4vqUjKi2huMu1OJiLhi3jN6jeeKvMZdI1tYgi/njW5zV52jNLgSAZSdN16m9bJFe61/cT8ulmw4qFitV9QRsEA== pump@^3.0.0: version "3.0.0" @@ -3864,9 +3857,9 @@ rc@^1.2.7: strip-json-comments "~2.0.1" react-is@^16.8.4: - version "16.11.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.11.0.tgz#b85dfecd48ad1ce469ff558a882ca8e8313928fa" - integrity sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw== + version "16.12.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" + integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== read-pkg-up@^4.0.0: version "4.0.0" @@ -4066,9 +4059,9 @@ resolve@1.1.7: integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= resolve@^1.10.0, resolve@^1.3.2: - version "1.12.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" - integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== + version "1.13.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.1.tgz#be0aa4c06acd53083505abb35f4d66932ab35d16" + integrity sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w== dependencies: path-parse "^1.0.6" @@ -4215,9 +4208,9 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= sisteransi@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.3.tgz#98168d62b79e3a5e758e27ae63c4a053d748f4eb" - integrity sha512-SbEG75TzH8G7eVXFSN5f9EExILKfly7SUvVY5DhhYLvfhKqhDFY0OzevWa/zwak0RLRfWS5AvfMWpd9gJvr5Yg== + version "1.0.4" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.4.tgz#386713f1ef688c7c0304dc4c0632898941cad2e3" + integrity sha512-/ekMoM4NJ59ivGSfKapeG+FWtrmWvA1p6FBZwXrqojw90vJu8lBmrTxCMuBCydKtkaUe2zt4PlxeTKpjwMbyig== slash@^2.0.0: version "2.0.0" @@ -4403,13 +4396,13 @@ string-width@^3.0.0, string-width@^3.1.0: strip-ansi "^5.1.0" string-width@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.1.0.tgz#ba846d1daa97c3c596155308063e075ed1c99aff" - integrity sha512-NrX+1dVVh+6Y9dnQ19pR0pP4FiEIlUvdTGn8pw6CKTNq5sgib2nIhmUNT5TAmhWmvKr3WcxBcP3E8nWezuipuQ== + version "4.2.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" + integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== dependencies: emoji-regex "^8.0.0" is-fullwidth-code-point "^3.0.0" - strip-ansi "^5.2.0" + strip-ansi "^6.0.0" string.prototype.trimleft@^2.1.0: version "2.1.0" @@ -4455,6 +4448,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" @@ -4655,11 +4655,6 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-fest@^0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2" - integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw== - type-fest@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" @@ -4671,9 +4666,9 @@ typescript@3.7.2: integrity sha512-ml7V7JfiN2Xwvcer+XAf2csGO1bPBdRbFCkYBczNZggrBZ9c7G3riSUeJmqEU5uOtXNPMhE3n+R4FA/3YOAWOQ== uglify-js@^3.1.4: - version "3.6.8" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.8.tgz#5edcbcf9d49cbb0403dc49f856fe81530d65145e" - integrity sha512-XhHJ3S3ZyMwP8kY1Gkugqx3CJh2C3O0y8NPiSxtm1tyD/pktLAkFZsFGpuNfTZddKDQ/bbDBLAd2YyA1pbi8HQ== + version "3.7.1" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.7.1.tgz#35c7de17971a4aa7689cd2eae0a5b39bb838c0c5" + integrity sha512-pnOF7jY82wdIhATVn87uUY/FHU+MDUdPLkmGFvGoclQmeu229eTkbG5gjGGBi3R7UuYYSEeYXY/TTY5j2aym2g== dependencies: commander "~2.20.3" source-map "~0.6.1"