From 504928f76aa059615afb954e33477daa1b9662c7 Mon Sep 17 00:00:00 2001 From: Mark Brockhoff Date: Thu, 14 Jul 2022 11:17:31 +0200 Subject: [PATCH] feat: Add postfixModels to generate function & rename postfix to postfixServices --- src/index.ts | 19 ++- src/templates/index.hbs | 10 +- src/utils/writeClient.ts | 13 +- src/utils/writeClientIndex.spec.ts | 2 +- src/utils/writeClientIndex.ts | 9 +- test/__snapshots__/index.spec.ts.snap | 222 +++++++++++++------------- test/index.spec.ts | 2 + types/index.d.ts | 5 + 8 files changed, 153 insertions(+), 129 deletions(-) diff --git a/src/index.ts b/src/index.ts index ef7a8b1b..e99946a7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,7 +24,12 @@ export type Options = { exportModels?: boolean; exportSchemas?: boolean; indent?: Indent; + /** + * @deprecated use postfixServices instead + */ postfix?: string; + postfixServices?: string; + postfixModels?: string; request?: string; write?: boolean; }; @@ -44,7 +49,9 @@ export type Options = { * @param exportModels Generate models * @param exportSchemas Generate schemas * @param indent Indentation options (4, 2 or tab) - * @param postfix Service name postfix + * @param postfix Deprecated: Param to support old parameter postfix, use postfixServices instead + * @param postfixServices Service name postfix + * @param postfixModels Model name postfix * @param request Path to custom request file * @param write Write the files to disk (true or false) */ @@ -60,7 +67,9 @@ export const generate = async ({ exportModels = true, exportSchemas = false, indent = Indent.SPACE_4, - postfix = 'Service', + postfix, + postfixServices = 'Service', + postfixModels = '', request, write = true, }: Options): Promise => { @@ -89,7 +98,8 @@ export const generate = async ({ exportModels, exportSchemas, indent, - postfix, + postfix ?? postfixServices, + postfixModels, clientName, request ); @@ -112,7 +122,8 @@ export const generate = async ({ exportModels, exportSchemas, indent, - postfix, + postfix ?? postfixServices, + postfixModels, clientName, request ); diff --git a/src/templates/index.hbs b/src/templates/index.hbs index 72544d7d..190dd867 100644 --- a/src/templates/index.hbs +++ b/src/templates/index.hbs @@ -18,13 +18,13 @@ export type { OpenAPIConfig } from './core/OpenAPI'; {{#each models}} {{#if @root.useUnionTypes}} -export type { {{{name}}} } from './models/{{{name}}}'; +export type { {{{name}}} as {{{name}}}{{{@root.postfixModels}}} } from './models/{{{name}}}'; {{else if enum}} -export { {{{name}}} } from './models/{{{name}}}'; +export { {{{name}}} as {{{name}}}{{{@root.postfixModels}}} } from './models/{{{name}}}'; {{else if enums}} -export { {{{name}}} } from './models/{{{name}}}'; +export { {{{name}}} as {{{name}}}{{{@root.postfixModels}}} } from './models/{{{name}}}'; {{else}} -export type { {{{name}}} } from './models/{{{name}}}'; +export type { {{{name}}} as {{{name}}}{{{@root.postfixModels}}} } from './models/{{{name}}}'; {{/if}} {{/each}} {{/if}} @@ -41,7 +41,7 @@ export { ${{{name}}} } from './schemas/${{{name}}}'; {{#if services}} {{#each services}} -export { {{{name}}}{{{@root.postfix}}} } from './services/{{{name}}}{{{@root.postfix}}}'; +export { {{{name}}}{{{@root.postfixServices}}} } from './services/{{{name}}}{{{@root.postfixServices}}}'; {{/each}} {{/if}} {{/if}} diff --git a/src/utils/writeClient.ts b/src/utils/writeClient.ts index a0ffc182..cea2f3d8 100644 --- a/src/utils/writeClient.ts +++ b/src/utils/writeClient.ts @@ -28,7 +28,8 @@ import { writeClientServices } from './writeClientServices'; * @param exportSchemas Generate schemas * @param exportSchemas Generate schemas * @param indent Indentation options (4, 2 or tab) - * @param postfix Service name postfix + * @param postfixServices Service name postfix + * @param postfixModels Model name postfix * @param clientName Custom client class name * @param request Path to custom request file */ @@ -44,7 +45,8 @@ export const writeClient = async ( exportModels: boolean, exportSchemas: boolean, indent: Indent, - postfix: string, + postfixServices: string, + postfixModels: string, clientName?: string, request?: string ): Promise => { @@ -75,7 +77,7 @@ export const writeClient = async ( useUnionTypes, useOptions, indent, - postfix, + postfixServices, clientName ); } @@ -94,7 +96,7 @@ export const writeClient = async ( if (isDefined(clientName)) { await mkdir(outputPath); - await writeClientClass(client, templates, outputPath, httpClient, clientName, indent, postfix); + await writeClientClass(client, templates, outputPath, httpClient, clientName, indent, postfixServices); } if (exportCore || exportServices || exportSchemas || exportModels) { @@ -108,7 +110,8 @@ export const writeClient = async ( exportServices, exportModels, exportSchemas, - postfix, + postfixServices, + postfixModels, clientName ); } diff --git a/src/utils/writeClientIndex.spec.ts b/src/utils/writeClientIndex.spec.ts index 6284dfd2..a7442111 100644 --- a/src/utils/writeClientIndex.spec.ts +++ b/src/utils/writeClientIndex.spec.ts @@ -34,7 +34,7 @@ describe('writeClientIndex', () => { }, }; - await writeClientIndex(client, templates, '/', true, true, true, true, true, 'Service'); + await writeClientIndex(client, templates, '/', true, true, true, true, true, 'Service', ''); expect(writeFile).toBeCalledWith('/index.ts', 'index'); }); diff --git a/src/utils/writeClientIndex.ts b/src/utils/writeClientIndex.ts index eaecd1b4..5044294d 100644 --- a/src/utils/writeClientIndex.ts +++ b/src/utils/writeClientIndex.ts @@ -19,7 +19,8 @@ import { sortServicesByName } from './sortServicesByName'; * @param exportServices Generate services * @param exportModels Generate models * @param exportSchemas Generate schemas - * @param postfix Service name postfix + * @param postfixServices Service name postfix + * @param postfixModels Model name postfix * @param clientName Custom client class name */ export const writeClientIndex = async ( @@ -31,7 +32,8 @@ export const writeClientIndex = async ( exportServices: boolean, exportModels: boolean, exportSchemas: boolean, - postfix: string, + postfixServices: string, + postfixModels: string, clientName?: string ): Promise => { const templateResult = templates.index({ @@ -40,7 +42,8 @@ export const writeClientIndex = async ( exportModels, exportSchemas, useUnionTypes, - postfix, + postfixServices, + postfixModels, clientName, server: client.server, version: client.version, diff --git a/test/__snapshots__/index.spec.ts.snap b/test/__snapshots__/index.spec.ts.snap index cb3405f2..e7dd1fda 100644 --- a/test/__snapshots__/index.spec.ts.snap +++ b/test/__snapshots__/index.spec.ts.snap @@ -548,53 +548,53 @@ export { CancelablePromise, CancelError } from './core/CancelablePromise'; export { OpenAPI } from './core/OpenAPI'; export type { OpenAPIConfig } from './core/OpenAPI'; -export type { ArrayWithArray } from './models/ArrayWithArray'; -export type { ArrayWithBooleans } from './models/ArrayWithBooleans'; -export type { ArrayWithNumbers } from './models/ArrayWithNumbers'; -export type { ArrayWithProperties } from './models/ArrayWithProperties'; -export type { ArrayWithReferences } from './models/ArrayWithReferences'; -export type { ArrayWithStrings } from './models/ArrayWithStrings'; -export type { CommentWithBackticks } from './models/CommentWithBackticks'; -export type { CommentWithBreaks } from './models/CommentWithBreaks'; -export type { CommentWithExpressionPlaceholders } from './models/CommentWithExpressionPlaceholders'; -export type { CommentWithQuotes } from './models/CommentWithQuotes'; -export type { CommentWithReservedCharacters } from './models/CommentWithReservedCharacters'; -export type { CommentWithSlashes } from './models/CommentWithSlashes'; -export type { Date } from './models/Date'; -export type { DictionaryWithArray } from './models/DictionaryWithArray'; -export type { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; -export type { DictionaryWithProperties } from './models/DictionaryWithProperties'; -export type { DictionaryWithReference } from './models/DictionaryWithReference'; -export type { DictionaryWithString } from './models/DictionaryWithString'; -export type { EnumFromDescription } from './models/EnumFromDescription'; -export { EnumWithExtensions } from './models/EnumWithExtensions'; -export { EnumWithNumbers } from './models/EnumWithNumbers'; -export { EnumWithStrings } from './models/EnumWithStrings'; -export type { ModelThatExtends } from './models/ModelThatExtends'; -export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; -export type { ModelWithArray } from './models/ModelWithArray'; -export type { ModelWithBoolean } from './models/ModelWithBoolean'; -export type { ModelWithCircularReference } from './models/ModelWithCircularReference'; -export type { ModelWithDictionary } from './models/ModelWithDictionary'; -export type { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; -export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; -export { ModelWithEnum } from './models/ModelWithEnum'; -export type { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; -export type { ModelWithInteger } from './models/ModelWithInteger'; -export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; -export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; -export type { ModelWithNullableString } from './models/ModelWithNullableString'; -export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; -export type { ModelWithPattern } from './models/ModelWithPattern'; -export type { ModelWithProperties } from './models/ModelWithProperties'; -export type { ModelWithReference } from './models/ModelWithReference'; -export type { ModelWithString } from './models/ModelWithString'; -export type { SimpleBoolean } from './models/SimpleBoolean'; -export type { SimpleFile } from './models/SimpleFile'; -export type { SimpleInteger } from './models/SimpleInteger'; -export type { SimpleReference } from './models/SimpleReference'; -export type { SimpleString } from './models/SimpleString'; -export type { SimpleStringWithPattern } from './models/SimpleStringWithPattern'; +export type { ArrayWithArray as ArrayWithArrayDto } from './models/ArrayWithArray'; +export type { ArrayWithBooleans as ArrayWithBooleansDto } from './models/ArrayWithBooleans'; +export type { ArrayWithNumbers as ArrayWithNumbersDto } from './models/ArrayWithNumbers'; +export type { ArrayWithProperties as ArrayWithPropertiesDto } from './models/ArrayWithProperties'; +export type { ArrayWithReferences as ArrayWithReferencesDto } from './models/ArrayWithReferences'; +export type { ArrayWithStrings as ArrayWithStringsDto } from './models/ArrayWithStrings'; +export type { CommentWithBackticks as CommentWithBackticksDto } from './models/CommentWithBackticks'; +export type { CommentWithBreaks as CommentWithBreaksDto } from './models/CommentWithBreaks'; +export type { CommentWithExpressionPlaceholders as CommentWithExpressionPlaceholdersDto } from './models/CommentWithExpressionPlaceholders'; +export type { CommentWithQuotes as CommentWithQuotesDto } from './models/CommentWithQuotes'; +export type { CommentWithReservedCharacters as CommentWithReservedCharactersDto } from './models/CommentWithReservedCharacters'; +export type { CommentWithSlashes as CommentWithSlashesDto } from './models/CommentWithSlashes'; +export type { Date as DateDto } from './models/Date'; +export type { DictionaryWithArray as DictionaryWithArrayDto } from './models/DictionaryWithArray'; +export type { DictionaryWithDictionary as DictionaryWithDictionaryDto } from './models/DictionaryWithDictionary'; +export type { DictionaryWithProperties as DictionaryWithPropertiesDto } from './models/DictionaryWithProperties'; +export type { DictionaryWithReference as DictionaryWithReferenceDto } from './models/DictionaryWithReference'; +export type { DictionaryWithString as DictionaryWithStringDto } from './models/DictionaryWithString'; +export type { EnumFromDescription as EnumFromDescriptionDto } from './models/EnumFromDescription'; +export { EnumWithExtensions as EnumWithExtensionsDto } from './models/EnumWithExtensions'; +export { EnumWithNumbers as EnumWithNumbersDto } from './models/EnumWithNumbers'; +export { EnumWithStrings as EnumWithStringsDto } from './models/EnumWithStrings'; +export type { ModelThatExtends as ModelThatExtendsDto } from './models/ModelThatExtends'; +export type { ModelThatExtendsExtends as ModelThatExtendsExtendsDto } from './models/ModelThatExtendsExtends'; +export type { ModelWithArray as ModelWithArrayDto } from './models/ModelWithArray'; +export type { ModelWithBoolean as ModelWithBooleanDto } from './models/ModelWithBoolean'; +export type { ModelWithCircularReference as ModelWithCircularReferenceDto } from './models/ModelWithCircularReference'; +export type { ModelWithDictionary as ModelWithDictionaryDto } from './models/ModelWithDictionary'; +export type { ModelWithDuplicateImports as ModelWithDuplicateImportsDto } from './models/ModelWithDuplicateImports'; +export type { ModelWithDuplicateProperties as ModelWithDuplicatePropertiesDto } from './models/ModelWithDuplicateProperties'; +export { ModelWithEnum as ModelWithEnumDto } from './models/ModelWithEnum'; +export type { ModelWithEnumFromDescription as ModelWithEnumFromDescriptionDto } from './models/ModelWithEnumFromDescription'; +export type { ModelWithInteger as ModelWithIntegerDto } from './models/ModelWithInteger'; +export type { ModelWithNestedEnums as ModelWithNestedEnumsDto } from './models/ModelWithNestedEnums'; +export type { ModelWithNestedProperties as ModelWithNestedPropertiesDto } from './models/ModelWithNestedProperties'; +export type { ModelWithNullableString as ModelWithNullableStringDto } from './models/ModelWithNullableString'; +export type { ModelWithOrderedProperties as ModelWithOrderedPropertiesDto } from './models/ModelWithOrderedProperties'; +export type { ModelWithPattern as ModelWithPatternDto } from './models/ModelWithPattern'; +export type { ModelWithProperties as ModelWithPropertiesDto } from './models/ModelWithProperties'; +export type { ModelWithReference as ModelWithReferenceDto } from './models/ModelWithReference'; +export type { ModelWithString as ModelWithStringDto } from './models/ModelWithString'; +export type { SimpleBoolean as SimpleBooleanDto } from './models/SimpleBoolean'; +export type { SimpleFile as SimpleFileDto } from './models/SimpleFile'; +export type { SimpleInteger as SimpleIntegerDto } from './models/SimpleInteger'; +export type { SimpleReference as SimpleReferenceDto } from './models/SimpleReference'; +export type { SimpleString as SimpleStringDto } from './models/SimpleString'; +export type { SimpleStringWithPattern as SimpleStringWithPatternDto } from './models/SimpleStringWithPattern'; export { $ArrayWithArray } from './schemas/$ArrayWithArray'; export { $ArrayWithBooleans } from './schemas/$ArrayWithBooleans'; @@ -3607,70 +3607,70 @@ export { CancelablePromise, CancelError } from './core/CancelablePromise'; export { OpenAPI } from './core/OpenAPI'; export type { OpenAPIConfig } from './core/OpenAPI'; -export type { ArrayWithArray } from './models/ArrayWithArray'; -export type { ArrayWithBooleans } from './models/ArrayWithBooleans'; -export type { ArrayWithNumbers } from './models/ArrayWithNumbers'; -export type { ArrayWithProperties } from './models/ArrayWithProperties'; -export type { ArrayWithReferences } from './models/ArrayWithReferences'; -export type { ArrayWithStrings } from './models/ArrayWithStrings'; -export type { CommentWithBackticks } from './models/CommentWithBackticks'; -export type { CommentWithBreaks } from './models/CommentWithBreaks'; -export type { CommentWithExpressionPlaceholders } from './models/CommentWithExpressionPlaceholders'; -export type { CommentWithQuotes } from './models/CommentWithQuotes'; -export type { CommentWithReservedCharacters } from './models/CommentWithReservedCharacters'; -export type { CommentWithSlashes } from './models/CommentWithSlashes'; -export type { CompositionBaseModel } from './models/CompositionBaseModel'; -export type { CompositionExtendedModel } from './models/CompositionExtendedModel'; -export type { CompositionWithAllOfAndNullable } from './models/CompositionWithAllOfAndNullable'; -export type { CompositionWithAnyOf } from './models/CompositionWithAnyOf'; -export type { CompositionWithAnyOfAndNullable } from './models/CompositionWithAnyOfAndNullable'; -export type { CompositionWithAnyOfAnonymous } from './models/CompositionWithAnyOfAnonymous'; -export type { CompositionWithOneOf } from './models/CompositionWithOneOf'; -export type { CompositionWithOneOfAndComplexArrayDictionary } from './models/CompositionWithOneOfAndComplexArrayDictionary'; -export type { CompositionWithOneOfAndNullable } from './models/CompositionWithOneOfAndNullable'; -export type { CompositionWithOneOfAndSimpleArrayDictionary } from './models/CompositionWithOneOfAndSimpleArrayDictionary'; -export type { CompositionWithOneOfAndSimpleDictionary } from './models/CompositionWithOneOfAndSimpleDictionary'; -export type { CompositionWithOneOfAnonymous } from './models/CompositionWithOneOfAnonymous'; -export type { CompositionWithOneOfDiscriminator } from './models/CompositionWithOneOfDiscriminator'; -export type { DeprecatedModel } from './models/DeprecatedModel'; -export type { DictionaryWithArray } from './models/DictionaryWithArray'; -export type { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; -export type { DictionaryWithProperties } from './models/DictionaryWithProperties'; -export type { DictionaryWithReference } from './models/DictionaryWithReference'; -export type { DictionaryWithString } from './models/DictionaryWithString'; -export type { EnumFromDescription } from './models/EnumFromDescription'; -export { EnumWithExtensions } from './models/EnumWithExtensions'; -export { EnumWithNumbers } from './models/EnumWithNumbers'; -export { EnumWithStrings } from './models/EnumWithStrings'; -export type { File } from './models/File'; -export type { ModelCircle } from './models/ModelCircle'; -export type { ModelSquare } from './models/ModelSquare'; -export type { ModelThatExtends } from './models/ModelThatExtends'; -export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; -export type { ModelWithArray } from './models/ModelWithArray'; -export type { ModelWithBoolean } from './models/ModelWithBoolean'; -export type { ModelWithCircularReference } from './models/ModelWithCircularReference'; -export type { ModelWithDictionary } from './models/ModelWithDictionary'; -export type { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; -export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; -export { ModelWithEnum } from './models/ModelWithEnum'; -export type { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; -export type { ModelWithInteger } from './models/ModelWithInteger'; -export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; -export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; -export type { ModelWithNullableString } from './models/ModelWithNullableString'; -export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; -export type { ModelWithPattern } from './models/ModelWithPattern'; -export type { ModelWithProperties } from './models/ModelWithProperties'; -export type { ModelWithReference } from './models/ModelWithReference'; -export type { ModelWithString } from './models/ModelWithString'; -export type { Pageable } from './models/Pageable'; -export type { SimpleBoolean } from './models/SimpleBoolean'; -export type { SimpleFile } from './models/SimpleFile'; -export type { SimpleInteger } from './models/SimpleInteger'; -export type { SimpleReference } from './models/SimpleReference'; -export type { SimpleString } from './models/SimpleString'; -export type { SimpleStringWithPattern } from './models/SimpleStringWithPattern'; +export type { ArrayWithArray as ArrayWithArrayDto } from './models/ArrayWithArray'; +export type { ArrayWithBooleans as ArrayWithBooleansDto } from './models/ArrayWithBooleans'; +export type { ArrayWithNumbers as ArrayWithNumbersDto } from './models/ArrayWithNumbers'; +export type { ArrayWithProperties as ArrayWithPropertiesDto } from './models/ArrayWithProperties'; +export type { ArrayWithReferences as ArrayWithReferencesDto } from './models/ArrayWithReferences'; +export type { ArrayWithStrings as ArrayWithStringsDto } from './models/ArrayWithStrings'; +export type { CommentWithBackticks as CommentWithBackticksDto } from './models/CommentWithBackticks'; +export type { CommentWithBreaks as CommentWithBreaksDto } from './models/CommentWithBreaks'; +export type { CommentWithExpressionPlaceholders as CommentWithExpressionPlaceholdersDto } from './models/CommentWithExpressionPlaceholders'; +export type { CommentWithQuotes as CommentWithQuotesDto } from './models/CommentWithQuotes'; +export type { CommentWithReservedCharacters as CommentWithReservedCharactersDto } from './models/CommentWithReservedCharacters'; +export type { CommentWithSlashes as CommentWithSlashesDto } from './models/CommentWithSlashes'; +export type { CompositionBaseModel as CompositionBaseModelDto } from './models/CompositionBaseModel'; +export type { CompositionExtendedModel as CompositionExtendedModelDto } from './models/CompositionExtendedModel'; +export type { CompositionWithAllOfAndNullable as CompositionWithAllOfAndNullableDto } from './models/CompositionWithAllOfAndNullable'; +export type { CompositionWithAnyOf as CompositionWithAnyOfDto } from './models/CompositionWithAnyOf'; +export type { CompositionWithAnyOfAndNullable as CompositionWithAnyOfAndNullableDto } from './models/CompositionWithAnyOfAndNullable'; +export type { CompositionWithAnyOfAnonymous as CompositionWithAnyOfAnonymousDto } from './models/CompositionWithAnyOfAnonymous'; +export type { CompositionWithOneOf as CompositionWithOneOfDto } from './models/CompositionWithOneOf'; +export type { CompositionWithOneOfAndComplexArrayDictionary as CompositionWithOneOfAndComplexArrayDictionaryDto } from './models/CompositionWithOneOfAndComplexArrayDictionary'; +export type { CompositionWithOneOfAndNullable as CompositionWithOneOfAndNullableDto } from './models/CompositionWithOneOfAndNullable'; +export type { CompositionWithOneOfAndSimpleArrayDictionary as CompositionWithOneOfAndSimpleArrayDictionaryDto } from './models/CompositionWithOneOfAndSimpleArrayDictionary'; +export type { CompositionWithOneOfAndSimpleDictionary as CompositionWithOneOfAndSimpleDictionaryDto } from './models/CompositionWithOneOfAndSimpleDictionary'; +export type { CompositionWithOneOfAnonymous as CompositionWithOneOfAnonymousDto } from './models/CompositionWithOneOfAnonymous'; +export type { CompositionWithOneOfDiscriminator as CompositionWithOneOfDiscriminatorDto } from './models/CompositionWithOneOfDiscriminator'; +export type { DeprecatedModel as DeprecatedModelDto } from './models/DeprecatedModel'; +export type { DictionaryWithArray as DictionaryWithArrayDto } from './models/DictionaryWithArray'; +export type { DictionaryWithDictionary as DictionaryWithDictionaryDto } from './models/DictionaryWithDictionary'; +export type { DictionaryWithProperties as DictionaryWithPropertiesDto } from './models/DictionaryWithProperties'; +export type { DictionaryWithReference as DictionaryWithReferenceDto } from './models/DictionaryWithReference'; +export type { DictionaryWithString as DictionaryWithStringDto } from './models/DictionaryWithString'; +export type { EnumFromDescription as EnumFromDescriptionDto } from './models/EnumFromDescription'; +export { EnumWithExtensions as EnumWithExtensionsDto } from './models/EnumWithExtensions'; +export { EnumWithNumbers as EnumWithNumbersDto } from './models/EnumWithNumbers'; +export { EnumWithStrings as EnumWithStringsDto } from './models/EnumWithStrings'; +export type { File as FileDto } from './models/File'; +export type { ModelCircle as ModelCircleDto } from './models/ModelCircle'; +export type { ModelSquare as ModelSquareDto } from './models/ModelSquare'; +export type { ModelThatExtends as ModelThatExtendsDto } from './models/ModelThatExtends'; +export type { ModelThatExtendsExtends as ModelThatExtendsExtendsDto } from './models/ModelThatExtendsExtends'; +export type { ModelWithArray as ModelWithArrayDto } from './models/ModelWithArray'; +export type { ModelWithBoolean as ModelWithBooleanDto } from './models/ModelWithBoolean'; +export type { ModelWithCircularReference as ModelWithCircularReferenceDto } from './models/ModelWithCircularReference'; +export type { ModelWithDictionary as ModelWithDictionaryDto } from './models/ModelWithDictionary'; +export type { ModelWithDuplicateImports as ModelWithDuplicateImportsDto } from './models/ModelWithDuplicateImports'; +export type { ModelWithDuplicateProperties as ModelWithDuplicatePropertiesDto } from './models/ModelWithDuplicateProperties'; +export { ModelWithEnum as ModelWithEnumDto } from './models/ModelWithEnum'; +export type { ModelWithEnumFromDescription as ModelWithEnumFromDescriptionDto } from './models/ModelWithEnumFromDescription'; +export type { ModelWithInteger as ModelWithIntegerDto } from './models/ModelWithInteger'; +export type { ModelWithNestedEnums as ModelWithNestedEnumsDto } from './models/ModelWithNestedEnums'; +export type { ModelWithNestedProperties as ModelWithNestedPropertiesDto } from './models/ModelWithNestedProperties'; +export type { ModelWithNullableString as ModelWithNullableStringDto } from './models/ModelWithNullableString'; +export type { ModelWithOrderedProperties as ModelWithOrderedPropertiesDto } from './models/ModelWithOrderedProperties'; +export type { ModelWithPattern as ModelWithPatternDto } from './models/ModelWithPattern'; +export type { ModelWithProperties as ModelWithPropertiesDto } from './models/ModelWithProperties'; +export type { ModelWithReference as ModelWithReferenceDto } from './models/ModelWithReference'; +export type { ModelWithString as ModelWithStringDto } from './models/ModelWithString'; +export type { Pageable as PageableDto } from './models/Pageable'; +export type { SimpleBoolean as SimpleBooleanDto } from './models/SimpleBoolean'; +export type { SimpleFile as SimpleFileDto } from './models/SimpleFile'; +export type { SimpleInteger as SimpleIntegerDto } from './models/SimpleInteger'; +export type { SimpleReference as SimpleReferenceDto } from './models/SimpleReference'; +export type { SimpleString as SimpleStringDto } from './models/SimpleString'; +export type { SimpleStringWithPattern as SimpleStringWithPatternDto } from './models/SimpleStringWithPattern'; export { $ArrayWithArray } from './schemas/$ArrayWithArray'; export { $ArrayWithBooleans } from './schemas/$ArrayWithBooleans'; diff --git a/test/index.spec.ts b/test/index.spec.ts index 78a0197d..b8e87da7 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -15,6 +15,7 @@ describe('v2', () => { exportSchemas: true, exportModels: true, exportServices: true, + postfixModels: 'Dto', }); sync('./test/generated/v2/**/*.ts').forEach(file => { @@ -36,6 +37,7 @@ describe('v3', () => { exportSchemas: true, exportModels: true, exportServices: true, + postfixModels: 'Dto', }); sync('./test/generated/v3/**/*.ts').forEach(file => { diff --git a/types/index.d.ts b/types/index.d.ts index 7bbad057..c56ef740 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -24,7 +24,12 @@ export type Options = { exportModels?: boolean; exportSchemas?: boolean; indent?: Indent | '4' | '2' | 'tab'; + /** + * @deprecated use postfixServices instead + */ postfix?: string; + postfixServices?: string; + postfixModels?: string; request?: string; write?: boolean; };