From b8ec9654322b86056ca4a99aa3b5b28c828e93ab Mon Sep 17 00:00:00 2001 From: Josh Chappelow Date: Sun, 1 Sep 2024 21:24:08 +0900 Subject: [PATCH] refactor: {} => object --- .../swagger/definitionsGeneration/definitions.spec.ts | 4 ++-- tests/unit/swagger/parameterDetails3.spec.ts | 2 +- tests/unit/swagger/schemaDetails.spec.ts | 2 +- tests/unit/swagger/schemaDetails3.spec.ts | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/unit/swagger/definitionsGeneration/definitions.spec.ts b/tests/unit/swagger/definitionsGeneration/definitions.spec.ts index da48af4cc..e4e03f092 100644 --- a/tests/unit/swagger/definitionsGeneration/definitions.spec.ts +++ b/tests/unit/swagger/definitionsGeneration/definitions.spec.ts @@ -14,10 +14,10 @@ describe('Definition generation', () => { const dynamicMetadata = new MetadataGenerator('./fixtures/controllers/getController.ts', undefined, undefined, ['./fixtures/controllers/getController.ts']).Generate(); const defaultConfig = getDefaultOptions(); const defaultOptions: ExtendedSpecConfig = { ...defaultConfig.spec, entryFile: defaultConfig.entryFile, noImplicitAdditionalProperties: 'ignore' }; - const optionsWithNoAdditional = Object.assign<{}, ExtendedSpecConfig, Partial>({}, defaultOptions, { + const optionsWithNoAdditional = Object.assign>({}, defaultOptions, { noImplicitAdditionalProperties: 'silently-remove-extras', }); - const optionsWithXEnumVarnames = Object.assign<{}, ExtendedSpecConfig, Partial>({}, defaultOptions, { + const optionsWithXEnumVarnames = Object.assign>({}, defaultOptions, { xEnumVarnames: true, }); interface SpecAndName { diff --git a/tests/unit/swagger/parameterDetails3.spec.ts b/tests/unit/swagger/parameterDetails3.spec.ts index 7ea8e7d89..0e3be3b97 100644 --- a/tests/unit/swagger/parameterDetails3.spec.ts +++ b/tests/unit/swagger/parameterDetails3.spec.ts @@ -11,7 +11,7 @@ describe('Parameter generation for OpenAPI 3.0.0', () => { const defaultConfig = getDefaultOptions(); const defaultOptions: ExtendedSpecConfig = { ...defaultConfig.spec, noImplicitAdditionalProperties: 'ignore', entryFile: defaultConfig.entryFile }; - const optionsWithNoAdditional = Object.assign<{}, ExtendedSpecConfig, Partial>({}, defaultOptions, { + const optionsWithNoAdditional = Object.assign>({}, defaultOptions, { noImplicitAdditionalProperties: 'silently-remove-extras', }); diff --git a/tests/unit/swagger/schemaDetails.spec.ts b/tests/unit/swagger/schemaDetails.spec.ts index 444966e21..3e9229a35 100644 --- a/tests/unit/swagger/schemaDetails.spec.ts +++ b/tests/unit/swagger/schemaDetails.spec.ts @@ -349,7 +349,7 @@ describe('Schema details generation', () => { describe('methods', () => { describe('operationId', () => { - const optionsWithOperationIdTemplate = Object.assign<{}, ExtendedSpecConfig, Partial>({}, getDefaultExtendedOptions(), { + const optionsWithOperationIdTemplate = Object.assign>({}, getDefaultExtendedOptions(), { operationIdTemplate: "{{replace controllerName 'Controller' ''}}_{{titleCase method.name}}", }); diff --git a/tests/unit/swagger/schemaDetails3.spec.ts b/tests/unit/swagger/schemaDetails3.spec.ts index 77bc45314..f954e6187 100644 --- a/tests/unit/swagger/schemaDetails3.spec.ts +++ b/tests/unit/swagger/schemaDetails3.spec.ts @@ -14,13 +14,13 @@ describe('Definition generation for OpenAPI 3.0.0', () => { const metadataPost = new MetadataGenerator('./fixtures/controllers/postController.ts').Generate(); const defaultOptions: ExtendedSpecConfig = getDefaultExtendedOptions(); - const optionsWithNoAdditional = Object.assign<{}, ExtendedSpecConfig, Partial>({}, defaultOptions, { + const optionsWithNoAdditional = Object.assign>({}, defaultOptions, { noImplicitAdditionalProperties: 'silently-remove-extras', }); - const optionsWithXEnumVarnames = Object.assign<{}, ExtendedSpecConfig, Partial>({}, defaultOptions, { + const optionsWithXEnumVarnames = Object.assign>({}, defaultOptions, { xEnumVarnames: true, }); - const optionsWithOperationIdTemplate = Object.assign<{}, ExtendedSpecConfig, Partial>({}, defaultOptions, { + const optionsWithOperationIdTemplate = Object.assign>({}, defaultOptions, { operationIdTemplate: "{{replace controllerName 'Controller' ''}}_{{titleCase method.name}}", }); @@ -91,7 +91,7 @@ describe('Definition generation for OpenAPI 3.0.0', () => { }); it('should have relative URL when no host is defined', () => { - const optionsWithNoHost = Object.assign<{}, ExtendedSpecConfig>({}, defaultOptions); + const optionsWithNoHost = Object.assign({}, defaultOptions); delete optionsWithNoHost.host; const spec: Swagger.Spec3 = new SpecGenerator3(metadataGet, optionsWithNoHost).GetSpec();