From 3cc372e3b1afcce22471521e92ca8014a043999b Mon Sep 17 00:00:00 2001 From: Jordan Shatford Date: Wed, 27 Mar 2024 08:45:02 +1100 Subject: [PATCH] feat(client): add useLegacyEnums option to generate typescript enums --- .changeset/nice-pots-begin.md | 5 + README.md | 1 + bin/index.js | 1 + src/index.ts | 2 + src/openApi/__tests__/index.spec.ts | 1 + .../v2/parser/__tests__/getServices.spec.ts | 1 + .../v3/parser/__tests__/getServices.spec.ts | 1 + src/templates/partials/exportEnum.hbs | 17 + src/types/config.ts | 5 + src/utils/__tests__/handlebars.spec.ts | 2 + src/utils/write/__tests__/class.spec.ts | 1 + src/utils/write/__tests__/client.spec.ts | 1 + src/utils/write/__tests__/core.spec.ts | 3 + src/utils/write/__tests__/index.spec.ts | 1 + src/utils/write/__tests__/models.spec.ts | 1 + src/utils/write/__tests__/schemas.spec.ts | 1 + src/utils/write/__tests__/services.spec.ts | 1 + .../v3_legacy_enums/core/ApiError.ts.snap | 21 ++ .../core/ApiRequestOptions.ts.snap | 13 + .../v3_legacy_enums/core/ApiResult.ts.snap | 7 + .../core/CancelablePromise.ts.snap | 126 +++++++ .../v3_legacy_enums/core/OpenAPI.ts.snap | 45 +++ .../v3_legacy_enums/core/request.ts.snap | 314 ++++++++++++++++++ .../v3_legacy_enums/core/types.ts.snap | 10 + .../generated/v3_legacy_enums/index.ts.snap | 8 + .../models/AnyOfAnyAndNull.ts.snap | 3 + .../models/AnyOfArrays.ts.snap | 13 + .../models/ArrayWithAnyOfProperties.ts.snap | 11 + .../models/ArrayWithArray.ts.snap | 6 + .../models/ArrayWithBooleans.ts.snap | 4 + .../models/ArrayWithNumbers.ts.snap | 4 + .../models/ArrayWithProperties.ts.snap | 7 + .../models/ArrayWithReferences.ts.snap | 6 + .../models/ArrayWithStrings.ts.snap | 4 + .../models/CommentWithBackticks.ts.snap | 4 + .../models/CommentWithBreaks.ts.snap | 7 + .../CommentWithExpressionPlaceholders.ts.snap | 4 + .../models/CommentWithQuotes.ts.snap | 4 + .../CommentWithReservedCharacters.ts.snap | 4 + .../models/CommentWithSlashes.ts.snap | 4 + .../models/CompositionBaseModel.ts.snap | 7 + .../models/CompositionExtendedModel.ts.snap | 10 + .../CompositionWithAllOfAndNullable.ts.snap | 16 + .../models/CompositionWithAnyOf.ts.snap | 11 + .../CompositionWithAnyOfAndNullable.ts.snap | 17 + .../CompositionWithAnyOfAnonymous.ts.snap | 11 + ...ompositionWithNestedAnyAndTypeNull.ts.snap | 9 + .../CompositionWithNestedAnyOfAndNull.ts.snap | 9 + .../models/CompositionWithOneOf.ts.snap | 11 + ...WithOneOfAndComplexArrayDictionary.ts.snap | 6 + .../CompositionWithOneOfAndNullable.ts.snap | 17 + .../CompositionWithOneOfAndProperties.ts.snap | 14 + ...nWithOneOfAndSimpleArrayDictionary.ts.snap | 6 + ...sitionWithOneOfAndSimpleDictionary.ts.snap | 6 + .../CompositionWithOneOfAnonymous.ts.snap | 11 + .../CompositionWithOneOfDiscriminator.ts.snap | 7 + .../v3_legacy_enums/models/ConstValue.ts.snap | 1 + .../models/DeprecatedModel.ts.snap | 11 + .../models/DictionaryWithArray.ts.snap | 6 + .../models/DictionaryWithDictionary.ts.snap | 4 + .../models/DictionaryWithProperties.ts.snap | 10 + .../models/DictionaryWithReference.ts.snap | 6 + .../models/DictionaryWithString.ts.snap | 4 + .../v3_legacy_enums/models/Enum1.ts.snap | 4 + .../models/EnumFromDescription.ts.snap | 4 + .../models/EnumWithExtensions.ts.snap | 17 + .../models/EnumWithNumbers.ts.snap | 20 ++ .../models/EnumWithReplacedCharacters.ts.snap | 7 + .../models/EnumWithStrings.ts.snap | 11 + .../v3_legacy_enums/models/File.ts.snap | 7 + ...hAdditionalPropertiesEqEmptyObject.ts.snap | 4 + ...jectWithAdditionalPropertiesEqTrue.ts.snap | 4 + ...mObjectWithoutAdditionalProperties.ts.snap | 4 + .../models/ModelCircle.ts.snap | 7 + .../models/ModelSquare.ts.snap | 7 + .../models/ModelThatExtends.ts.snap | 9 + .../models/ModelThatExtendsExtends.ts.snap | 11 + ...odelWithAdditionalPropertiesEqTrue.ts.snap | 10 + .../models/ModelWithArray.ts.snap | 10 + ...ModelWithArrayReadOnlyAndWriteOnly.ts.snap | 10 + .../models/ModelWithBoolean.ts.snap | 9 + .../models/ModelWithCircularReference.ts.snap | 6 + .../models/ModelWithConst.ts.snap | 6 + .../models/ModelWithDictionary.ts.snap | 6 + .../models/ModelWithDuplicateImports.ts.snap | 10 + .../ModelWithDuplicateProperties.ts.snap | 8 + .../models/ModelWithEnum.ts.snap | 17 + .../ModelWithEnumFromDescription.ts.snap | 9 + .../models/ModelWithEnumWithHyphen.ts.snap | 6 + .../models/ModelWithInteger.ts.snap | 9 + .../models/ModelWithNestedArrayEnums.ts.snap | 6 + .../ModelWithNestedArrayEnumsData.ts.snap | 7 + .../ModelWithNestedArrayEnumsDataBar.ts.snap | 4 + .../ModelWithNestedArrayEnumsDataFoo.ts.snap | 4 + .../ModelWithNestedCompositionEnums.ts.snap | 5 + .../models/ModelWithNestedEnums.ts.snap | 9 + .../models/ModelWithNestedProperties.ts.snap | 10 + .../models/ModelWithNullableObject.ts.snap | 5 + .../models/ModelWithNullableString.ts.snap | 21 ++ .../models/ModelWithOneOfEnum.ts.snap | 18 + .../models/ModelWithOrderedProperties.ts.snap | 8 + .../models/ModelWithPattern.ts.snap | 14 + .../models/ModelWithProperties.ts.snap | 19 ++ .../ModelWithReadOnlyAndWriteOnly.ts.snap | 5 + .../models/ModelWithReference.ts.snap | 8 + .../models/ModelWithString.ts.snap | 9 + .../models/NestedAnyOfArraysNullable.ts.snap | 3 + ...5\255\227\347\254\246\344\270\262.ts.snap" | 4 + .../models/NullableObject.ts.snap | 6 + .../v3_legacy_enums/models/Pageable.ts.snap | 5 + .../models/SimpleBoolean.ts.snap | 4 + .../v3_legacy_enums/models/SimpleFile.ts.snap | 4 + .../models/SimpleInteger.ts.snap | 4 + .../models/SimpleParameter.ts.snap | 4 + .../models/SimpleReference.ts.snap | 6 + .../models/SimpleString.ts.snap | 4 + .../models/SimpleStringWithPattern.ts.snap | 4 + .../v3_legacy_enums/models/_default.ts.snap | 3 + .../v3_legacy_enums/models/index.ts.snap | 93 ++++++ .../schemas/$AnyOfAnyAndNull.ts.snap | 15 + .../schemas/$AnyOfArrays.ts.snap | 27 ++ .../schemas/$ArrayWithAnyOfProperties.ts.snap | 22 ++ .../schemas/$ArrayWithArray.ts.snap | 9 + .../schemas/$ArrayWithBooleans.ts.snap | 6 + .../schemas/$ArrayWithNumbers.ts.snap | 6 + .../schemas/$ArrayWithProperties.ts.snap | 13 + .../schemas/$ArrayWithReferences.ts.snap | 6 + .../schemas/$ArrayWithStrings.ts.snap | 6 + .../schemas/$CommentWithBackticks.ts.snap | 4 + .../schemas/$CommentWithBreaks.ts.snap | 7 + ...$CommentWithExpressionPlaceholders.ts.snap | 4 + .../schemas/$CommentWithQuotes.ts.snap | 4 + .../$CommentWithReservedCharacters.ts.snap | 4 + .../schemas/$CommentWithSlashes.ts.snap | 4 + .../schemas/$CompositionBaseModel.ts.snap | 11 + .../schemas/$CompositionExtendedModel.ts.snap | 25 ++ .../$CompositionWithAllOfAndNullable.ts.snap | 27 ++ .../schemas/$CompositionWithAnyOf.ts.snap | 22 ++ .../$CompositionWithAnyOfAndNullable.ts.snap | 27 ++ .../$CompositionWithAnyOfAnonymous.ts.snap | 26 ++ ...ompositionWithNestedAnyAndTypeNull.ts.snap | 38 +++ ...$CompositionWithNestedAnyOfAndNull.ts.snap | 27 ++ .../schemas/$CompositionWithOneOf.ts.snap | 22 ++ ...WithOneOfAndComplexArrayDictionary.ts.snap | 30 ++ .../$CompositionWithOneOfAndNullable.ts.snap | 27 ++ ...$CompositionWithOneOfAndProperties.ts.snap | 43 +++ ...nWithOneOfAndSimpleArrayDictionary.ts.snap | 22 ++ ...sitionWithOneOfAndSimpleDictionary.ts.snap | 19 ++ .../$CompositionWithOneOfAnonymous.ts.snap | 26 ++ ...$CompositionWithOneOfDiscriminator.ts.snap | 12 + .../schemas/$ConstValue.ts.snap | 3 + .../schemas/$DeprecatedModel.ts.snap | 9 + .../schemas/$DictionaryWithArray.ts.snap | 9 + .../schemas/$DictionaryWithDictionary.ts.snap | 9 + .../schemas/$DictionaryWithProperties.ts.snap | 13 + .../schemas/$DictionaryWithReference.ts.snap | 6 + .../schemas/$DictionaryWithString.ts.snap | 6 + .../v3_legacy_enums/schemas/$Enum1.ts.snap | 3 + .../schemas/$EnumFromDescription.ts.snap | 4 + .../schemas/$EnumWithExtensions.ts.snap | 3 + .../schemas/$EnumWithNumbers.ts.snap | 3 + .../$EnumWithReplacedCharacters.ts.snap | 3 + .../schemas/$EnumWithStrings.ts.snap | 3 + .../v3_legacy_enums/schemas/$File.ts.snap | 30 ++ ...hAdditionalPropertiesEqEmptyObject.ts.snap | 6 + ...jectWithAdditionalPropertiesEqTrue.ts.snap | 6 + ...mObjectWithoutAdditionalProperties.ts.snap | 6 + .../schemas/$ModelCircle.ts.snap | 12 + .../schemas/$ModelSquare.ts.snap | 12 + .../schemas/$ModelThatExtends.ts.snap | 19 ++ .../schemas/$ModelThatExtendsExtends.ts.snap | 22 ++ ...odelWithAdditionalPropertiesEqTrue.ts.snap | 9 + .../schemas/$ModelWithArray.ts.snap | 23 ++ ...ModelWithArrayReadOnlyAndWriteOnly.ts.snap | 23 ++ .../schemas/$ModelWithBoolean.ts.snap | 9 + .../$ModelWithCircularReference.ts.snap | 8 + .../schemas/$ModelWithConst.ts.snap | 16 + .../schemas/$ModelWithDictionary.ts.snap | 11 + .../$ModelWithDuplicateImports.ts.snap | 14 + .../$ModelWithDuplicateProperties.ts.snap | 8 + .../schemas/$ModelWithEnum.ts.snap | 15 + .../$ModelWithEnumFromDescription.ts.snap | 9 + .../schemas/$ModelWithEnumWithHyphen.ts.snap | 8 + .../schemas/$ModelWithInteger.ts.snap | 9 + .../$ModelWithNestedArrayEnums.ts.snap | 18 + .../$ModelWithNestedArrayEnumsData.ts.snap | 16 + .../$ModelWithNestedArrayEnumsDataBar.ts.snap | 3 + .../$ModelWithNestedArrayEnumsDataFoo.ts.snap | 3 + .../$ModelWithNestedCompositionEnums.ts.snap | 12 + .../schemas/$ModelWithNestedEnums.ts.snap | 31 ++ .../$ModelWithNestedProperties.ts.snap | 25 ++ .../schemas/$ModelWithNullableObject.ts.snap | 7 + .../schemas/$ModelWithNullableString.ts.snap | 27 ++ .../schemas/$ModelWithOneOfEnum.ts.snap | 66 ++++ .../$ModelWithOrderedProperties.ts.snap | 14 + .../schemas/$ModelWithPattern.ts.snap | 45 +++ .../schemas/$ModelWithProperties.ts.snap | 48 +++ .../$ModelWithReadOnlyAndWriteOnly.ts.snap | 17 + .../schemas/$ModelWithReference.ts.snap | 8 + .../schemas/$ModelWithString.ts.snap | 9 + .../$NestedAnyOfArraysNullable.ts.snap | 26 ++ ...5\255\227\347\254\246\344\270\262.ts.snap" | 4 + .../schemas/$NullableObject.ts.snap | 9 + .../v3_legacy_enums/schemas/$Pageable.ts.snap | 19 ++ .../schemas/$SimpleBoolean.ts.snap | 4 + .../schemas/$SimpleFile.ts.snap | 4 + .../schemas/$SimpleInteger.ts.snap | 4 + .../schemas/$SimpleParameter.ts.snap | 4 + .../schemas/$SimpleReference.ts.snap | 4 + .../schemas/$SimpleString.ts.snap | 4 + .../schemas/$SimpleStringWithPattern.ts.snap | 7 + .../v3_legacy_enums/schemas/$_default.ts.snap | 7 + .../v3_legacy_enums/schemas/index.ts.snap | 93 ++++++ .../services/CollectionFormatService.ts.snap | 47 +++ .../services/ComplexService.ts.snap | 79 +++++ .../services/DefaultService.ts.snap | 37 +++ .../services/DefaultsService.ts.snap | 169 ++++++++++ .../services/DeprecatedService.ts.snap | 28 ++ .../services/DescriptionsService.ts.snap | 61 ++++ .../services/DuplicateService.ts.snap | 45 +++ .../services/ErrorService.ts.snap | 33 ++ .../services/FileResponseService.ts.snap | 24 ++ .../services/FormDataService.ts.snap | 33 ++ .../services/HeaderService.ts.snap | 21 ++ .../services/MultipartService.ts.snap | 43 +++ .../services/MultipleTags1Service.ts.snap | 27 ++ .../services/MultipleTags2Service.ts.snap | 27 ++ .../services/MultipleTags3Service.ts.snap | 16 + .../services/NoContentService.ts.snap | 28 ++ ...66\303\264\303\252\303\212Service.ts.snap" | 30 ++ .../services/ParametersService.ts.snap | 233 +++++++++++++ .../services/RequestBodyService.ts.snap | 33 ++ .../services/ResponseService.ts.snap | 75 +++++ .../services/SimpleService.ts.snap | 75 +++++ .../services/TypesService.ts.snap | 76 +++++ .../services/UploadService.ts.snap | 27 ++ .../v3_legacy_enums/services/index.ts.snap | 23 ++ test/index.spec.ts | 20 ++ 238 files changed, 4150 insertions(+) create mode 100644 .changeset/nice-pots-begin.md create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiError.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiRequestOptions.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiResult.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/CancelablePromise.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/OpenAPI.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/request.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/types.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/index.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/AnyOfAnyAndNull.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/AnyOfArrays.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithAnyOfProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithArray.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithBooleans.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithNumbers.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithReferences.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithStrings.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithBackticks.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithBreaks.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithExpressionPlaceholders.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithQuotes.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithReservedCharacters.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithSlashes.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionBaseModel.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionExtendedModel.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAllOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOf.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOfAnonymous.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithNestedAnyAndTypeNull.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithNestedAnyOfAndNull.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOf.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndComplexArrayDictionary.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndSimpleArrayDictionary.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndSimpleDictionary.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAnonymous.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfDiscriminator.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ConstValue.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DeprecatedModel.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithArray.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithDictionary.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithReference.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithString.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/Enum1.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithExtensions.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithNumbers.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithReplacedCharacters.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithStrings.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/File.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithoutAdditionalProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelCircle.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelSquare.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelThatExtends.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelThatExtendsExtends.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithAdditionalPropertiesEqTrue.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithArray.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithArrayReadOnlyAndWriteOnly.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithBoolean.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithCircularReference.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithConst.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDictionary.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDuplicateImports.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDuplicateProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnum.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnumWithHyphen.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithInteger.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnums.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsData.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsDataBar.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsDataFoo.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedCompositionEnums.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedEnums.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNullableObject.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNullableString.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithOneOfEnum.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithOrderedProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithPattern.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithReadOnlyAndWriteOnly.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithReference.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithString.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NestedAnyOfArraysNullable.ts.snap create mode 100644 "test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NonAsciiString\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212\345\255\227\347\254\246\344\270\262.ts.snap" create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NullableObject.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/Pageable.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleBoolean.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleFile.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleInteger.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleParameter.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleReference.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleString.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleStringWithPattern.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/_default.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/index.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$AnyOfAnyAndNull.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$AnyOfArrays.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithAnyOfProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithArray.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithBooleans.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithNumbers.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithReferences.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithStrings.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithBackticks.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithBreaks.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithExpressionPlaceholders.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithQuotes.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithReservedCharacters.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithSlashes.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionBaseModel.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionExtendedModel.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAllOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOf.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOfAnonymous.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithNestedAnyAndTypeNull.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithNestedAnyOfAndNull.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOf.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndSimpleDictionary.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAnonymous.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfDiscriminator.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ConstValue.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DeprecatedModel.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithArray.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithDictionary.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithReference.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithString.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$Enum1.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithExtensions.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithNumbers.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithReplacedCharacters.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithStrings.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$File.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelCircle.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelSquare.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelThatExtends.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelThatExtendsExtends.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithAdditionalPropertiesEqTrue.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithArray.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithBoolean.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithCircularReference.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithConst.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDictionary.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDuplicateImports.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDuplicateProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnum.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnumWithHyphen.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithInteger.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnums.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsData.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsDataBar.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedCompositionEnums.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedEnums.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNullableObject.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNullableString.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithOneOfEnum.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithOrderedProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithPattern.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithProperties.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithReadOnlyAndWriteOnly.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithReference.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithString.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NestedAnyOfArraysNullable.ts.snap create mode 100644 "test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NonAsciiString\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212\345\255\227\347\254\246\344\270\262.ts.snap" create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NullableObject.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$Pageable.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleBoolean.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleFile.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleInteger.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleParameter.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleReference.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleString.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleStringWithPattern.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$_default.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/index.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/CollectionFormatService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ComplexService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DefaultService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DefaultsService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DeprecatedService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DescriptionsService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DuplicateService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ErrorService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/FileResponseService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/FormDataService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/HeaderService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipartService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags1Service.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags2Service.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags3Service.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/NoContentService.ts.snap create mode 100644 "test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ParametersService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/RequestBodyService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ResponseService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/SimpleService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/TypesService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/UploadService.ts.snap create mode 100644 test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/index.ts.snap diff --git a/.changeset/nice-pots-begin.md b/.changeset/nice-pots-begin.md new file mode 100644 index 000000000..3c536f79b --- /dev/null +++ b/.changeset/nice-pots-begin.md @@ -0,0 +1,5 @@ +--- +"@hey-api/openapi-ts": minor +--- + +Add useLegacyEnums options to generate TypeScript enums diff --git a/README.md b/README.md index bbb84cb80..ec872e6e5 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,7 @@ $ openapi-ts --help --postfixModels Model name postfix --request Path to custom request file --useDateType Output Date instead of string for the format "date-time" in the models (default: false) + --useLegacyEnums Generate Typescript enum definitions (default: false) -h, --help display help for command ``` diff --git a/bin/index.js b/bin/index.js index ef50fb372..1bd28c744 100755 --- a/bin/index.js +++ b/bin/index.js @@ -36,6 +36,7 @@ const params = program .option('--request ', 'Path to custom request file') .option('--write', 'Write files to disk? (used for testing)') .option('--no-write', 'Skip writing files to disk (used for testing)') + .option('--useLegacyEnums', 'Generate Typescript enum definitions') .parse(process.argv) .opts(); diff --git a/src/index.ts b/src/index.ts index 1c518410e..6108323ee 100644 --- a/src/index.ts +++ b/src/index.ts @@ -114,6 +114,7 @@ const getConfig = async (userConfig: UserConfig, dependencies: Dependencies) => serviceResponse = 'body', useDateType = false, useOptions = true, + useLegacyEnums = false, write = true, } = userConfig; @@ -158,6 +159,7 @@ const getConfig = async (userConfig: UserConfig, dependencies: Dependencies) => serviceResponse, useDateType, useOptions, + useLegacyEnums, write, }; diff --git a/src/openApi/__tests__/index.spec.ts b/src/openApi/__tests__/index.spec.ts index d324d7210..42b602afa 100644 --- a/src/openApi/__tests__/index.spec.ts +++ b/src/openApi/__tests__/index.spec.ts @@ -26,6 +26,7 @@ describe('parse', () => { serviceResponse: 'body', useDateType: false, useOptions: true, + useLegacyEnums: false, write: false, }; diff --git a/src/openApi/v2/parser/__tests__/getServices.spec.ts b/src/openApi/v2/parser/__tests__/getServices.spec.ts index 842d4b865..979b507b4 100644 --- a/src/openApi/v2/parser/__tests__/getServices.spec.ts +++ b/src/openApi/v2/parser/__tests__/getServices.spec.ts @@ -21,6 +21,7 @@ describe('getServices', () => { serviceResponse: 'body', useDateType: false, useOptions: true, + useLegacyEnums: false, write: false, }; const services = getServices( diff --git a/src/openApi/v3/parser/__tests__/getServices.spec.ts b/src/openApi/v3/parser/__tests__/getServices.spec.ts index 32d02dd7f..ee28f10ab 100644 --- a/src/openApi/v3/parser/__tests__/getServices.spec.ts +++ b/src/openApi/v3/parser/__tests__/getServices.spec.ts @@ -21,6 +21,7 @@ describe('getServices', () => { serviceResponse: 'body', useDateType: false, useOptions: true, + useLegacyEnums: false, write: false, }; const services = getServices( diff --git a/src/templates/partials/exportEnum.hbs b/src/templates/partials/exportEnum.hbs index 216ecb37d..8c1863a69 100644 --- a/src/templates/partials/exportEnum.hbs +++ b/src/templates/partials/exportEnum.hbs @@ -9,8 +9,25 @@ {{/if}} */ {{/ifdef}} +{{#if @root.$config.useLegacyEnums}} +export enum {{{name}}} { + {{#each enum}} + {{#if x-enum-description}} + /** + * {{{escapeComment x-enum-description}}} + */ + {{else if description}} + /** + * {{{escapeComment description}}} + */ + {{/if}} + {{{enumKey value x-enum-varname}}} = {{{enumValue value}}}, + {{/each}} +} +{{else}} export type {{{name}}} = {{{enumUnionType enum}}}; {{/if}} +{{/if}} {{#if @root.$config.enums}} export const {{{enumName name }}} = { diff --git a/src/types/config.ts b/src/types/config.ts index 0c8611af9..71aa4980a 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -89,6 +89,11 @@ export interface UserConfig { * @default true */ useOptions?: boolean; + /** + * Generate Typescript enum definitions + * @default false + */ + useLegacyEnums?: boolean; /** * Write the files to disk (true or false) * @default true diff --git a/src/utils/__tests__/handlebars.spec.ts b/src/utils/__tests__/handlebars.spec.ts index d935781db..b8b6e42be 100644 --- a/src/utils/__tests__/handlebars.spec.ts +++ b/src/utils/__tests__/handlebars.spec.ts @@ -23,6 +23,7 @@ describe('registerHandlebarHelpers', () => { serviceResponse: 'body', useDateType: false, useOptions: false, + useLegacyEnums: false, write: true, }, { @@ -76,6 +77,7 @@ describe('registerHandlebarTemplates', () => { serviceResponse: 'body', useDateType: false, useOptions: false, + useLegacyEnums: false, write: true, }, { diff --git a/src/utils/write/__tests__/class.spec.ts b/src/utils/write/__tests__/class.spec.ts index 2c05835f5..39d289b23 100644 --- a/src/utils/write/__tests__/class.spec.ts +++ b/src/utils/write/__tests__/class.spec.ts @@ -34,6 +34,7 @@ describe('writeClientClass', () => { serviceResponse: 'body', useDateType: false, useOptions: true, + useLegacyEnums: false, write: true, }); diff --git a/src/utils/write/__tests__/client.spec.ts b/src/utils/write/__tests__/client.spec.ts index 7ae2664b2..8324ae6ef 100644 --- a/src/utils/write/__tests__/client.spec.ts +++ b/src/utils/write/__tests__/client.spec.ts @@ -33,6 +33,7 @@ describe('writeClient', () => { serviceResponse: 'body', useDateType: false, useOptions: false, + useLegacyEnums: false, write: true, }); diff --git a/src/utils/write/__tests__/core.spec.ts b/src/utils/write/__tests__/core.spec.ts index 3758ccd9c..3fe6de650 100644 --- a/src/utils/write/__tests__/core.spec.ts +++ b/src/utils/write/__tests__/core.spec.ts @@ -40,6 +40,7 @@ describe('writeClientCore', () => { serviceResponse: 'body', useDateType: false, useOptions: true, + useLegacyEnums: false, write: true, }; @@ -80,6 +81,7 @@ describe('writeClientCore', () => { serviceResponse: 'body', useDateType: false, useOptions: true, + useLegacyEnums: false, write: true, }; @@ -120,6 +122,7 @@ describe('writeClientCore', () => { serviceResponse: 'body', useDateType: false, useOptions: true, + useLegacyEnums: false, write: true, }; diff --git a/src/utils/write/__tests__/index.spec.ts b/src/utils/write/__tests__/index.spec.ts index 68d24d4d4..12f01d423 100644 --- a/src/utils/write/__tests__/index.spec.ts +++ b/src/utils/write/__tests__/index.spec.ts @@ -34,6 +34,7 @@ describe('writeClientIndex', () => { serviceResponse: 'body', useDateType: false, useOptions: true, + useLegacyEnums: false, write: true, }); diff --git a/src/utils/write/__tests__/models.spec.ts b/src/utils/write/__tests__/models.spec.ts index 79e01c5ff..15af6ec28 100644 --- a/src/utils/write/__tests__/models.spec.ts +++ b/src/utils/write/__tests__/models.spec.ts @@ -54,6 +54,7 @@ describe('writeClientModels', () => { serviceResponse: 'body', useDateType: false, useOptions: true, + useLegacyEnums: false, write: true, }); diff --git a/src/utils/write/__tests__/schemas.spec.ts b/src/utils/write/__tests__/schemas.spec.ts index f4deb9d0e..4d98844f0 100644 --- a/src/utils/write/__tests__/schemas.spec.ts +++ b/src/utils/write/__tests__/schemas.spec.ts @@ -54,6 +54,7 @@ describe('writeClientSchemas', () => { serviceResponse: 'body', useDateType: false, useOptions: true, + useLegacyEnums: false, write: true, }); diff --git a/src/utils/write/__tests__/services.spec.ts b/src/utils/write/__tests__/services.spec.ts index cc3aae1a0..b5d70981d 100644 --- a/src/utils/write/__tests__/services.spec.ts +++ b/src/utils/write/__tests__/services.spec.ts @@ -41,6 +41,7 @@ describe('writeClientServices', () => { serviceResponse: 'body', useDateType: false, useOptions: false, + useLegacyEnums: false, write: true, }); diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiError.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiError.ts.snap new file mode 100644 index 000000000..2c11b4136 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiError.ts.snap @@ -0,0 +1,21 @@ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; + +export class ApiError extends Error { + public readonly url: string; + public readonly status: number; + public readonly statusText: string; + public readonly body: unknown; + public readonly request: ApiRequestOptions; + + constructor(request: ApiRequestOptions, response: ApiResult, message: string) { + super(message); + + this.name = 'ApiError'; + this.url = response.url; + this.status = response.status; + this.statusText = response.statusText; + this.body = response.body; + this.request = request; + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiRequestOptions.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiRequestOptions.ts.snap new file mode 100644 index 000000000..e93003ee7 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiRequestOptions.ts.snap @@ -0,0 +1,13 @@ +export type ApiRequestOptions = { + readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; + readonly url: string; + readonly path?: Record; + readonly cookies?: Record; + readonly headers?: Record; + readonly query?: Record; + readonly formData?: Record; + readonly body?: any; + readonly mediaType?: string; + readonly responseHeader?: string; + readonly errors?: Record; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiResult.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiResult.ts.snap new file mode 100644 index 000000000..caa79c2ea --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/ApiResult.ts.snap @@ -0,0 +1,7 @@ +export type ApiResult = { + readonly body: TData; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly url: string; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/CancelablePromise.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/CancelablePromise.ts.snap new file mode 100644 index 000000000..0e480dd1d --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/CancelablePromise.ts.snap @@ -0,0 +1,126 @@ +export class CancelError extends Error { + constructor(message: string) { + super(message); + this.name = 'CancelError'; + } + + public get isCancelled(): boolean { + return true; + } +} + +export interface OnCancel { + readonly isResolved: boolean; + readonly isRejected: boolean; + readonly isCancelled: boolean; + + (cancelHandler: () => void): void; +} + +export class CancelablePromise implements Promise { + #isResolved: boolean; + #isRejected: boolean; + #isCancelled: boolean; + readonly #cancelHandlers: (() => void)[]; + readonly #promise: Promise; + #resolve?: (value: T | PromiseLike) => void; + #reject?: (reason?: unknown) => void; + + constructor( + executor: ( + resolve: (value: T | PromiseLike) => void, + reject: (reason?: unknown) => void, + onCancel: OnCancel + ) => void + ) { + this.#isResolved = false; + this.#isRejected = false; + this.#isCancelled = false; + this.#cancelHandlers = []; + this.#promise = new Promise((resolve, reject) => { + this.#resolve = resolve; + this.#reject = reject; + + const onResolve = (value: T | PromiseLike): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isResolved = true; + if (this.#resolve) this.#resolve(value); + }; + + const onReject = (reason?: unknown): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isRejected = true; + if (this.#reject) this.#reject(reason); + }; + + const onCancel = (cancelHandler: () => void): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#cancelHandlers.push(cancelHandler); + }; + + Object.defineProperty(onCancel, 'isResolved', { + get: (): boolean => this.#isResolved, + }); + + Object.defineProperty(onCancel, 'isRejected', { + get: (): boolean => this.#isRejected, + }); + + Object.defineProperty(onCancel, 'isCancelled', { + get: (): boolean => this.#isCancelled, + }); + + return executor(onResolve, onReject, onCancel as OnCancel); + }); + } + + get [Symbol.toStringTag]() { + return 'Cancellable Promise'; + } + + public then( + onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onRejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): Promise { + return this.#promise.then(onFulfilled, onRejected); + } + + public catch( + onRejected?: ((reason: unknown) => TResult | PromiseLike) | null + ): Promise { + return this.#promise.catch(onRejected); + } + + public finally(onFinally?: (() => void) | null): Promise { + return this.#promise.finally(onFinally); + } + + public cancel(): void { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isCancelled = true; + if (this.#cancelHandlers.length) { + try { + for (const cancelHandler of this.#cancelHandlers) { + cancelHandler(); + } + } catch (error) { + console.warn('Cancellation threw an error', error); + return; + } + } + this.#cancelHandlers.length = 0; + if (this.#reject) this.#reject(new CancelError('Request aborted')); + } + + public get isCancelled(): boolean { + return this.#isCancelled; + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/OpenAPI.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/OpenAPI.ts.snap new file mode 100644 index 000000000..9308c908f --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/OpenAPI.ts.snap @@ -0,0 +1,45 @@ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { TConfig, TResult } from './types'; + +type Resolver = (options: ApiRequestOptions) => Promise; +type Headers = Record; + +export type OpenAPIConfig = { + BASE: string; + CREDENTIALS: 'include' | 'omit' | 'same-origin'; + ENCODE_PATH?: ((path: string) => string) | undefined; + HEADERS?: Headers | Resolver | undefined; + PASSWORD?: string | Resolver | undefined; + RESULT?: TResult; + TOKEN?: string | Resolver | undefined; + USERNAME?: string | Resolver | undefined; + VERSION: string; + WITH_CREDENTIALS: boolean; +}; + +export const OpenAPI: OpenAPIConfig = { + BASE: 'http://localhost:3000/base', + CREDENTIALS: 'include', + ENCODE_PATH: undefined, + HEADERS: undefined, + PASSWORD: undefined, + RESULT: 'body', + TOKEN: undefined, + USERNAME: undefined, + VERSION: '1.0', + WITH_CREDENTIALS: false, +}; + +export const mergeOpenApiConfig = (config: OpenAPIConfig, overrides: TConfig) => { + const merged = { ...config }; + Object.entries(overrides) + .filter(([key]) => key.startsWith('_')) + .forEach(([key, value]) => { + const k = key.slice(1).toLocaleUpperCase() as keyof typeof merged; + if (merged.hasOwnProperty(k)) { + // @ts-ignore + merged[k] = value; + } + }); + return merged; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/request.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/request.ts.snap new file mode 100644 index 000000000..7bc4c87bc --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/request.ts.snap @@ -0,0 +1,314 @@ +import { ApiError } from './ApiError'; +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; +import { CancelablePromise } from './CancelablePromise'; +import type { OnCancel } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; + +export const isString = (value: unknown): value is string => { + return typeof value === 'string'; +}; + +export const isStringWithValue = (value: unknown): value is string => { + return isString(value) && value !== ''; +}; + +export const isBlob = (value: any): value is Blob => { + return ( + value !== null && + typeof value === 'object' && + typeof value.type === 'string' && + typeof value.stream === 'function' && + typeof value.arrayBuffer === 'function' && + typeof value.constructor === 'function' && + typeof value.constructor.name === 'string' && + /^(Blob|File)$/.test(value.constructor.name) && + // @ts-ignore + /^(Blob|File)$/.test(value[Symbol.toStringTag]) + ); +}; + +export const isFormData = (value: unknown): value is FormData => { + return value instanceof FormData; +}; + +export const base64 = (str: string): string => { + try { + return btoa(str); + } catch (err) { + // @ts-ignore + return Buffer.from(str).toString('base64'); + } +}; + +export const getQueryString = (params: Record): string => { + const qs: string[] = []; + + const append = (key: string, value: unknown) => { + qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); + }; + + const encodePair = (key: string, value: unknown) => { + if (value === undefined || value === null) { + return; + } + + if (Array.isArray(value)) { + value.forEach(v => encodePair(key, v)); + } else if (typeof value === 'object') { + Object.entries(value).forEach(([k, v]) => encodePair(`${key}[${k}]`, v)); + } else { + append(key, value); + } + }; + + Object.entries(params).forEach(([key, value]) => encodePair(key, value)); + + return qs.length ? `?${qs.join('&')}` : ''; +}; + +const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { + const encoder = config.ENCODE_PATH || encodeURI; + + const path = options.url + .replace('{api-version}', config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])); + } + return substring; + }); + + const url = config.BASE + path; + return options.query ? url + getQueryString(options.query) : url; +}; + +export const getFormData = (options: ApiRequestOptions): FormData | undefined => { + if (options.formData) { + const formData = new FormData(); + + const process = (key: string, value: any) => { + if (isString(value) || isBlob(value)) { + formData.append(key, value); + } else { + formData.append(key, JSON.stringify(value)); + } + }; + + Object.entries(options.formData) + .filter(([_, value]) => value !== undefined && value !== null) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + value.forEach(v => process(key, v)); + } else { + process(key, value); + } + }); + + return formData; + } + return undefined; +}; + +type Resolver = (options: ApiRequestOptions) => Promise; + +export const resolve = async (options: ApiRequestOptions, resolver?: T | Resolver): Promise => { + if (typeof resolver === 'function') { + return (resolver as Resolver)(options); + } + return resolver; +}; + +export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise => { + const [token, username, password, additionalHeaders] = await Promise.all([ + resolve(options, config.TOKEN), + resolve(options, config.USERNAME), + resolve(options, config.PASSWORD), + resolve(options, config.HEADERS), + ]); + + const headers = Object.entries({ + Accept: 'application/json', + ...additionalHeaders, + ...options.headers, + }) + .filter(([_, value]) => value !== undefined && value !== null) + .reduce( + (headers, [key, value]) => ({ + ...headers, + [key]: String(value), + }), + {} as Record + ); + + if (isStringWithValue(token)) { + headers['Authorization'] = `Bearer ${token}`; + } + + if (isStringWithValue(username) && isStringWithValue(password)) { + const credentials = base64(`${username}:${password}`); + headers['Authorization'] = `Basic ${credentials}`; + } + + if (options.body !== undefined) { + if (options.mediaType) { + headers['Content-Type'] = options.mediaType; + } else if (isBlob(options.body)) { + headers['Content-Type'] = options.body.type || 'application/octet-stream'; + } else if (isString(options.body)) { + headers['Content-Type'] = 'text/plain'; + } else if (!isFormData(options.body)) { + headers['Content-Type'] = 'application/json'; + } + } + + return new Headers(headers); +}; + +export const getRequestBody = (options: ApiRequestOptions): unknown => { + if (options.body !== undefined) { + if (options.mediaType?.includes('/json')) { + return JSON.stringify(options.body); + } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) { + return options.body; + } else { + return JSON.stringify(options.body); + } + } + return undefined; +}; + +export const sendRequest = async ( + config: OpenAPIConfig, + options: ApiRequestOptions, + url: string, + body: any, + formData: FormData | undefined, + headers: Headers, + onCancel: OnCancel +): Promise => { + const controller = new AbortController(); + + const request: RequestInit = { + headers, + body: body ?? formData, + method: options.method, + signal: controller.signal, + }; + + if (config.WITH_CREDENTIALS) { + request.credentials = config.CREDENTIALS; + } + + onCancel(() => controller.abort()); + + return await fetch(url, request); +}; + +export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => { + if (responseHeader) { + const content = response.headers.get(responseHeader); + if (isString(content)) { + return content; + } + } + return undefined; +}; + +export const getResponseBody = async (response: Response): Promise => { + if (response.status !== 204) { + try { + const contentType = response.headers.get('Content-Type'); + if (contentType) { + const jsonTypes = ['application/json', 'application/problem+json']; + const binaryTypes = ['audio/', 'image/', 'video/']; + const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type)); + const isBinary = binaryTypes.some(type => contentType.toLowerCase().startsWith(type)); + if (isJSON) { + return await response.json(); + } else if (isBinary) { + return await response.blob(); + } else { + return await response.text(); + } + } + } catch (error) { + console.error(error); + } + } + return undefined; +}; + +export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => { + const errors: Record = { + 400: 'Bad Request', + 401: 'Unauthorized', + 403: 'Forbidden', + 404: 'Not Found', + 500: 'Internal Server Error', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + ...options.errors, + }; + + const error = errors[result.status]; + if (error) { + throw new ApiError(options, result, error); + } + + if (!result.ok) { + const errorStatus = result.status ?? 'unknown'; + const errorStatusText = result.statusText ?? 'unknown'; + const errorBody = (() => { + try { + return JSON.stringify(result.body, null, 2); + } catch (e) { + return undefined; + } + })(); + + throw new ApiError( + options, + result, + `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}` + ); + } +}; + +/** + * Request method + * @param config The OpenAPI configuration object + * @param options The request options from the service + * @returns CancelablePromise + * @throws ApiError + */ +export const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise => { + return new CancelablePromise(async (resolve, reject, onCancel) => { + try { + const url = getUrl(config, options); + const formData = getFormData(options); + const body = getRequestBody(options); + const headers = await getHeaders(config, options); + + if (!onCancel.isCancelled) { + const response = await sendRequest(config, options, url, body, formData, headers, onCancel); + const responseBody = await getResponseBody(response); + const responseHeader = getResponseHeader(response, options.responseHeader); + + const result: ApiResult = { + url, + ok: response.ok, + status: response.status, + statusText: response.statusText, + body: responseHeader ?? responseBody, + }; + + catchErrorCodes(options, result); + + resolve(result.body); + } + } catch (error) { + reject(error); + } + }); +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/types.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/types.ts.snap new file mode 100644 index 000000000..e33a5d996 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/core/types.ts.snap @@ -0,0 +1,10 @@ +import type { ApiResult } from './ApiResult'; + +export type TResult = 'body' | 'raw'; + +export type TApiResponse = + Exclude extends never ? ApiResult : ApiResult['body']; + +export type TConfig = { + _result?: T; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/index.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/index.ts.snap new file mode 100644 index 000000000..2c5a14f44 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/index.ts.snap @@ -0,0 +1,8 @@ +export { ApiError } from './core/ApiError'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI } from './core/OpenAPI'; +export type { OpenAPIConfig } from './core/OpenAPI'; + +export * from './models'; +export * from './schemas'; +export * from './services'; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/AnyOfAnyAndNull.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/AnyOfAnyAndNull.ts.snap new file mode 100644 index 000000000..6ae8825f1 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/AnyOfAnyAndNull.ts.snap @@ -0,0 +1,3 @@ +export type AnyOfAnyAndNull = { + data?: unknown | null; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/AnyOfArrays.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/AnyOfArrays.ts.snap new file mode 100644 index 000000000..19603e432 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/AnyOfArrays.ts.snap @@ -0,0 +1,13 @@ +/** + * This is a simple array with any of properties + */ +export type AnyOfArrays = { + results?: Array< + | { + foo?: string; + } + | { + bar?: string; + } + >; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithAnyOfProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithAnyOfProperties.ts.snap new file mode 100644 index 000000000..f1035ac52 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithAnyOfProperties.ts.snap @@ -0,0 +1,11 @@ +/** + * This is a simple array with any of properties + */ +export type ArrayWithAnyOfProperties = Array< + | { + foo?: string; + } + | { + bar?: string; + } +>; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithArray.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithArray.ts.snap new file mode 100644 index 000000000..e22d6a4be --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithArray.ts.snap @@ -0,0 +1,6 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a simple array containing an array + */ +export type ArrayWithArray = Array>; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithBooleans.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithBooleans.ts.snap new file mode 100644 index 000000000..47c9c25ad --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithBooleans.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithNumbers.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithNumbers.ts.snap new file mode 100644 index 000000000..e19d5c773 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithNumbers.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithProperties.ts.snap new file mode 100644 index 000000000..2cb636892 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithProperties.ts.snap @@ -0,0 +1,7 @@ +/** + * This is a simple array with properties + */ +export type ArrayWithProperties = Array<{ + foo?: string; + bar?: string; +}>; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithReferences.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithReferences.ts.snap new file mode 100644 index 000000000..cce8ccacb --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithReferences.ts.snap @@ -0,0 +1,6 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a simple array with references + */ +export type ArrayWithReferences = Array; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithStrings.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithStrings.ts.snap new file mode 100644 index 000000000..df2b24751 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ArrayWithStrings.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithBackticks.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithBackticks.ts.snap new file mode 100644 index 000000000..8821bb20e --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithBackticks.ts.snap @@ -0,0 +1,4 @@ +/** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ +export type CommentWithBackticks = number; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithBreaks.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithBreaks.ts.snap new file mode 100644 index 000000000..1901bb6c3 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithBreaks.ts.snap @@ -0,0 +1,7 @@ +/** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ +export type CommentWithBreaks = number; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithExpressionPlaceholders.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithExpressionPlaceholders.ts.snap new file mode 100644 index 000000000..5fc8b7e03 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithExpressionPlaceholders.ts.snap @@ -0,0 +1,4 @@ +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithQuotes.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithQuotes.ts.snap new file mode 100644 index 000000000..f5abb3c73 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithQuotes.ts.snap @@ -0,0 +1,4 @@ +/** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ +export type CommentWithQuotes = number; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithReservedCharacters.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithReservedCharacters.ts.snap new file mode 100644 index 000000000..0a8ee6de3 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithReservedCharacters.ts.snap @@ -0,0 +1,4 @@ +/** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ +export type CommentWithReservedCharacters = number; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithSlashes.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithSlashes.ts.snap new file mode 100644 index 000000000..ec9d9f26d --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CommentWithSlashes.ts.snap @@ -0,0 +1,4 @@ +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionBaseModel.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionBaseModel.ts.snap new file mode 100644 index 000000000..4a6997e24 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionBaseModel.ts.snap @@ -0,0 +1,7 @@ +/** + * This is a base model with two simple optional properties + */ +export type CompositionBaseModel = { + firstName?: string; + lastname?: string; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionExtendedModel.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionExtendedModel.ts.snap new file mode 100644 index 000000000..5d5598c88 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionExtendedModel.ts.snap @@ -0,0 +1,10 @@ +import type { CompositionBaseModel } from './CompositionBaseModel'; + +/** + * This is a model that extends the base model + */ +export type CompositionExtendedModel = CompositionBaseModel & { + firstName: string; + lastname: string; + age: number; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAllOfAndNullable.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAllOfAndNullable.ts.snap new file mode 100644 index 000000000..5c22a114c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAllOfAndNullable.ts.snap @@ -0,0 +1,16 @@ +import type { ModelWithArray } from './ModelWithArray'; +import type { ModelWithDictionary } from './ModelWithDictionary'; +import type { ModelWithEnum } from './ModelWithEnum'; + +/** + * This is a model with one property with a 'all of' relationship + */ +export type CompositionWithAllOfAndNullable = { + propA?: + | ({ + boolean?: boolean; + } & ModelWithEnum & + ModelWithArray & + ModelWithDictionary) + | null; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOf.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOf.ts.snap new file mode 100644 index 000000000..b4f77afd8 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOf.ts.snap @@ -0,0 +1,11 @@ +import type { ModelWithArray } from './ModelWithArray'; +import type { ModelWithDictionary } from './ModelWithDictionary'; +import type { ModelWithEnum } from './ModelWithEnum'; +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOfAndNullable.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOfAndNullable.ts.snap new file mode 100644 index 000000000..e03daa1fa --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOfAndNullable.ts.snap @@ -0,0 +1,17 @@ +import type { ModelWithArray } from './ModelWithArray'; +import type { ModelWithDictionary } from './ModelWithDictionary'; +import type { ModelWithEnum } from './ModelWithEnum'; + +/** + * This is a model with one property with a 'any of' relationship + */ +export type CompositionWithAnyOfAndNullable = { + propA?: + | { + boolean?: boolean; + } + | ModelWithEnum + | ModelWithArray + | ModelWithDictionary + | null; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOfAnonymous.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOfAnonymous.ts.snap new file mode 100644 index 000000000..b5abf3bc7 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithAnyOfAnonymous.ts.snap @@ -0,0 +1,11 @@ +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithAnyOfAnonymous = { + propA?: + | { + propA?: string; + } + | string + | number; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithNestedAnyAndTypeNull.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithNestedAnyAndTypeNull.ts.snap new file mode 100644 index 000000000..198a0920f --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithNestedAnyAndTypeNull.ts.snap @@ -0,0 +1,9 @@ +import type { ModelWithArray } from './ModelWithArray'; +import type { ModelWithDictionary } from './ModelWithDictionary'; + +/** + * This is a model with nested 'any of' property with a type null + */ +export type CompositionWithNestedAnyAndTypeNull = { + propA?: Array | Array; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithNestedAnyOfAndNull.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithNestedAnyOfAndNull.ts.snap new file mode 100644 index 000000000..f598fed05 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithNestedAnyOfAndNull.ts.snap @@ -0,0 +1,9 @@ +import type { ConstValue } from './ConstValue'; +import type { Enum1 } from './Enum1'; + +/** + * This is a model with one property with a 'any of' relationship where the options are not $ref + */ +export type CompositionWithNestedAnyOfAndNull = { + propA?: Array | null; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOf.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOf.ts.snap new file mode 100644 index 000000000..6faf1d73a --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOf.ts.snap @@ -0,0 +1,11 @@ +import type { ModelWithArray } from './ModelWithArray'; +import type { ModelWithDictionary } from './ModelWithDictionary'; +import type { ModelWithEnum } from './ModelWithEnum'; +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOf = { + propA?: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndComplexArrayDictionary.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndComplexArrayDictionary.ts.snap new file mode 100644 index 000000000..f98100a06 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndComplexArrayDictionary.ts.snap @@ -0,0 +1,6 @@ +/** + * This is a model that contains a dictionary of complex arrays (composited) within composition + */ +export type CompositionWithOneOfAndComplexArrayDictionary = { + propA?: boolean | Record>; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndNullable.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndNullable.ts.snap new file mode 100644 index 000000000..c71253b8e --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndNullable.ts.snap @@ -0,0 +1,17 @@ +import type { ModelWithArray } from './ModelWithArray'; +import type { ModelWithDictionary } from './ModelWithDictionary'; +import type { ModelWithEnum } from './ModelWithEnum'; + +/** + * This is a model with one property with a 'one of' relationship + */ +export type CompositionWithOneOfAndNullable = { + propA?: + | { + boolean?: boolean; + } + | ModelWithEnum + | ModelWithArray + | ModelWithDictionary + | null; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndProperties.ts.snap new file mode 100644 index 000000000..b62f3159d --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndProperties.ts.snap @@ -0,0 +1,14 @@ +import type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from './NonAsciiStringæøåÆØÅöôêÊ字符串'; +import type { SimpleParameter } from './SimpleParameter'; + +export type CompositionWithOneOfAndProperties = + | { + foo: SimpleParameter; + baz: number | null; + qux: number; + } + | { + bar: NonAsciiStringæøåÆØÅöôêÊ字符串; + baz: number | null; + qux: number; + }; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndSimpleArrayDictionary.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndSimpleArrayDictionary.ts.snap new file mode 100644 index 000000000..7d89d086e --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndSimpleArrayDictionary.ts.snap @@ -0,0 +1,6 @@ +/** + * This is a model that contains a dictionary of simple arrays within composition + */ +export type CompositionWithOneOfAndSimpleArrayDictionary = { + propA?: boolean | Record>; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndSimpleDictionary.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndSimpleDictionary.ts.snap new file mode 100644 index 000000000..df2b73b59 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAndSimpleDictionary.ts.snap @@ -0,0 +1,6 @@ +/** + * This is a model that contains a simple dictionary within composition + */ +export type CompositionWithOneOfAndSimpleDictionary = { + propA?: boolean | Record; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAnonymous.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAnonymous.ts.snap new file mode 100644 index 000000000..befe9779a --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfAnonymous.ts.snap @@ -0,0 +1,11 @@ +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfAnonymous = { + propA?: + | { + propA?: string; + } + | string + | number; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfDiscriminator.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfDiscriminator.ts.snap new file mode 100644 index 000000000..a2f9acd00 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/CompositionWithOneOfDiscriminator.ts.snap @@ -0,0 +1,7 @@ +import type { ModelCircle } from './ModelCircle'; +import type { ModelSquare } from './ModelSquare'; + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export type CompositionWithOneOfDiscriminator = ModelCircle | ModelSquare; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ConstValue.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ConstValue.ts.snap new file mode 100644 index 000000000..2ae94c345 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ConstValue.ts.snap @@ -0,0 +1 @@ +export type ConstValue = 'ConstValue'; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DeprecatedModel.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DeprecatedModel.ts.snap new file mode 100644 index 000000000..d42fc4724 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DeprecatedModel.ts.snap @@ -0,0 +1,11 @@ +/** + * This is a deprecated model with a deprecated property + * @deprecated + */ +export type DeprecatedModel = { + /** + * This is a deprecated property + * @deprecated + */ + prop?: string; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithArray.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithArray.ts.snap new file mode 100644 index 000000000..1f607589c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithArray.ts.snap @@ -0,0 +1,6 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a complex dictionary + */ +export type DictionaryWithArray = Record>; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithDictionary.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithDictionary.ts.snap new file mode 100644 index 000000000..8de230522 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithDictionary.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = Record>; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithProperties.ts.snap new file mode 100644 index 000000000..4997b3540 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithProperties.ts.snap @@ -0,0 +1,10 @@ +/** + * This is a complex dictionary + */ +export type DictionaryWithProperties = Record< + string, + { + foo?: string; + bar?: string; + } +>; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithReference.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithReference.ts.snap new file mode 100644 index 000000000..9c6984d91 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithReference.ts.snap @@ -0,0 +1,6 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a string reference + */ +export type DictionaryWithReference = Record; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithString.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithString.ts.snap new file mode 100644 index 000000000..8cdba767c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/DictionaryWithString.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a string dictionary + */ +export type DictionaryWithString = Record; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/Enum1.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/Enum1.ts.snap new file mode 100644 index 000000000..44f0e7d38 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/Enum1.ts.snap @@ -0,0 +1,4 @@ +export enum Enum1 { + BIRD = 'Bird', + DOG = 'Dog', +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumFromDescription.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumFromDescription.ts.snap new file mode 100644 index 000000000..c399deac4 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumFromDescription.ts.snap @@ -0,0 +1,4 @@ +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithExtensions.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithExtensions.ts.snap new file mode 100644 index 000000000..0a4179f9c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithExtensions.ts.snap @@ -0,0 +1,17 @@ +/** + * This is a simple enum with numbers + */ +export enum EnumWithExtensions { + /** + * Used when the status of something is successful + */ + CUSTOM_SUCCESS = 200, + /** + * Used when the status of something has a warning + */ + CUSTOM_WARNING = 400, + /** + * Used when the status of something has an error + */ + CUSTOM_ERROR = 500, +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithNumbers.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithNumbers.ts.snap new file mode 100644 index 000000000..5cddf1379 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithNumbers.ts.snap @@ -0,0 +1,20 @@ +/** + * This is a simple enum with numbers + */ +export enum EnumWithNumbers { + '_1' = 1, + '_2' = 2, + '_3' = 3, + '_1.1' = 1.1, + '_1.2' = 1.2, + '_1.3' = 1.3, + '_100' = 100, + '_200' = 200, + '_300' = 300, + '_-100' = -100, + '_-200' = -200, + '_-300' = -300, + '_-1.1' = -1.1, + '_-1.2' = -1.2, + '_-1.3' = -1.3, +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithReplacedCharacters.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithReplacedCharacters.ts.snap new file mode 100644 index 000000000..bc5928d44 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithReplacedCharacters.ts.snap @@ -0,0 +1,7 @@ +export enum EnumWithReplacedCharacters { + _SINGLE_QUOTE_ = "'Single Quote'", + _DOUBLE_QUOTES_ = '"Double Quotes"', + ØÆÅÔÖ_ØÆÅÔÖ字符串 = 'øæåôöØÆÅÔÖ字符串', + '_3.1' = 3.1, + EMPTY_STRING = '', +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithStrings.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithStrings.ts.snap new file mode 100644 index 000000000..d3ca3e15b --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/EnumWithStrings.ts.snap @@ -0,0 +1,11 @@ +/** + * This is a simple enum with strings + */ +export enum EnumWithStrings { + SUCCESS = 'Success', + WARNING = 'Warning', + ERROR = 'Error', + _SINGLE_QUOTE_ = "'Single Quote'", + _DOUBLE_QUOTES_ = '"Double Quotes"', + NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串 = 'Non-ascii: øæåôöØÆÅÔÖ字符串', +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/File.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/File.ts.snap new file mode 100644 index 000000000..e206fad7f --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/File.ts.snap @@ -0,0 +1,7 @@ +export type File = { + readonly id?: string; + readonly updated_at?: string; + readonly created_at?: string; + mime: string; + readonly file?: string; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap new file mode 100644 index 000000000..0fb4a7517 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = Record; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap new file mode 100644 index 000000000..16961a031 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a free-form object with additionalProperties: true. + */ +export type FreeFormObjectWithAdditionalPropertiesEqTrue = Record; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithoutAdditionalProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithoutAdditionalProperties.ts.snap new file mode 100644 index 000000000..9ab1d8d24 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/FreeFormObjectWithoutAdditionalProperties.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = Record; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelCircle.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelCircle.ts.snap new file mode 100644 index 000000000..ad93f2e41 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelCircle.ts.snap @@ -0,0 +1,7 @@ +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelSquare.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelSquare.ts.snap new file mode 100644 index 000000000..f1911fe03 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelSquare.ts.snap @@ -0,0 +1,7 @@ +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelThatExtends.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelThatExtends.ts.snap new file mode 100644 index 000000000..4ae9a1b85 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelThatExtends.ts.snap @@ -0,0 +1,9 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model that extends another model + */ +export type ModelThatExtends = ModelWithString & { + propExtendsA?: string; + propExtendsB?: ModelWithString; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelThatExtendsExtends.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelThatExtendsExtends.ts.snap new file mode 100644 index 000000000..8207bd040 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelThatExtendsExtends.ts.snap @@ -0,0 +1,11 @@ +import type { ModelThatExtends } from './ModelThatExtends'; +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model that extends another model + */ +export type ModelThatExtendsExtends = ModelWithString & + ModelThatExtends & { + propExtendsC?: string; + propExtendsD?: ModelWithString; + }; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithAdditionalPropertiesEqTrue.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithAdditionalPropertiesEqTrue.ts.snap new file mode 100644 index 000000000..4d5a422ec --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithAdditionalPropertiesEqTrue.ts.snap @@ -0,0 +1,10 @@ +/** + * This is a model with one property and additionalProperties: true + */ +export type ModelWithAdditionalPropertiesEqTrue = { + /** + * This is a simple string property + */ + prop?: string; + [key: string]: unknown; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithArray.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithArray.ts.snap new file mode 100644 index 000000000..b3caea287 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithArray.ts.snap @@ -0,0 +1,10 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArray = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithArrayReadOnlyAndWriteOnly.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithArrayReadOnlyAndWriteOnly.ts.snap new file mode 100644 index 000000000..a0679628f --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithArrayReadOnlyAndWriteOnly.ts.snap @@ -0,0 +1,10 @@ +import type { ModelWithReadOnlyAndWriteOnly } from './ModelWithReadOnlyAndWriteOnly'; + +/** + * This is a model with one property containing an array + */ +export type ModelWithArrayReadOnlyAndWriteOnly = { + prop?: Array; + propWithFile?: Array; + propWithNumber?: Array; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithBoolean.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithBoolean.ts.snap new file mode 100644 index 000000000..3fb0b51c4 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithBoolean.ts.snap @@ -0,0 +1,9 @@ +/** + * This is a model with one boolean property + */ +export type ModelWithBoolean = { + /** + * This is a simple boolean property + */ + prop?: boolean; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithCircularReference.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithCircularReference.ts.snap new file mode 100644 index 000000000..02560acd2 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithCircularReference.ts.snap @@ -0,0 +1,6 @@ +/** + * This is a model with one property containing a circular reference + */ +export type ModelWithCircularReference = { + prop?: ModelWithCircularReference; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithConst.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithConst.ts.snap new file mode 100644 index 000000000..174ff6348 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithConst.ts.snap @@ -0,0 +1,6 @@ +export type ModelWithConst = { + String?: 'String'; + number?: 0; + null?: null; + withType?: 'Some string'; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDictionary.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDictionary.ts.snap new file mode 100644 index 000000000..34e8b2904 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDictionary.ts.snap @@ -0,0 +1,6 @@ +/** + * This is a model with one property containing a dictionary + */ +export type ModelWithDictionary = { + prop?: Record; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDuplicateImports.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDuplicateImports.ts.snap new file mode 100644 index 000000000..55a879e42 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDuplicateImports.ts.snap @@ -0,0 +1,10 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model with duplicated imports + */ +export type ModelWithDuplicateImports = { + propA?: ModelWithString; + propB?: ModelWithString; + propC?: ModelWithString; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDuplicateProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDuplicateProperties.ts.snap new file mode 100644 index 000000000..865db789c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithDuplicateProperties.ts.snap @@ -0,0 +1,8 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model with duplicated properties + */ +export type ModelWithDuplicateProperties = { + prop?: ModelWithString; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnum.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnum.ts.snap new file mode 100644 index 000000000..9f98764cc --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnum.ts.snap @@ -0,0 +1,17 @@ +/** + * This is a model with one enum + */ +export type ModelWithEnum = { + /** + * This is a simple enum with strings + */ + test?: 'Success' | 'Warning' | 'Error' | 'ØÆÅ字符串'; + /** + * These are the HTTP error code enums + */ + statusCode?: '100' | '200 FOO' | '300 FOO_BAR' | '400 foo-bar' | '500 foo.bar' | '600 foo&bar'; + /** + * Simple boolean enum + */ + bool?: boolean; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnumFromDescription.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnumFromDescription.ts.snap new file mode 100644 index 000000000..d34988f55 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnumFromDescription.ts.snap @@ -0,0 +1,9 @@ +/** + * This is a model with one enum + */ +export type ModelWithEnumFromDescription = { + /** + * Success=1,Warning=2,Error=3 + */ + test?: number; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnumWithHyphen.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnumWithHyphen.ts.snap new file mode 100644 index 000000000..6b967b844 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithEnumWithHyphen.ts.snap @@ -0,0 +1,6 @@ +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithInteger.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithInteger.ts.snap new file mode 100644 index 000000000..fcf3ed1d6 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithInteger.ts.snap @@ -0,0 +1,9 @@ +/** + * This is a model with one number property + */ +export type ModelWithInteger = { + /** + * This is a simple number property + */ + prop?: number; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnums.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnums.ts.snap new file mode 100644 index 000000000..3abc00ee6 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnums.ts.snap @@ -0,0 +1,6 @@ +import type { ModelWithNestedArrayEnumsData } from './ModelWithNestedArrayEnumsData'; + +export type ModelWithNestedArrayEnums = { + array_strings?: Array; + data?: ModelWithNestedArrayEnumsData; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsData.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsData.ts.snap new file mode 100644 index 000000000..b675991c0 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsData.ts.snap @@ -0,0 +1,7 @@ +import type { ModelWithNestedArrayEnumsDataBar } from './ModelWithNestedArrayEnumsDataBar'; +import type { ModelWithNestedArrayEnumsDataFoo } from './ModelWithNestedArrayEnumsDataFoo'; + +export type ModelWithNestedArrayEnumsData = { + foo?: Array; + bar?: Array; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsDataBar.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsDataBar.ts.snap new file mode 100644 index 000000000..681cd1950 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsDataBar.ts.snap @@ -0,0 +1,4 @@ +export enum ModelWithNestedArrayEnumsDataBar { + BAZ = 'baz', + QUX = 'qux', +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsDataFoo.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsDataFoo.ts.snap new file mode 100644 index 000000000..e2818c7af --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedArrayEnumsDataFoo.ts.snap @@ -0,0 +1,4 @@ +export enum ModelWithNestedArrayEnumsDataFoo { + FOO = 'foo', + BAR = 'bar', +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedCompositionEnums.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedCompositionEnums.ts.snap new file mode 100644 index 000000000..ae1ec5fd5 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedCompositionEnums.ts.snap @@ -0,0 +1,5 @@ +import type { ModelWithNestedArrayEnumsDataFoo } from './ModelWithNestedArrayEnumsDataFoo'; + +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedEnums.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedEnums.ts.snap new file mode 100644 index 000000000..8e1ed1cd8 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedEnums.ts.snap @@ -0,0 +1,9 @@ +/** + * This is a model with nested enums + */ +export type ModelWithNestedEnums = { + dictionaryWithEnum?: Record; + dictionaryWithEnumFromDescription?: Record; + arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; + arrayWithDescription?: Array; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedProperties.ts.snap new file mode 100644 index 000000000..1c9d61d63 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNestedProperties.ts.snap @@ -0,0 +1,10 @@ +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: string | null; + } | null; + } | null; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNullableObject.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNullableObject.ts.snap new file mode 100644 index 000000000..14a3288e3 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNullableObject.ts.snap @@ -0,0 +1,5 @@ +import type { NullableObject } from './NullableObject'; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNullableString.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNullableString.ts.snap new file mode 100644 index 000000000..da7b07f72 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithNullableString.ts.snap @@ -0,0 +1,21 @@ +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp1?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp1: string | null; + /** + * This is a simple string property + */ + nullableProp2?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp2: string | null; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithOneOfEnum.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithOneOfEnum.ts.snap new file mode 100644 index 000000000..9dfaeb374 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithOneOfEnum.ts.snap @@ -0,0 +1,18 @@ +export type ModelWithOneOfEnum = + | { + foo: 'Bar'; + } + | { + foo: 'Baz'; + } + | { + foo: 'Qux'; + } + | { + content: string; + foo: 'Quux'; + } + | { + content: [string, string]; + foo: 'Corge'; + }; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithOrderedProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithOrderedProperties.ts.snap new file mode 100644 index 000000000..d9e532738 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithOrderedProperties.ts.snap @@ -0,0 +1,8 @@ +/** + * This is a model with ordered properties + */ +export type ModelWithOrderedProperties = { + zebra?: string; + apple?: string; + hawaii?: string; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithPattern.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithPattern.ts.snap new file mode 100644 index 000000000..ca88e528c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithPattern.ts.snap @@ -0,0 +1,14 @@ +/** + * This is a model that contains a some patterns + */ +export type ModelWithPattern = { + key: string; + name: string; + readonly enabled?: boolean; + readonly modified?: string; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithProperties.ts.snap new file mode 100644 index 000000000..34d1f8bf8 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithProperties.ts.snap @@ -0,0 +1,19 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + requiredAndNullable: string | null; + string?: string; + number?: number; + boolean?: boolean; + reference?: ModelWithString; + 'property with space'?: string; + default?: string; + try?: string; + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithReadOnlyAndWriteOnly.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithReadOnlyAndWriteOnly.ts.snap new file mode 100644 index 000000000..558101f98 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithReadOnlyAndWriteOnly.ts.snap @@ -0,0 +1,5 @@ +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithReference.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithReference.ts.snap new file mode 100644 index 000000000..80dbd078b --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithReference.ts.snap @@ -0,0 +1,8 @@ +import type { ModelWithProperties } from './ModelWithProperties'; + +/** + * This is a model with one property containing a reference + */ +export type ModelWithReference = { + prop?: ModelWithProperties; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithString.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithString.ts.snap new file mode 100644 index 000000000..7e0e7b336 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/ModelWithString.ts.snap @@ -0,0 +1,9 @@ +/** + * This is a model with one string property + */ +export type ModelWithString = { + /** + * This is a simple string property + */ + prop?: string; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NestedAnyOfArraysNullable.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NestedAnyOfArraysNullable.ts.snap new file mode 100644 index 000000000..241963542 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NestedAnyOfArraysNullable.ts.snap @@ -0,0 +1,3 @@ +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; diff --git "a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NonAsciiString\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212\345\255\227\347\254\246\344\270\262.ts.snap" "b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NonAsciiString\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212\345\255\227\347\254\246\344\270\262.ts.snap" new file mode 100644 index 000000000..72359bbde --- /dev/null +++ "b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NonAsciiString\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212\345\255\227\347\254\246\344\270\262.ts.snap" @@ -0,0 +1,4 @@ +/** + * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) + */ +export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NullableObject.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NullableObject.ts.snap new file mode 100644 index 000000000..c2f64ece7 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/NullableObject.ts.snap @@ -0,0 +1,6 @@ +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/Pageable.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/Pageable.ts.snap new file mode 100644 index 000000000..659cc4bc2 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/Pageable.ts.snap @@ -0,0 +1,5 @@ +export type Pageable = { + page?: number; + size?: number; + sort?: Array; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleBoolean.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleBoolean.ts.snap new file mode 100644 index 000000000..99b020679 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleBoolean.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleFile.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleFile.ts.snap new file mode 100644 index 000000000..b206fcf96 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleFile.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple file + */ +export type SimpleFile = Blob; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleInteger.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleInteger.ts.snap new file mode 100644 index 000000000..7a547a495 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleInteger.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple number + */ +export type SimpleInteger = number; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleParameter.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleParameter.ts.snap new file mode 100644 index 000000000..8d9bcc2be --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleParameter.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a reusable parameter + */ +export type SimpleParameter = string; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleReference.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleReference.ts.snap new file mode 100644 index 000000000..d4ddda16f --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleReference.ts.snap @@ -0,0 +1,6 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a simple reference + */ +export type SimpleReference = ModelWithString; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleString.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleString.ts.snap new file mode 100644 index 000000000..ce4410ecf --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleString.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple string + */ +export type SimpleString = string; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleStringWithPattern.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleStringWithPattern.ts.snap new file mode 100644 index 000000000..4765083c8 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/SimpleStringWithPattern.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple string + */ +export type SimpleStringWithPattern = string | null; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/_default.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/_default.ts.snap new file mode 100644 index 000000000..0867799ba --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/_default.ts.snap @@ -0,0 +1,3 @@ +export type _default = { + name?: string; +}; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/index.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/index.ts.snap new file mode 100644 index 000000000..562e14a02 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/models/index.ts.snap @@ -0,0 +1,93 @@ +export type { _default } from './_default'; +export type { AnyOfAnyAndNull } from './AnyOfAnyAndNull'; +export type { AnyOfArrays } from './AnyOfArrays'; +export type { ArrayWithAnyOfProperties } from './ArrayWithAnyOfProperties'; +export type { ArrayWithArray } from './ArrayWithArray'; +export type { ArrayWithBooleans } from './ArrayWithBooleans'; +export type { ArrayWithNumbers } from './ArrayWithNumbers'; +export type { ArrayWithProperties } from './ArrayWithProperties'; +export type { ArrayWithReferences } from './ArrayWithReferences'; +export type { ArrayWithStrings } from './ArrayWithStrings'; +export type { CommentWithBackticks } from './CommentWithBackticks'; +export type { CommentWithBreaks } from './CommentWithBreaks'; +export type { CommentWithExpressionPlaceholders } from './CommentWithExpressionPlaceholders'; +export type { CommentWithQuotes } from './CommentWithQuotes'; +export type { CommentWithReservedCharacters } from './CommentWithReservedCharacters'; +export type { CommentWithSlashes } from './CommentWithSlashes'; +export type { CompositionBaseModel } from './CompositionBaseModel'; +export type { CompositionExtendedModel } from './CompositionExtendedModel'; +export type { CompositionWithAllOfAndNullable } from './CompositionWithAllOfAndNullable'; +export type { CompositionWithAnyOf } from './CompositionWithAnyOf'; +export type { CompositionWithAnyOfAndNullable } from './CompositionWithAnyOfAndNullable'; +export type { CompositionWithAnyOfAnonymous } from './CompositionWithAnyOfAnonymous'; +export type { CompositionWithNestedAnyAndTypeNull } from './CompositionWithNestedAnyAndTypeNull'; +export type { CompositionWithNestedAnyOfAndNull } from './CompositionWithNestedAnyOfAndNull'; +export type { CompositionWithOneOf } from './CompositionWithOneOf'; +export type { CompositionWithOneOfAndComplexArrayDictionary } from './CompositionWithOneOfAndComplexArrayDictionary'; +export type { CompositionWithOneOfAndNullable } from './CompositionWithOneOfAndNullable'; +export type { CompositionWithOneOfAndProperties } from './CompositionWithOneOfAndProperties'; +export type { CompositionWithOneOfAndSimpleArrayDictionary } from './CompositionWithOneOfAndSimpleArrayDictionary'; +export type { CompositionWithOneOfAndSimpleDictionary } from './CompositionWithOneOfAndSimpleDictionary'; +export type { CompositionWithOneOfAnonymous } from './CompositionWithOneOfAnonymous'; +export type { CompositionWithOneOfDiscriminator } from './CompositionWithOneOfDiscriminator'; +export type { ConstValue } from './ConstValue'; +export type { DeprecatedModel } from './DeprecatedModel'; +export type { DictionaryWithArray } from './DictionaryWithArray'; +export type { DictionaryWithDictionary } from './DictionaryWithDictionary'; +export type { DictionaryWithProperties } from './DictionaryWithProperties'; +export type { DictionaryWithReference } from './DictionaryWithReference'; +export type { DictionaryWithString } from './DictionaryWithString'; +export type { Enum1 } from './Enum1'; +export type { EnumFromDescription } from './EnumFromDescription'; +export type { EnumWithExtensions } from './EnumWithExtensions'; +export type { EnumWithNumbers } from './EnumWithNumbers'; +export type { EnumWithReplacedCharacters } from './EnumWithReplacedCharacters'; +export type { EnumWithStrings } from './EnumWithStrings'; +export type { File } from './File'; +export type { FreeFormObjectWithAdditionalPropertiesEqEmptyObject } from './FreeFormObjectWithAdditionalPropertiesEqEmptyObject'; +export type { FreeFormObjectWithAdditionalPropertiesEqTrue } from './FreeFormObjectWithAdditionalPropertiesEqTrue'; +export type { FreeFormObjectWithoutAdditionalProperties } from './FreeFormObjectWithoutAdditionalProperties'; +export type { ModelCircle } from './ModelCircle'; +export type { ModelSquare } from './ModelSquare'; +export type { ModelThatExtends } from './ModelThatExtends'; +export type { ModelThatExtendsExtends } from './ModelThatExtendsExtends'; +export type { ModelWithAdditionalPropertiesEqTrue } from './ModelWithAdditionalPropertiesEqTrue'; +export type { ModelWithArray } from './ModelWithArray'; +export type { ModelWithArrayReadOnlyAndWriteOnly } from './ModelWithArrayReadOnlyAndWriteOnly'; +export type { ModelWithBoolean } from './ModelWithBoolean'; +export type { ModelWithCircularReference } from './ModelWithCircularReference'; +export type { ModelWithConst } from './ModelWithConst'; +export type { ModelWithDictionary } from './ModelWithDictionary'; +export type { ModelWithDuplicateImports } from './ModelWithDuplicateImports'; +export type { ModelWithDuplicateProperties } from './ModelWithDuplicateProperties'; +export type { ModelWithEnum } from './ModelWithEnum'; +export type { ModelWithEnumFromDescription } from './ModelWithEnumFromDescription'; +export type { ModelWithEnumWithHyphen } from './ModelWithEnumWithHyphen'; +export type { ModelWithInteger } from './ModelWithInteger'; +export type { ModelWithNestedArrayEnums } from './ModelWithNestedArrayEnums'; +export type { ModelWithNestedArrayEnumsData } from './ModelWithNestedArrayEnumsData'; +export type { ModelWithNestedArrayEnumsDataBar } from './ModelWithNestedArrayEnumsDataBar'; +export type { ModelWithNestedArrayEnumsDataFoo } from './ModelWithNestedArrayEnumsDataFoo'; +export type { ModelWithNestedCompositionEnums } from './ModelWithNestedCompositionEnums'; +export type { ModelWithNestedEnums } from './ModelWithNestedEnums'; +export type { ModelWithNestedProperties } from './ModelWithNestedProperties'; +export type { ModelWithNullableObject } from './ModelWithNullableObject'; +export type { ModelWithNullableString } from './ModelWithNullableString'; +export type { ModelWithOneOfEnum } from './ModelWithOneOfEnum'; +export type { ModelWithOrderedProperties } from './ModelWithOrderedProperties'; +export type { ModelWithPattern } from './ModelWithPattern'; +export type { ModelWithProperties } from './ModelWithProperties'; +export type { ModelWithReadOnlyAndWriteOnly } from './ModelWithReadOnlyAndWriteOnly'; +export type { ModelWithReference } from './ModelWithReference'; +export type { ModelWithString } from './ModelWithString'; +export type { NestedAnyOfArraysNullable } from './NestedAnyOfArraysNullable'; +export type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from './NonAsciiStringæøåÆØÅöôêÊ字符串'; +export type { NullableObject } from './NullableObject'; +export type { Pageable } from './Pageable'; +export type { SimpleBoolean } from './SimpleBoolean'; +export type { SimpleFile } from './SimpleFile'; +export type { SimpleInteger } from './SimpleInteger'; +export type { SimpleParameter } from './SimpleParameter'; +export type { SimpleReference } from './SimpleReference'; +export type { SimpleString } from './SimpleString'; +export type { SimpleStringWithPattern } from './SimpleStringWithPattern'; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$AnyOfAnyAndNull.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$AnyOfAnyAndNull.ts.snap new file mode 100644 index 000000000..6788aaf9c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$AnyOfAnyAndNull.ts.snap @@ -0,0 +1,15 @@ +export const $AnyOfAnyAndNull = { + properties: { + data: { + type: 'any-of', + contains: [ + { + properties: {}, + }, + { + type: 'null', + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$AnyOfArrays.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$AnyOfArrays.ts.snap new file mode 100644 index 000000000..631101a73 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$AnyOfArrays.ts.snap @@ -0,0 +1,27 @@ +export const $AnyOfArrays = { + description: `This is a simple array with any of properties`, + properties: { + results: { + type: 'array', + contains: { + type: 'any-of', + contains: [ + { + properties: { + foo: { + type: 'string', + }, + }, + }, + { + properties: { + bar: { + type: 'string', + }, + }, + }, + ], + }, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithAnyOfProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithAnyOfProperties.ts.snap new file mode 100644 index 000000000..e9dbc5758 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithAnyOfProperties.ts.snap @@ -0,0 +1,22 @@ +export const $ArrayWithAnyOfProperties = { + type: 'array', + contains: { + type: 'any-of', + contains: [ + { + properties: { + foo: { + type: 'string', + }, + }, + }, + { + properties: { + bar: { + type: 'string', + }, + }, + }, + ], + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithArray.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithArray.ts.snap new file mode 100644 index 000000000..ff5558c55 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithArray.ts.snap @@ -0,0 +1,9 @@ +export const $ArrayWithArray = { + type: 'array', + contains: { + type: 'array', + contains: { + type: 'ModelWithString', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithBooleans.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithBooleans.ts.snap new file mode 100644 index 000000000..74eee001b --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithBooleans.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithBooleans = { + type: 'array', + contains: { + type: 'boolean', + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithNumbers.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithNumbers.ts.snap new file mode 100644 index 000000000..4aa83e3bc --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithNumbers.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithNumbers = { + type: 'array', + contains: { + type: 'number', + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithProperties.ts.snap new file mode 100644 index 000000000..96a1feb9c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithProperties.ts.snap @@ -0,0 +1,13 @@ +export const $ArrayWithProperties = { + type: 'array', + contains: { + properties: { + foo: { + type: 'string', + }, + bar: { + type: 'string', + }, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithReferences.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithReferences.ts.snap new file mode 100644 index 000000000..8954542ce --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithReferences.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithReferences = { + type: 'array', + contains: { + type: 'ModelWithString', + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithStrings.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithStrings.ts.snap new file mode 100644 index 000000000..6960a863c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ArrayWithStrings.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithStrings = { + type: 'array', + contains: { + type: 'string', + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithBackticks.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithBackticks.ts.snap new file mode 100644 index 000000000..80988c7ee --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithBackticks.ts.snap @@ -0,0 +1,4 @@ +export const $CommentWithBackticks = { + type: 'number', + description: `Testing backticks in string: \`backticks\` and \`\`\`multiple backticks\`\`\` should work`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithBreaks.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithBreaks.ts.snap new file mode 100644 index 000000000..8f5c9d94d --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithBreaks.ts.snap @@ -0,0 +1,7 @@ +export const $CommentWithBreaks = { + type: 'number', + description: `Testing multiline comments in string: First line +Second line + +Fourth line`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithExpressionPlaceholders.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithExpressionPlaceholders.ts.snap new file mode 100644 index 000000000..dffe2676e --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithExpressionPlaceholders.ts.snap @@ -0,0 +1,4 @@ +export const $CommentWithExpressionPlaceholders = { + type: 'number', + description: `Testing expression placeholders in string: \${expression} should work`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithQuotes.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithQuotes.ts.snap new file mode 100644 index 000000000..a71cb895a --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithQuotes.ts.snap @@ -0,0 +1,4 @@ +export const $CommentWithQuotes = { + type: 'number', + description: `Testing quotes in string: 'single quote''' and "double quotes""" should work`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithReservedCharacters.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithReservedCharacters.ts.snap new file mode 100644 index 000000000..1436feefa --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithReservedCharacters.ts.snap @@ -0,0 +1,4 @@ +export const $CommentWithReservedCharacters = { + type: 'number', + description: `Testing reserved characters in string: /* inline */ and /** inline **/ should work`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithSlashes.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithSlashes.ts.snap new file mode 100644 index 000000000..6f72210de --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CommentWithSlashes.ts.snap @@ -0,0 +1,4 @@ +export const $CommentWithSlashes = { + type: 'number', + description: `Testing slashes in string: \\backwards\\\\\\ and /forwards/// should work`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionBaseModel.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionBaseModel.ts.snap new file mode 100644 index 000000000..7806eff05 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionBaseModel.ts.snap @@ -0,0 +1,11 @@ +export const $CompositionBaseModel = { + description: `This is a base model with two simple optional properties`, + properties: { + firstName: { + type: 'string', + }, + lastname: { + type: 'string', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionExtendedModel.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionExtendedModel.ts.snap new file mode 100644 index 000000000..1dcc00354 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionExtendedModel.ts.snap @@ -0,0 +1,25 @@ +export const $CompositionExtendedModel = { + type: 'all-of', + description: `This is a model that extends the base model`, + contains: [ + { + type: 'CompositionBaseModel', + }, + { + properties: { + firstName: { + type: 'string', + isRequired: true, + }, + lastname: { + type: 'string', + isRequired: true, + }, + age: { + type: 'number', + isRequired: true, + }, + }, + }, + ], +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAllOfAndNullable.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAllOfAndNullable.ts.snap new file mode 100644 index 000000000..e914c4b21 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAllOfAndNullable.ts.snap @@ -0,0 +1,27 @@ +export const $CompositionWithAllOfAndNullable = { + description: `This is a model with one property with a 'all of' relationship`, + properties: { + propA: { + type: 'all-of', + contains: [ + { + properties: { + boolean: { + type: 'boolean', + }, + }, + }, + { + type: 'ModelWithEnum', + }, + { + type: 'ModelWithArray', + }, + { + type: 'ModelWithDictionary', + }, + ], + isNullable: true, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOf.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOf.ts.snap new file mode 100644 index 000000000..c0bfdc6b2 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOf.ts.snap @@ -0,0 +1,22 @@ +export const $CompositionWithAnyOf = { + description: `This is a model with one property with a 'any of' relationship`, + properties: { + propA: { + type: 'any-of', + contains: [ + { + type: 'ModelWithString', + }, + { + type: 'ModelWithEnum', + }, + { + type: 'ModelWithArray', + }, + { + type: 'ModelWithDictionary', + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOfAndNullable.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOfAndNullable.ts.snap new file mode 100644 index 000000000..d363cf5b5 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOfAndNullable.ts.snap @@ -0,0 +1,27 @@ +export const $CompositionWithAnyOfAndNullable = { + description: `This is a model with one property with a 'any of' relationship`, + properties: { + propA: { + type: 'any-of', + contains: [ + { + properties: { + boolean: { + type: 'boolean', + }, + }, + }, + { + type: 'ModelWithEnum', + }, + { + type: 'ModelWithArray', + }, + { + type: 'ModelWithDictionary', + }, + ], + isNullable: true, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOfAnonymous.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOfAnonymous.ts.snap new file mode 100644 index 000000000..77ef1edf1 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithAnyOfAnonymous.ts.snap @@ -0,0 +1,26 @@ +export const $CompositionWithAnyOfAnonymous = { + description: `This is a model with one property with a 'any of' relationship where the options are not $ref`, + properties: { + propA: { + type: 'any-of', + contains: [ + { + description: `Anonymous object type`, + properties: { + propA: { + type: 'string', + }, + }, + }, + { + type: 'string', + description: `Anonymous string type`, + }, + { + type: 'number', + description: `Anonymous integer type`, + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithNestedAnyAndTypeNull.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithNestedAnyAndTypeNull.ts.snap new file mode 100644 index 000000000..7fa0460c7 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithNestedAnyAndTypeNull.ts.snap @@ -0,0 +1,38 @@ +export const $CompositionWithNestedAnyAndTypeNull = { + description: `This is a model with nested 'any of' property with a type null`, + properties: { + propA: { + type: 'any-of', + contains: [ + { + type: 'array', + contains: { + type: 'any-of', + contains: [ + { + type: 'ModelWithDictionary', + }, + { + type: 'null', + }, + ], + }, + }, + { + type: 'array', + contains: { + type: 'any-of', + contains: [ + { + type: 'ModelWithArray', + }, + { + type: 'null', + }, + ], + }, + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithNestedAnyOfAndNull.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithNestedAnyOfAndNull.ts.snap new file mode 100644 index 000000000..bc3b25dff --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithNestedAnyOfAndNull.ts.snap @@ -0,0 +1,27 @@ +export const $CompositionWithNestedAnyOfAndNull = { + description: `This is a model with one property with a 'any of' relationship where the options are not $ref`, + properties: { + propA: { + type: 'any-of', + contains: [ + { + type: 'array', + contains: { + type: 'any-of', + contains: [ + { + type: 'Enum1', + }, + { + type: 'ConstValue', + }, + ], + }, + }, + { + type: 'null', + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOf.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOf.ts.snap new file mode 100644 index 000000000..6b58a4f80 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOf.ts.snap @@ -0,0 +1,22 @@ +export const $CompositionWithOneOf = { + description: `This is a model with one property with a 'one of' relationship`, + properties: { + propA: { + type: 'one-of', + contains: [ + { + type: 'ModelWithString', + }, + { + type: 'ModelWithEnum', + }, + { + type: 'ModelWithArray', + }, + { + type: 'ModelWithDictionary', + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts.snap new file mode 100644 index 000000000..7d9f851cf --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts.snap @@ -0,0 +1,30 @@ +export const $CompositionWithOneOfAndComplexArrayDictionary = { + description: `This is a model that contains a dictionary of complex arrays (composited) within composition`, + properties: { + propA: { + type: 'one-of', + contains: [ + { + type: 'boolean', + }, + { + type: 'dictionary', + contains: { + type: 'array', + contains: { + type: 'one-of', + contains: [ + { + type: 'number', + }, + { + type: 'string', + }, + ], + }, + }, + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndNullable.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndNullable.ts.snap new file mode 100644 index 000000000..ac2abfb26 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndNullable.ts.snap @@ -0,0 +1,27 @@ +export const $CompositionWithOneOfAndNullable = { + description: `This is a model with one property with a 'one of' relationship`, + properties: { + propA: { + type: 'one-of', + contains: [ + { + properties: { + boolean: { + type: 'boolean', + }, + }, + }, + { + type: 'ModelWithEnum', + }, + { + type: 'ModelWithArray', + }, + { + type: 'ModelWithDictionary', + }, + ], + isNullable: true, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndProperties.ts.snap new file mode 100644 index 000000000..46624abfe --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndProperties.ts.snap @@ -0,0 +1,43 @@ +export const $CompositionWithOneOfAndProperties = { + type: 'one-of', + contains: [ + { + properties: { + foo: { + type: 'SimpleParameter', + isRequired: true, + }, + baz: { + type: 'number', + isRequired: true, + isNullable: true, + format: 'uint16', + }, + qux: { + type: 'number', + isRequired: true, + format: 'uint8', + }, + }, + }, + { + properties: { + bar: { + type: 'NonAsciiStringæøåÆØÅöôêÊ字符串', + isRequired: true, + }, + baz: { + type: 'number', + isRequired: true, + isNullable: true, + format: 'uint16', + }, + qux: { + type: 'number', + isRequired: true, + format: 'uint8', + }, + }, + }, + ], +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts.snap new file mode 100644 index 000000000..6e76f722c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts.snap @@ -0,0 +1,22 @@ +export const $CompositionWithOneOfAndSimpleArrayDictionary = { + description: `This is a model that contains a dictionary of simple arrays within composition`, + properties: { + propA: { + type: 'one-of', + contains: [ + { + type: 'boolean', + }, + { + type: 'dictionary', + contains: { + type: 'array', + contains: { + type: 'boolean', + }, + }, + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndSimpleDictionary.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndSimpleDictionary.ts.snap new file mode 100644 index 000000000..8d36278c0 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAndSimpleDictionary.ts.snap @@ -0,0 +1,19 @@ +export const $CompositionWithOneOfAndSimpleDictionary = { + description: `This is a model that contains a simple dictionary within composition`, + properties: { + propA: { + type: 'one-of', + contains: [ + { + type: 'boolean', + }, + { + type: 'dictionary', + contains: { + type: 'number', + }, + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAnonymous.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAnonymous.ts.snap new file mode 100644 index 000000000..99a971ea0 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfAnonymous.ts.snap @@ -0,0 +1,26 @@ +export const $CompositionWithOneOfAnonymous = { + description: `This is a model with one property with a 'one of' relationship where the options are not $ref`, + properties: { + propA: { + type: 'one-of', + contains: [ + { + description: `Anonymous object type`, + properties: { + propA: { + type: 'string', + }, + }, + }, + { + type: 'string', + description: `Anonymous string type`, + }, + { + type: 'number', + description: `Anonymous integer type`, + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfDiscriminator.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfDiscriminator.ts.snap new file mode 100644 index 000000000..0a92f9628 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$CompositionWithOneOfDiscriminator.ts.snap @@ -0,0 +1,12 @@ +export const $CompositionWithOneOfDiscriminator = { + type: 'one-of', + description: `This is a model with one property with a 'one of' relationship where the options are not $ref`, + contains: [ + { + type: 'ModelCircle', + }, + { + type: 'ModelSquare', + }, + ], +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ConstValue.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ConstValue.ts.snap new file mode 100644 index 000000000..14d7e990d --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ConstValue.ts.snap @@ -0,0 +1,3 @@ +export const $ConstValue = { + type: '"ConstValue"', +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DeprecatedModel.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DeprecatedModel.ts.snap new file mode 100644 index 000000000..10bf9084c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DeprecatedModel.ts.snap @@ -0,0 +1,9 @@ +export const $DeprecatedModel = { + description: `This is a deprecated model with a deprecated property`, + properties: { + prop: { + type: 'string', + description: `This is a deprecated property`, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithArray.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithArray.ts.snap new file mode 100644 index 000000000..265bcb6f8 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithArray.ts.snap @@ -0,0 +1,9 @@ +export const $DictionaryWithArray = { + type: 'dictionary', + contains: { + type: 'array', + contains: { + type: 'ModelWithString', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithDictionary.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithDictionary.ts.snap new file mode 100644 index 000000000..9c65fceec --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithDictionary.ts.snap @@ -0,0 +1,9 @@ +export const $DictionaryWithDictionary = { + type: 'dictionary', + contains: { + type: 'dictionary', + contains: { + type: 'string', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithProperties.ts.snap new file mode 100644 index 000000000..3c5686647 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithProperties.ts.snap @@ -0,0 +1,13 @@ +export const $DictionaryWithProperties = { + type: 'dictionary', + contains: { + properties: { + foo: { + type: 'string', + }, + bar: { + type: 'string', + }, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithReference.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithReference.ts.snap new file mode 100644 index 000000000..a17eceac4 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithReference.ts.snap @@ -0,0 +1,6 @@ +export const $DictionaryWithReference = { + type: 'dictionary', + contains: { + type: 'ModelWithString', + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithString.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithString.ts.snap new file mode 100644 index 000000000..82e59b164 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$DictionaryWithString.ts.snap @@ -0,0 +1,6 @@ +export const $DictionaryWithString = { + type: 'dictionary', + contains: { + type: 'string', + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$Enum1.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$Enum1.ts.snap new file mode 100644 index 000000000..3a636f896 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$Enum1.ts.snap @@ -0,0 +1,3 @@ +export const $Enum1 = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumFromDescription.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumFromDescription.ts.snap new file mode 100644 index 000000000..55e07639d --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumFromDescription.ts.snap @@ -0,0 +1,4 @@ +export const $EnumFromDescription = { + type: 'number', + description: `Success=1,Warning=2,Error=3`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithExtensions.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithExtensions.ts.snap new file mode 100644 index 000000000..0dcfaa539 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithExtensions.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithExtensions = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithNumbers.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithNumbers.ts.snap new file mode 100644 index 000000000..d571cd240 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithNumbers.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithNumbers = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithReplacedCharacters.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithReplacedCharacters.ts.snap new file mode 100644 index 000000000..30b0e074e --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithReplacedCharacters.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithReplacedCharacters = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithStrings.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithStrings.ts.snap new file mode 100644 index 000000000..a44fadd2f --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$EnumWithStrings.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithStrings = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$File.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$File.ts.snap new file mode 100644 index 000000000..619063773 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$File.ts.snap @@ -0,0 +1,30 @@ +export const $File = { + properties: { + id: { + type: 'string', + isReadOnly: true, + minLength: 1, + }, + updated_at: { + type: 'string', + isReadOnly: true, + format: 'date-time', + }, + created_at: { + type: 'string', + isReadOnly: true, + format: 'date-time', + }, + mime: { + type: 'string', + isRequired: true, + maxLength: 24, + minLength: 1, + }, + file: { + type: 'string', + isReadOnly: true, + format: 'uri', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap new file mode 100644 index 000000000..57069c83e --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap @@ -0,0 +1,6 @@ +export const $FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + type: 'dictionary', + contains: { + properties: {}, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap new file mode 100644 index 000000000..2f9c678a8 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap @@ -0,0 +1,6 @@ +export const $FreeFormObjectWithAdditionalPropertiesEqTrue = { + type: 'dictionary', + contains: { + properties: {}, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.snap new file mode 100644 index 000000000..f04f2246d --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.snap @@ -0,0 +1,6 @@ +export const $FreeFormObjectWithoutAdditionalProperties = { + type: 'dictionary', + contains: { + properties: {}, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelCircle.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelCircle.ts.snap new file mode 100644 index 000000000..bc94d07ad --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelCircle.ts.snap @@ -0,0 +1,12 @@ +export const $ModelCircle = { + description: `Circle`, + properties: { + kind: { + type: 'string', + isRequired: true, + }, + radius: { + type: 'number', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelSquare.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelSquare.ts.snap new file mode 100644 index 000000000..36c6ed92f --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelSquare.ts.snap @@ -0,0 +1,12 @@ +export const $ModelSquare = { + description: `Square`, + properties: { + kind: { + type: 'string', + isRequired: true, + }, + sideLength: { + type: 'number', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelThatExtends.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelThatExtends.ts.snap new file mode 100644 index 000000000..c9b2fb64e --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelThatExtends.ts.snap @@ -0,0 +1,19 @@ +export const $ModelThatExtends = { + type: 'all-of', + description: `This is a model that extends another model`, + contains: [ + { + type: 'ModelWithString', + }, + { + properties: { + propExtendsA: { + type: 'string', + }, + propExtendsB: { + type: 'ModelWithString', + }, + }, + }, + ], +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelThatExtendsExtends.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelThatExtendsExtends.ts.snap new file mode 100644 index 000000000..ade58bc66 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelThatExtendsExtends.ts.snap @@ -0,0 +1,22 @@ +export const $ModelThatExtendsExtends = { + type: 'all-of', + description: `This is a model that extends another model`, + contains: [ + { + type: 'ModelWithString', + }, + { + type: 'ModelThatExtends', + }, + { + properties: { + propExtendsC: { + type: 'string', + }, + propExtendsD: { + type: 'ModelWithString', + }, + }, + }, + ], +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithAdditionalPropertiesEqTrue.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithAdditionalPropertiesEqTrue.ts.snap new file mode 100644 index 000000000..8da1505af --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithAdditionalPropertiesEqTrue.ts.snap @@ -0,0 +1,9 @@ +export const $ModelWithAdditionalPropertiesEqTrue = { + description: `This is a model with one property and additionalProperties: true`, + properties: { + prop: { + type: 'string', + description: `This is a simple string property`, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithArray.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithArray.ts.snap new file mode 100644 index 000000000..a45c6dc1e --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithArray.ts.snap @@ -0,0 +1,23 @@ +export const $ModelWithArray = { + description: `This is a model with one property containing an array`, + properties: { + prop: { + type: 'array', + contains: { + type: 'ModelWithString', + }, + }, + propWithFile: { + type: 'array', + contains: { + type: 'binary', + }, + }, + propWithNumber: { + type: 'array', + contains: { + type: 'number', + }, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts.snap new file mode 100644 index 000000000..e7b7816cf --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts.snap @@ -0,0 +1,23 @@ +export const $ModelWithArrayReadOnlyAndWriteOnly = { + description: `This is a model with one property containing an array`, + properties: { + prop: { + type: 'array', + contains: { + type: 'ModelWithReadOnlyAndWriteOnly', + }, + }, + propWithFile: { + type: 'array', + contains: { + type: 'binary', + }, + }, + propWithNumber: { + type: 'array', + contains: { + type: 'number', + }, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithBoolean.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithBoolean.ts.snap new file mode 100644 index 000000000..ddea6e065 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithBoolean.ts.snap @@ -0,0 +1,9 @@ +export const $ModelWithBoolean = { + description: `This is a model with one boolean property`, + properties: { + prop: { + type: 'boolean', + description: `This is a simple boolean property`, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithCircularReference.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithCircularReference.ts.snap new file mode 100644 index 000000000..6bdf72a9d --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithCircularReference.ts.snap @@ -0,0 +1,8 @@ +export const $ModelWithCircularReference = { + description: `This is a model with one property containing a circular reference`, + properties: { + prop: { + type: 'ModelWithCircularReference', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithConst.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithConst.ts.snap new file mode 100644 index 000000000..622b63c83 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithConst.ts.snap @@ -0,0 +1,16 @@ +export const $ModelWithConst = { + properties: { + String: { + type: '"String"', + }, + number: { + type: '0', + }, + null: { + type: 'null', + }, + withType: { + type: '"Some string"', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDictionary.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDictionary.ts.snap new file mode 100644 index 000000000..1206c8664 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDictionary.ts.snap @@ -0,0 +1,11 @@ +export const $ModelWithDictionary = { + description: `This is a model with one property containing a dictionary`, + properties: { + prop: { + type: 'dictionary', + contains: { + type: 'string', + }, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDuplicateImports.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDuplicateImports.ts.snap new file mode 100644 index 000000000..43d77d2d9 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDuplicateImports.ts.snap @@ -0,0 +1,14 @@ +export const $ModelWithDuplicateImports = { + description: `This is a model with duplicated imports`, + properties: { + propA: { + type: 'ModelWithString', + }, + propB: { + type: 'ModelWithString', + }, + propC: { + type: 'ModelWithString', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDuplicateProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDuplicateProperties.ts.snap new file mode 100644 index 000000000..e0b6a9210 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithDuplicateProperties.ts.snap @@ -0,0 +1,8 @@ +export const $ModelWithDuplicateProperties = { + description: `This is a model with duplicated properties`, + properties: { + prop: { + type: 'ModelWithString', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnum.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnum.ts.snap new file mode 100644 index 000000000..51a60c553 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnum.ts.snap @@ -0,0 +1,15 @@ +export const $ModelWithEnum = { + description: `This is a model with one enum`, + properties: { + test: { + type: 'Enum', + }, + statusCode: { + type: 'Enum', + }, + bool: { + type: 'boolean', + description: `Simple boolean enum`, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnumFromDescription.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnumFromDescription.ts.snap new file mode 100644 index 000000000..0e07bbbd0 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnumFromDescription.ts.snap @@ -0,0 +1,9 @@ +export const $ModelWithEnumFromDescription = { + description: `This is a model with one enum`, + properties: { + test: { + type: 'number', + description: `Success=1,Warning=2,Error=3`, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnumWithHyphen.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnumWithHyphen.ts.snap new file mode 100644 index 000000000..d21d4069f --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithEnumWithHyphen.ts.snap @@ -0,0 +1,8 @@ +export const $ModelWithEnumWithHyphen = { + description: `This is a model with one enum with escaped name`, + properties: { + 'foo-bar-baz-qux': { + type: 'Enum', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithInteger.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithInteger.ts.snap new file mode 100644 index 000000000..99a8b75e6 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithInteger.ts.snap @@ -0,0 +1,9 @@ +export const $ModelWithInteger = { + description: `This is a model with one number property`, + properties: { + prop: { + type: 'number', + description: `This is a simple number property`, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnums.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnums.ts.snap new file mode 100644 index 000000000..808ac231a --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnums.ts.snap @@ -0,0 +1,18 @@ +export const $ModelWithNestedArrayEnums = { + properties: { + array_strings: { + type: 'array', + contains: { + type: 'string', + }, + }, + data: { + type: 'all-of', + contains: [ + { + type: 'ModelWithNestedArrayEnumsData', + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsData.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsData.ts.snap new file mode 100644 index 000000000..5b17c30d7 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsData.ts.snap @@ -0,0 +1,16 @@ +export const $ModelWithNestedArrayEnumsData = { + properties: { + foo: { + type: 'array', + contains: { + type: 'ModelWithNestedArrayEnumsDataFoo', + }, + }, + bar: { + type: 'array', + contains: { + type: 'ModelWithNestedArrayEnumsDataBar', + }, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsDataBar.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsDataBar.ts.snap new file mode 100644 index 000000000..452516d3c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsDataBar.ts.snap @@ -0,0 +1,3 @@ +export const $ModelWithNestedArrayEnumsDataBar = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.snap new file mode 100644 index 000000000..8ca79794a --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.snap @@ -0,0 +1,3 @@ +export const $ModelWithNestedArrayEnumsDataFoo = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedCompositionEnums.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedCompositionEnums.ts.snap new file mode 100644 index 000000000..7f123f5cd --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedCompositionEnums.ts.snap @@ -0,0 +1,12 @@ +export const $ModelWithNestedCompositionEnums = { + properties: { + foo: { + type: 'all-of', + contains: [ + { + type: 'ModelWithNestedArrayEnumsDataFoo', + }, + ], + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedEnums.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedEnums.ts.snap new file mode 100644 index 000000000..646cd8612 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedEnums.ts.snap @@ -0,0 +1,31 @@ +export const $ModelWithNestedEnums = { + description: `This is a model with nested enums`, + properties: { + dictionaryWithEnum: { + type: 'dictionary', + contains: { + type: 'Enum', + }, + }, + dictionaryWithEnumFromDescription: { + type: 'dictionary', + contains: { + type: 'number', + description: `Success=1,Warning=2,Error=3`, + }, + }, + arrayWithEnum: { + type: 'array', + contains: { + type: 'Enum', + }, + }, + arrayWithDescription: { + type: 'array', + contains: { + type: 'number', + description: `Success=1,Warning=2,Error=3`, + }, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedProperties.ts.snap new file mode 100644 index 000000000..c251fdb49 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNestedProperties.ts.snap @@ -0,0 +1,25 @@ +export const $ModelWithNestedProperties = { + description: `This is a model with one nested property`, + properties: { + first: { + properties: { + second: { + properties: { + third: { + type: 'string', + isReadOnly: true, + isRequired: true, + isNullable: true, + }, + }, + isReadOnly: true, + isRequired: true, + isNullable: true, + }, + }, + isReadOnly: true, + isRequired: true, + isNullable: true, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNullableObject.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNullableObject.ts.snap new file mode 100644 index 000000000..98e906b03 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNullableObject.ts.snap @@ -0,0 +1,7 @@ +export const $ModelWithNullableObject = { + properties: { + data: { + type: 'NullableObject', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNullableString.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNullableString.ts.snap new file mode 100644 index 000000000..9f7287b8b --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithNullableString.ts.snap @@ -0,0 +1,27 @@ +export const $ModelWithNullableString = { + description: `This is a model with one string property`, + properties: { + nullableProp1: { + type: 'string', + description: `This is a simple string property`, + isNullable: true, + }, + nullableRequiredProp1: { + type: 'string', + description: `This is a simple string property`, + isRequired: true, + isNullable: true, + }, + nullableProp2: { + type: 'string', + description: `This is a simple string property`, + isNullable: true, + }, + nullableRequiredProp2: { + type: 'string', + description: `This is a simple string property`, + isRequired: true, + isNullable: true, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithOneOfEnum.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithOneOfEnum.ts.snap new file mode 100644 index 000000000..401790d8d --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithOneOfEnum.ts.snap @@ -0,0 +1,66 @@ +export const $ModelWithOneOfEnum = { + type: 'one-of', + contains: [ + { + properties: { + foo: { + type: 'Enum', + isRequired: true, + }, + }, + }, + { + properties: { + foo: { + type: 'Enum', + isRequired: true, + }, + }, + }, + { + properties: { + foo: { + type: 'Enum', + isRequired: true, + }, + }, + }, + { + properties: { + content: { + type: 'string', + isRequired: true, + format: 'date-time', + }, + foo: { + type: 'Enum', + isRequired: true, + }, + }, + }, + { + properties: { + content: { + type: 'array', + contains: { + type: 'any-of', + contains: [ + { + type: 'string', + format: 'date-time', + }, + { + type: 'string', + }, + ], + }, + isRequired: true, + }, + foo: { + type: 'Enum', + isRequired: true, + }, + }, + }, + ], +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithOrderedProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithOrderedProperties.ts.snap new file mode 100644 index 000000000..b26c44366 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithOrderedProperties.ts.snap @@ -0,0 +1,14 @@ +export const $ModelWithOrderedProperties = { + description: `This is a model with ordered properties`, + properties: { + zebra: { + type: 'string', + }, + apple: { + type: 'string', + }, + hawaii: { + type: 'string', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithPattern.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithPattern.ts.snap new file mode 100644 index 000000000..be54e210f --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithPattern.ts.snap @@ -0,0 +1,45 @@ +export const $ModelWithPattern = { + description: `This is a model that contains a some patterns`, + properties: { + key: { + type: 'string', + isRequired: true, + maxLength: 64, + pattern: '^[a-zA-Z0-9_]*$', + }, + name: { + type: 'string', + isRequired: true, + maxLength: 255, + }, + enabled: { + type: 'boolean', + isReadOnly: true, + }, + modified: { + type: 'string', + isReadOnly: true, + format: 'date-time', + }, + id: { + type: 'string', + pattern: '^\\d{2}-\\d{3}-\\d{4}$', + }, + text: { + type: 'string', + pattern: '^\\w+$', + }, + patternWithSingleQuotes: { + type: 'string', + pattern: "^[a-zA-Z0-9']*$", + }, + patternWithNewline: { + type: 'string', + pattern: 'aaa\nbbb', + }, + patternWithBacktick: { + type: 'string', + pattern: 'aaa`bbb', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithProperties.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithProperties.ts.snap new file mode 100644 index 000000000..cb24e6591 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithProperties.ts.snap @@ -0,0 +1,48 @@ +export const $ModelWithProperties = { + description: `This is a model with one nested property`, + properties: { + required: { + type: 'string', + isRequired: true, + }, + requiredAndReadOnly: { + type: 'string', + isReadOnly: true, + isRequired: true, + }, + requiredAndNullable: { + type: 'string', + isRequired: true, + isNullable: true, + }, + string: { + type: 'string', + }, + number: { + type: 'number', + }, + boolean: { + type: 'boolean', + }, + reference: { + type: 'ModelWithString', + }, + 'property with space': { + type: 'string', + }, + default: { + type: 'string', + }, + try: { + type: 'string', + }, + '@namespace.string': { + type: 'string', + isReadOnly: true, + }, + '@namespace.integer': { + type: 'number', + isReadOnly: true, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithReadOnlyAndWriteOnly.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithReadOnlyAndWriteOnly.ts.snap new file mode 100644 index 000000000..3e53de126 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithReadOnlyAndWriteOnly.ts.snap @@ -0,0 +1,17 @@ +export const $ModelWithReadOnlyAndWriteOnly = { + properties: { + foo: { + type: 'string', + isRequired: true, + }, + bar: { + type: 'string', + isReadOnly: true, + isRequired: true, + }, + baz: { + type: 'string', + isRequired: true, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithReference.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithReference.ts.snap new file mode 100644 index 000000000..92b55aa89 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithReference.ts.snap @@ -0,0 +1,8 @@ +export const $ModelWithReference = { + description: `This is a model with one property containing a reference`, + properties: { + prop: { + type: 'ModelWithProperties', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithString.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithString.ts.snap new file mode 100644 index 000000000..6fe3639a7 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$ModelWithString.ts.snap @@ -0,0 +1,9 @@ +export const $ModelWithString = { + description: `This is a model with one string property`, + properties: { + prop: { + type: 'string', + description: `This is a simple string property`, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NestedAnyOfArraysNullable.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NestedAnyOfArraysNullable.ts.snap new file mode 100644 index 000000000..d8788c457 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NestedAnyOfArraysNullable.ts.snap @@ -0,0 +1,26 @@ +export const $NestedAnyOfArraysNullable = { + properties: { + nullableArray: { + type: 'any-of', + contains: [ + { + type: 'array', + contains: { + type: 'any-of', + contains: [ + { + type: 'string', + }, + { + type: 'boolean', + }, + ], + }, + }, + { + type: 'null', + }, + ], + }, + }, +} as const; diff --git "a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NonAsciiString\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212\345\255\227\347\254\246\344\270\262.ts.snap" "b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NonAsciiString\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212\345\255\227\347\254\246\344\270\262.ts.snap" new file mode 100644 index 000000000..e13d8b667 --- /dev/null +++ "b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NonAsciiString\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212\345\255\227\347\254\246\344\270\262.ts.snap" @@ -0,0 +1,4 @@ +export const $NonAsciiStringæøåÆØÅöôêÊ字符串 = { + type: 'string', + description: `A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串)`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NullableObject.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NullableObject.ts.snap new file mode 100644 index 000000000..c2d19cd31 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$NullableObject.ts.snap @@ -0,0 +1,9 @@ +export const $NullableObject = { + description: `An object that can be null`, + properties: { + foo: { + type: 'string', + }, + }, + isNullable: true, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$Pageable.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$Pageable.ts.snap new file mode 100644 index 000000000..e66f2a422 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$Pageable.ts.snap @@ -0,0 +1,19 @@ +export const $Pageable = { + properties: { + page: { + type: 'number', + format: 'int32', + }, + size: { + type: 'number', + format: 'int32', + minimum: 1, + }, + sort: { + type: 'array', + contains: { + type: 'string', + }, + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleBoolean.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleBoolean.ts.snap new file mode 100644 index 000000000..2b76fbf1a --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleBoolean.ts.snap @@ -0,0 +1,4 @@ +export const $SimpleBoolean = { + type: 'boolean', + description: `This is a simple boolean`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleFile.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleFile.ts.snap new file mode 100644 index 000000000..2b54958e2 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleFile.ts.snap @@ -0,0 +1,4 @@ +export const $SimpleFile = { + type: 'binary', + description: `This is a simple file`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleInteger.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleInteger.ts.snap new file mode 100644 index 000000000..c4607071c --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleInteger.ts.snap @@ -0,0 +1,4 @@ +export const $SimpleInteger = { + type: 'number', + description: `This is a simple number`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleParameter.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleParameter.ts.snap new file mode 100644 index 000000000..530bdef01 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleParameter.ts.snap @@ -0,0 +1,4 @@ +export const $SimpleParameter = { + type: 'string', + description: `This is a reusable parameter`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleReference.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleReference.ts.snap new file mode 100644 index 000000000..02091af33 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleReference.ts.snap @@ -0,0 +1,4 @@ +export const $SimpleReference = { + type: 'ModelWithString', + description: `This is a simple reference`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleString.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleString.ts.snap new file mode 100644 index 000000000..ad4de9003 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleString.ts.snap @@ -0,0 +1,4 @@ +export const $SimpleString = { + type: 'string', + description: `This is a simple string`, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleStringWithPattern.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleStringWithPattern.ts.snap new file mode 100644 index 000000000..12ff1ff30 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$SimpleStringWithPattern.ts.snap @@ -0,0 +1,7 @@ +export const $SimpleStringWithPattern = { + type: 'string', + description: `This is a simple string`, + isNullable: true, + maxLength: 64, + pattern: '^[a-zA-Z0-9_]*$', +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$_default.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$_default.ts.snap new file mode 100644 index 000000000..c8fa6c53e --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/$_default.ts.snap @@ -0,0 +1,7 @@ +export const $_default = { + properties: { + name: { + type: 'string', + }, + }, +} as const; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/index.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/index.ts.snap new file mode 100644 index 000000000..0b903c2d7 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/schemas/index.ts.snap @@ -0,0 +1,93 @@ +export { $_default } from './$_default'; +export { $AnyOfAnyAndNull } from './$AnyOfAnyAndNull'; +export { $AnyOfArrays } from './$AnyOfArrays'; +export { $ArrayWithAnyOfProperties } from './$ArrayWithAnyOfProperties'; +export { $ArrayWithArray } from './$ArrayWithArray'; +export { $ArrayWithBooleans } from './$ArrayWithBooleans'; +export { $ArrayWithNumbers } from './$ArrayWithNumbers'; +export { $ArrayWithProperties } from './$ArrayWithProperties'; +export { $ArrayWithReferences } from './$ArrayWithReferences'; +export { $ArrayWithStrings } from './$ArrayWithStrings'; +export { $CommentWithBackticks } from './$CommentWithBackticks'; +export { $CommentWithBreaks } from './$CommentWithBreaks'; +export { $CommentWithExpressionPlaceholders } from './$CommentWithExpressionPlaceholders'; +export { $CommentWithQuotes } from './$CommentWithQuotes'; +export { $CommentWithReservedCharacters } from './$CommentWithReservedCharacters'; +export { $CommentWithSlashes } from './$CommentWithSlashes'; +export { $CompositionBaseModel } from './$CompositionBaseModel'; +export { $CompositionExtendedModel } from './$CompositionExtendedModel'; +export { $CompositionWithAllOfAndNullable } from './$CompositionWithAllOfAndNullable'; +export { $CompositionWithAnyOf } from './$CompositionWithAnyOf'; +export { $CompositionWithAnyOfAndNullable } from './$CompositionWithAnyOfAndNullable'; +export { $CompositionWithAnyOfAnonymous } from './$CompositionWithAnyOfAnonymous'; +export { $CompositionWithNestedAnyAndTypeNull } from './$CompositionWithNestedAnyAndTypeNull'; +export { $CompositionWithNestedAnyOfAndNull } from './$CompositionWithNestedAnyOfAndNull'; +export { $CompositionWithOneOf } from './$CompositionWithOneOf'; +export { $CompositionWithOneOfAndComplexArrayDictionary } from './$CompositionWithOneOfAndComplexArrayDictionary'; +export { $CompositionWithOneOfAndNullable } from './$CompositionWithOneOfAndNullable'; +export { $CompositionWithOneOfAndProperties } from './$CompositionWithOneOfAndProperties'; +export { $CompositionWithOneOfAndSimpleArrayDictionary } from './$CompositionWithOneOfAndSimpleArrayDictionary'; +export { $CompositionWithOneOfAndSimpleDictionary } from './$CompositionWithOneOfAndSimpleDictionary'; +export { $CompositionWithOneOfAnonymous } from './$CompositionWithOneOfAnonymous'; +export { $CompositionWithOneOfDiscriminator } from './$CompositionWithOneOfDiscriminator'; +export { $ConstValue } from './$ConstValue'; +export { $DeprecatedModel } from './$DeprecatedModel'; +export { $DictionaryWithArray } from './$DictionaryWithArray'; +export { $DictionaryWithDictionary } from './$DictionaryWithDictionary'; +export { $DictionaryWithProperties } from './$DictionaryWithProperties'; +export { $DictionaryWithReference } from './$DictionaryWithReference'; +export { $DictionaryWithString } from './$DictionaryWithString'; +export { $Enum1 } from './$Enum1'; +export { $EnumFromDescription } from './$EnumFromDescription'; +export { $EnumWithExtensions } from './$EnumWithExtensions'; +export { $EnumWithNumbers } from './$EnumWithNumbers'; +export { $EnumWithReplacedCharacters } from './$EnumWithReplacedCharacters'; +export { $EnumWithStrings } from './$EnumWithStrings'; +export { $File } from './$File'; +export { $FreeFormObjectWithAdditionalPropertiesEqEmptyObject } from './$FreeFormObjectWithAdditionalPropertiesEqEmptyObject'; +export { $FreeFormObjectWithAdditionalPropertiesEqTrue } from './$FreeFormObjectWithAdditionalPropertiesEqTrue'; +export { $FreeFormObjectWithoutAdditionalProperties } from './$FreeFormObjectWithoutAdditionalProperties'; +export { $ModelCircle } from './$ModelCircle'; +export { $ModelSquare } from './$ModelSquare'; +export { $ModelThatExtends } from './$ModelThatExtends'; +export { $ModelThatExtendsExtends } from './$ModelThatExtendsExtends'; +export { $ModelWithAdditionalPropertiesEqTrue } from './$ModelWithAdditionalPropertiesEqTrue'; +export { $ModelWithArray } from './$ModelWithArray'; +export { $ModelWithArrayReadOnlyAndWriteOnly } from './$ModelWithArrayReadOnlyAndWriteOnly'; +export { $ModelWithBoolean } from './$ModelWithBoolean'; +export { $ModelWithCircularReference } from './$ModelWithCircularReference'; +export { $ModelWithConst } from './$ModelWithConst'; +export { $ModelWithDictionary } from './$ModelWithDictionary'; +export { $ModelWithDuplicateImports } from './$ModelWithDuplicateImports'; +export { $ModelWithDuplicateProperties } from './$ModelWithDuplicateProperties'; +export { $ModelWithEnum } from './$ModelWithEnum'; +export { $ModelWithEnumFromDescription } from './$ModelWithEnumFromDescription'; +export { $ModelWithEnumWithHyphen } from './$ModelWithEnumWithHyphen'; +export { $ModelWithInteger } from './$ModelWithInteger'; +export { $ModelWithNestedArrayEnums } from './$ModelWithNestedArrayEnums'; +export { $ModelWithNestedArrayEnumsData } from './$ModelWithNestedArrayEnumsData'; +export { $ModelWithNestedArrayEnumsDataBar } from './$ModelWithNestedArrayEnumsDataBar'; +export { $ModelWithNestedArrayEnumsDataFoo } from './$ModelWithNestedArrayEnumsDataFoo'; +export { $ModelWithNestedCompositionEnums } from './$ModelWithNestedCompositionEnums'; +export { $ModelWithNestedEnums } from './$ModelWithNestedEnums'; +export { $ModelWithNestedProperties } from './$ModelWithNestedProperties'; +export { $ModelWithNullableObject } from './$ModelWithNullableObject'; +export { $ModelWithNullableString } from './$ModelWithNullableString'; +export { $ModelWithOneOfEnum } from './$ModelWithOneOfEnum'; +export { $ModelWithOrderedProperties } from './$ModelWithOrderedProperties'; +export { $ModelWithPattern } from './$ModelWithPattern'; +export { $ModelWithProperties } from './$ModelWithProperties'; +export { $ModelWithReadOnlyAndWriteOnly } from './$ModelWithReadOnlyAndWriteOnly'; +export { $ModelWithReference } from './$ModelWithReference'; +export { $ModelWithString } from './$ModelWithString'; +export { $NestedAnyOfArraysNullable } from './$NestedAnyOfArraysNullable'; +export { $NonAsciiStringæøåÆØÅöôêÊ字符串 } from './$NonAsciiStringæøåÆØÅöôêÊ字符串'; +export { $NullableObject } from './$NullableObject'; +export { $Pageable } from './$Pageable'; +export { $SimpleBoolean } from './$SimpleBoolean'; +export { $SimpleFile } from './$SimpleFile'; +export { $SimpleInteger } from './$SimpleInteger'; +export { $SimpleParameter } from './$SimpleParameter'; +export { $SimpleReference } from './$SimpleReference'; +export { $SimpleString } from './$SimpleString'; +export { $SimpleStringWithPattern } from './$SimpleStringWithPattern'; diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/CollectionFormatService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/CollectionFormatService.ts.snap new file mode 100644 index 000000000..82db211fd --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/CollectionFormatService.ts.snap @@ -0,0 +1,47 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataCollectionFormat = { + /** + * This is an array parameter that is sent as csv format (comma-separated values) + */ + parameterArrayCsv: Array | null; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array | null; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array | null; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySsv: Array | null; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTsv: Array | null; +}; + +export class CollectionFormatService { + /** + * @throws ApiError + */ + public static collectionFormat(data: TDataCollectionFormat): CancelablePromise { + const { parameterArrayCsv, parameterArrayMulti, parameterArrayPipes, parameterArraySsv, parameterArrayTsv } = + data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/collectionFormat', + query: { + parameterArrayCSV: parameterArrayCsv, + parameterArraySSV: parameterArraySsv, + parameterArrayTSV: parameterArrayTsv, + parameterArrayPipes, + parameterArrayMulti, + }, + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ComplexService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ComplexService.ts.snap new file mode 100644 index 000000000..bf860d12f --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ComplexService.ts.snap @@ -0,0 +1,79 @@ +import type { ModelWithArray } from '../models/ModelWithArray'; +import type { ModelWithDictionary } from '../models/ModelWithDictionary'; +import type { ModelWithEnum } from '../models/ModelWithEnum'; +import type { ModelWithString } from '../models/ModelWithString'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataComplexTypes = { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; +}; +export type TDataComplexParams = { + id: number; + requestBody?: { + readonly key: string | null; + name: string | null; + enabled?: boolean; + readonly type: 'Monkey' | 'Horse' | 'Bird'; + listOfModels?: Array | null; + listOfStrings?: Array | null; + parameters: ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary; + readonly user?: { + readonly id?: number; + readonly name?: string | null; + }; + }; +}; + +export class ComplexService { + /** + * @returns ModelWithString Successful response + * @throws ApiError + */ + public static complexTypes(data: TDataComplexTypes): CancelablePromise> { + const { parameterObject, parameterReference } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/complex', + query: { + parameterObject, + parameterReference, + }, + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } + + /** + * @returns ModelWithString Success + * @throws ApiError + */ + public static complexParams(data: TDataComplexParams): CancelablePromise { + const { id, requestBody } = data; + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/complex/{id}', + path: { + id, + }, + body: requestBody, + mediaType: 'application/json-patch+json', + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DefaultService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DefaultService.ts.snap new file mode 100644 index 000000000..215cd809a --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DefaultService.ts.snap @@ -0,0 +1,37 @@ +import type { ModelWithArrayReadOnlyAndWriteOnly } from '../models/ModelWithArrayReadOnlyAndWriteOnly'; +import type { ModelWithReadOnlyAndWriteOnly } from '../models/ModelWithReadOnlyAndWriteOnly'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataPostServiceWithEmptyTag = { + requestBody: ModelWithReadOnlyAndWriteOnly | ModelWithArrayReadOnlyAndWriteOnly; +}; + +export class DefaultService { + /** + * @throws ApiError + */ + public static serviceWithEmptyTag(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-tag', + }); + } + + /** + * @returns ModelWithReadOnlyAndWriteOnly + * @throws ApiError + */ + public static postServiceWithEmptyTag( + data: TDataPostServiceWithEmptyTag + ): CancelablePromise { + const { requestBody } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/no-tag', + body: requestBody, + mediaType: 'application/json', + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DefaultsService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DefaultsService.ts.snap new file mode 100644 index 000000000..2113b1b5a --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DefaultsService.ts.snap @@ -0,0 +1,169 @@ +import type { ModelWithString } from '../models/ModelWithString'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataCallWithDefaultParameters = { + /** + * This is a simple boolean with default value + */ + parameterBoolean?: boolean | null; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: ModelWithString | null; + /** + * This is a simple number with default value + */ + parameterNumber?: number | null; + /** + * This is a simple string with default value + */ + parameterString?: string | null; +}; +export type TDataCallWithDefaultOptionalParameters = { + /** + * This is a simple boolean that is optional with default value + */ + parameterBoolean?: boolean; + /** + * This is a simple enum that is optional with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model that is optional with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number that is optional with default value + */ + parameterNumber?: number; + /** + * This is a simple string that is optional with default value + */ + parameterString?: string; +}; +export type TDataCallToTestOrderOfParams = { + /** + * This is a optional string with default + */ + parameterOptionalStringWithDefault?: string; + /** + * This is a optional string with empty default + */ + parameterOptionalStringWithEmptyDefault?: string; + /** + * This is a optional string with no default + */ + parameterOptionalStringWithNoDefault?: string; + /** + * This is a string that can be null with default + */ + parameterStringNullableWithDefault?: string | null; + /** + * This is a string that can be null with no default + */ + parameterStringNullableWithNoDefault?: string | null; + /** + * This is a string with default + */ + parameterStringWithDefault?: string; + /** + * This is a string with empty default + */ + parameterStringWithEmptyDefault?: string; + /** + * This is a string with no default + */ + parameterStringWithNoDefault: string; +}; + +export class DefaultsService { + /** + * @throws ApiError + */ + public static callWithDefaultParameters(data: TDataCallWithDefaultParameters = {}): CancelablePromise { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public static callWithDefaultOptionalParameters( + data: TDataCallWithDefaultOptionalParameters = {} + ): CancelablePromise { + const { + parameterBoolean = true, + parameterEnum = 'Success', + parameterModel = { + prop: 'Hello World!', + }, + parameterNumber = 123, + parameterString = 'Hello World!', + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/defaults', + query: { + parameterString, + parameterNumber, + parameterBoolean, + parameterEnum, + parameterModel, + }, + }); + } + + /** + * @throws ApiError + */ + public static callToTestOrderOfParams(data: TDataCallToTestOrderOfParams): CancelablePromise { + const { + parameterOptionalStringWithDefault = 'Hello World!', + parameterOptionalStringWithEmptyDefault = '', + parameterOptionalStringWithNoDefault, + parameterStringNullableWithDefault = null, + parameterStringNullableWithNoDefault, + parameterStringWithDefault = 'Hello World!', + parameterStringWithEmptyDefault = '', + parameterStringWithNoDefault, + } = data; + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/defaults', + query: { + parameterOptionalStringWithDefault, + parameterOptionalStringWithEmptyDefault, + parameterOptionalStringWithNoDefault, + parameterStringWithDefault, + parameterStringWithEmptyDefault, + parameterStringWithNoDefault, + parameterStringNullableWithNoDefault, + parameterStringNullableWithDefault, + }, + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DeprecatedService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DeprecatedService.ts.snap new file mode 100644 index 000000000..a7d7c8fde --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DeprecatedService.ts.snap @@ -0,0 +1,28 @@ +import type { DeprecatedModel } from '../models/DeprecatedModel'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataDeprecatedCall = { + /** + * This parameter is deprecated + */ + parameter: DeprecatedModel | null; +}; + +export class DeprecatedService { + /** + * @deprecated + * @throws ApiError + */ + public static deprecatedCall(data: TDataDeprecatedCall): CancelablePromise { + const { parameter } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/deprecated', + headers: { + parameter, + }, + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DescriptionsService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DescriptionsService.ts.snap new file mode 100644 index 000000000..4542a21a4 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DescriptionsService.ts.snap @@ -0,0 +1,61 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataCallWithDescriptions = { + /** + * Testing backticks in string: `backticks` and ```multiple backticks``` should work + */ + parameterWithBackticks?: unknown; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: unknown; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: unknown; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: unknown; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: unknown; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: unknown; +}; + +export class DescriptionsService { + /** + * @throws ApiError + */ + public static callWithDescriptions(data: TDataCallWithDescriptions = {}): CancelablePromise { + const { + parameterWithBackticks, + parameterWithBreaks, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + parameterWithSlashes, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/descriptions/', + query: { + parameterWithBreaks, + parameterWithBackticks, + parameterWithSlashes, + parameterWithExpressionPlaceholders, + parameterWithQuotes, + parameterWithReservedCharacters, + }, + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DuplicateService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DuplicateService.ts.snap new file mode 100644 index 000000000..7381aac77 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/DuplicateService.ts.snap @@ -0,0 +1,45 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class DuplicateService { + /** + * @throws ApiError + */ + public static duplicateName(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName1(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName2(): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/duplicate', + }); + } + + /** + * @throws ApiError + */ + public static duplicateName3(): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/duplicate', + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ErrorService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ErrorService.ts.snap new file mode 100644 index 000000000..751c848e3 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ErrorService.ts.snap @@ -0,0 +1,33 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataTestErrorCode = { + /** + * Status code to return + */ + status: number; +}; + +export class ErrorService { + /** + * @returns any Custom message: Successful response + * @throws ApiError + */ + public static testErrorCode(data: TDataTestErrorCode): CancelablePromise { + const { status } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/error', + query: { + status, + }, + errors: { + 500: `Custom message: Internal Server Error`, + 501: `Custom message: Not Implemented`, + 502: `Custom message: Bad Gateway`, + 503: `Custom message: Service Unavailable`, + }, + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/FileResponseService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/FileResponseService.ts.snap new file mode 100644 index 000000000..ca3412454 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/FileResponseService.ts.snap @@ -0,0 +1,24 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataFileResponse = { + id: string; +}; + +export class FileResponseService { + /** + * @returns binary Success + * @throws ApiError + */ + public static fileResponse(data: TDataFileResponse): CancelablePromise { + const { id } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/file/{id}', + path: { + id, + }, + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/FormDataService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/FormDataService.ts.snap new file mode 100644 index 000000000..eb022cee7 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/FormDataService.ts.snap @@ -0,0 +1,33 @@ +import type { ModelWithString } from '../models/ModelWithString'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataPostApiFormData = { + /** + * A reusable request body + */ + formData?: ModelWithString; + /** + * This is a reusable parameter + */ + parameter?: string; +}; + +export class FormDataService { + /** + * @throws ApiError + */ + public static postApiFormData(data: TDataPostApiFormData = {}): CancelablePromise { + const { formData, parameter } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/formData/', + query: { + parameter, + }, + formData: formData, + mediaType: 'multipart/form-data', + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/HeaderService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/HeaderService.ts.snap new file mode 100644 index 000000000..e451c3035 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/HeaderService.ts.snap @@ -0,0 +1,21 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class HeaderService { + /** + * @returns string Successful response + * @throws ApiError + */ + public static callWithResultFromHeader(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/header', + responseHeader: 'operation-location', + errors: { + 400: `400 server error`, + 500: `500 server error`, + }, + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipartService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipartService.ts.snap new file mode 100644 index 000000000..e261c7d1b --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipartService.ts.snap @@ -0,0 +1,43 @@ +import type { ModelWithString } from '../models/ModelWithString'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataMultipartRequest = { + formData?: { + content?: Blob; + data?: ModelWithString | null; + }; +}; + +export class MultipartService { + /** + * @throws ApiError + */ + public static multipartRequest(data: TDataMultipartRequest = {}): CancelablePromise { + const { formData } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/multipart', + formData: formData, + mediaType: 'multipart/form-data', + }); + } + + /** + * @returns any OK + * @throws ApiError + */ + public static multipartResponse(): CancelablePromise<{ + file?: Blob; + metadata?: { + foo?: string; + bar?: string; + }; + }> { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multipart', + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags1Service.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags1Service.ts.snap new file mode 100644 index 000000000..21cac6e19 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags1Service.ts.snap @@ -0,0 +1,27 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class MultipleTags1Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyA(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags2Service.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags2Service.ts.snap new file mode 100644 index 000000000..1c86961ad --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags2Service.ts.snap @@ -0,0 +1,27 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class MultipleTags2Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyA(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/a', + }); + } + + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags3Service.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags3Service.ts.snap new file mode 100644 index 000000000..15fc09d44 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/MultipleTags3Service.ts.snap @@ -0,0 +1,16 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class MultipleTags3Service { + /** + * @returns void Success + * @throws ApiError + */ + public static dummyB(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/b', + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/NoContentService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/NoContentService.ts.snap new file mode 100644 index 000000000..4af0ece57 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/NoContentService.ts.snap @@ -0,0 +1,28 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class NoContentService { + /** + * @returns void Success + * @throws ApiError + */ + public static callWithNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-content', + }); + } + + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public static callWithResponseAndNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } +} diff --git "a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" "b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" new file mode 100644 index 000000000..6f1531593 --- /dev/null +++ "b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.snap" @@ -0,0 +1,30 @@ +import type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from '../models/NonAsciiStringæøåÆØÅöôêÊ字符串'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataNonAsciiæøåÆøÅöôêÊ字符串 = { + /** + * Dummy input param + */ + nonAsciiParamæøåÆøÅöôêÊ: number; +}; + +export class NonAsciiÆøåÆøÅöôêÊService { + /** + * @returns NonAsciiStringæøåÆØÅöôêÊ字符串 Successful response + * @throws ApiError + */ + public static nonAsciiæøåÆøÅöôêÊ字符串( + data: TDataNonAsciiæøåÆøÅöôêÊ字符串 + ): CancelablePromise> { + const { nonAsciiParamæøåÆøÅöôêÊ } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', + query: { + nonAsciiParamæøåÆØÅöôêÊ: nonAsciiParamæøåÆøÅöôêÊ, + }, + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ParametersService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ParametersService.ts.snap new file mode 100644 index 000000000..4c52894ac --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ParametersService.ts.snap @@ -0,0 +1,233 @@ +import type { ModelWithNestedArrayEnumsDataFoo } from '../models/ModelWithNestedArrayEnumsDataFoo'; +import type { ModelWithOneOfEnum } from '../models/ModelWithOneOfEnum'; +import type { ModelWithString } from '../models/ModelWithString'; +import type { Pageable } from '../models/Pageable'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataDeleteFoo = { + /** + * bar in method + */ + bar: string; + /** + * foo in method + */ + foo: string; +}; +export type TDataCallWithParameters = { + fooAllOfEnum: ModelWithNestedArrayEnumsDataFoo; + fooRefEnum?: ModelWithNestedArrayEnumsDataFoo; + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath: string | null; + /** + * This is the parameter that goes into the query params + */ + parameterQuery: string | null; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; +}; +export type TDataCallWithWeirdParameterNames = { + /** + * This is the parameter with a reserved keyword + */ + _default?: string; + /** + * This is the parameter that goes into the cookie + */ + parameterCookie: string | null; + /** + * This is the parameter that goes into the request form data + */ + parameterForm: string | null; + /** + * This is the parameter that goes into the request header + */ + parameterHeader: string | null; + /** + * This is the parameter that goes into the path + */ + parameterPath1?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath2?: string; + /** + * This is the parameter that goes into the path + */ + parameterPath3?: string; + /** + * This is the parameter that goes into the request query params + */ + parameterQuery: string | null; + /** + * This is the parameter that goes into the body + */ + requestBody: ModelWithString | null; +}; +export type TDataGetCallWithOptionalParam = { + /** + * This is an optional parameter + */ + parameter?: string; + /** + * This is a required parameter + */ + requestBody: ModelWithOneOfEnum; +}; +export type TDataPostCallWithOptionalParam = { + /** + * This is a required parameter + */ + parameter: Pageable; + /** + * This is an optional parameter + */ + requestBody?: ModelWithString; +}; + +export class ParametersService { + /** + * @throws ApiError + */ + public static deleteFoo(data: TDataDeleteFoo): CancelablePromise { + const { bar, foo } = data; + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/foo/{foo}/bar/{bar}', + path: { + foo, + bar, + }, + }); + } + + /** + * @throws ApiError + */ + public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { + const { + fooAllOfEnum, + fooRefEnum, + parameterCookie, + parameterForm, + parameterHeader, + parameterPath, + parameterQuery, + requestBody, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameterPath}', + path: { + parameterPath, + }, + cookies: { + parameterCookie, + }, + headers: { + parameterHeader, + }, + query: { + foo_ref_enum: fooRefEnum, + foo_all_of_enum: fooAllOfEnum, + parameterQuery, + }, + formData: { + parameterForm, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { + const { + _default, + parameterCookie, + parameterForm, + parameterHeader, + parameterPath1, + parameterPath2, + parameterPath3, + parameterQuery, + requestBody, + } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', + path: { + 'parameter.path.1': parameterPath1, + 'parameter-path-2': parameterPath2, + 'PARAMETER-PATH-3': parameterPath3, + }, + cookies: { + 'PARAMETER-COOKIE': parameterCookie, + }, + headers: { + 'parameter.header': parameterHeader, + }, + query: { + default: _default, + 'parameter-query': parameterQuery, + }, + formData: { + parameter_form: parameterForm, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static getCallWithOptionalParam(data: TDataGetCallWithOptionalParam): CancelablePromise { + const { parameter, requestBody } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/parameters/', + query: { + parameter, + }, + body: requestBody, + mediaType: 'application/json', + }); + } + + /** + * @throws ApiError + */ + public static postCallWithOptionalParam(data: TDataPostCallWithOptionalParam): CancelablePromise { + const { parameter, requestBody } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/', + query: { + parameter, + }, + body: requestBody, + mediaType: 'application/json', + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/RequestBodyService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/RequestBodyService.ts.snap new file mode 100644 index 000000000..ebb601f3a --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/RequestBodyService.ts.snap @@ -0,0 +1,33 @@ +import type { ModelWithString } from '../models/ModelWithString'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataPostApiRequestBody = { + /** + * A reusable request body + */ + foo?: ModelWithString; + /** + * This is a reusable parameter + */ + parameter?: string; +}; + +export class RequestBodyService { + /** + * @throws ApiError + */ + public static postApiRequestBody(data: TDataPostApiRequestBody = {}): CancelablePromise { + const { foo, parameter } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/requestBody/', + query: { + parameter, + }, + body: foo, + mediaType: 'application/json', + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ResponseService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ResponseService.ts.snap new file mode 100644 index 000000000..438989ce7 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/ResponseService.ts.snap @@ -0,0 +1,75 @@ +import type { ModelThatExtends } from '../models/ModelThatExtends'; +import type { ModelThatExtendsExtends } from '../models/ModelThatExtendsExtends'; +import type { ModelWithString } from '../models/ModelWithString'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class ResponseService { + /** + * @returns number Response is a simple number + * @returns void Success + * @throws ApiError + */ + public static callWithResponseAndNoContentResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/multiple-tags/response-and-no-content', + }); + } + + /** + * @returns ModelWithString + * @throws ApiError + */ + public static callWithResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/response', + }); + } + + /** + * @returns ModelWithString Message for default response + * @throws ApiError + */ + public static callWithDuplicateResponses(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } + + /** + * @returns any Message for 200 response + * @returns ModelWithString Message for default response + * @returns ModelThatExtends Message for 201 response + * @returns ModelThatExtendsExtends Message for 202 response + * @throws ApiError + */ + public static callWithResponses(): CancelablePromise< + | { + readonly '@namespace.string'?: string; + readonly '@namespace.integer'?: number; + readonly value?: Array; + } + | ModelWithString + | ModelThatExtends + | ModelThatExtendsExtends + > { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/response', + errors: { + 500: `Message for 500 error`, + 501: `Message for 501 error`, + 502: `Message for 502 error`, + }, + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/SimpleService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/SimpleService.ts.snap new file mode 100644 index 000000000..733ff7439 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/SimpleService.ts.snap @@ -0,0 +1,75 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class SimpleService { + /** + * @throws ApiError + */ + public static getCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static putCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static postCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static deleteCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static optionsCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'OPTIONS', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static headCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'HEAD', + url: '/api/v{api-version}/simple', + }); + } + + /** + * @throws ApiError + */ + public static patchCallWithoutParametersAndResponse(): CancelablePromise { + return __request(OpenAPI, { + method: 'PATCH', + url: '/api/v{api-version}/simple', + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/TypesService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/TypesService.ts.snap new file mode 100644 index 000000000..992dac546 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/TypesService.ts.snap @@ -0,0 +1,76 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataTypes = { + /** + * This is a number parameter + */ + id?: number; + /** + * This is an array parameter + */ + parameterArray: Array | null; + /** + * This is a boolean parameter + */ + parameterBoolean?: boolean | null; + /** + * This is a dictionary parameter + */ + parameterDictionary: Record | null; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error' | null; + /** + * This is a number parameter + */ + parameterNumber?: number; + /** + * This is an object parameter + */ + parameterObject?: Record | null; + /** + * This is a string parameter + */ + parameterString?: string | null; +}; + +export class TypesService { + /** + * @returns number Response is a simple number + * @returns string Response is a simple string + * @returns boolean Response is a simple boolean + * @returns unknown Response is a simple object + * @throws ApiError + */ + public static types(data: TDataTypes): CancelablePromise> { + const { + id, + parameterArray, + parameterBoolean = true, + parameterDictionary, + parameterEnum, + parameterNumber = 123, + parameterObject = null, + parameterString = 'default', + } = data; + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/types', + path: { + id, + }, + query: { + parameterNumber, + parameterString, + parameterBoolean, + parameterObject, + parameterArray, + parameterDictionary, + parameterEnum, + }, + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/UploadService.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/UploadService.ts.snap new file mode 100644 index 000000000..f6da46b23 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/UploadService.ts.snap @@ -0,0 +1,27 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataUploadFile = { + /** + * Supply a file reference for upload + */ + file: Blob; +}; + +export class UploadService { + /** + * @returns boolean + * @throws ApiError + */ + public static uploadFile(data: TDataUploadFile): CancelablePromise { + const { file } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/upload', + formData: { + file, + }, + }); + } +} diff --git a/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/index.ts.snap b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/index.ts.snap new file mode 100644 index 000000000..3243a2fb1 --- /dev/null +++ b/test/__snapshots__/v3-legacy-enums/test/generated/v3_legacy_enums/services/index.ts.snap @@ -0,0 +1,23 @@ +export { CollectionFormatService } from './CollectionFormatService'; +export { ComplexService } from './ComplexService'; +export { DefaultService } from './DefaultService'; +export { DefaultsService } from './DefaultsService'; +export { DeprecatedService } from './DeprecatedService'; +export { DescriptionsService } from './DescriptionsService'; +export { DuplicateService } from './DuplicateService'; +export { ErrorService } from './ErrorService'; +export { FileResponseService } from './FileResponseService'; +export { FormDataService } from './FormDataService'; +export { HeaderService } from './HeaderService'; +export { MultipartService } from './MultipartService'; +export { MultipleTags1Service } from './MultipleTags1Service'; +export { MultipleTags2Service } from './MultipleTags2Service'; +export { MultipleTags3Service } from './MultipleTags3Service'; +export { NoContentService } from './NoContentService'; +export { NonAsciiÆøåÆøÅöôêÊService } from './NonAsciiÆøåÆøÅöôêÊService'; +export { ParametersService } from './ParametersService'; +export { RequestBodyService } from './RequestBodyService'; +export { ResponseService } from './ResponseService'; +export { SimpleService } from './SimpleService'; +export { TypesService } from './TypesService'; +export { UploadService } from './UploadService'; diff --git a/test/index.spec.ts b/test/index.spec.ts index 371f68d1e..5f6bfe109 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -106,4 +106,24 @@ describe('v3', () => { expect(content).toMatchFileSnapshot(`./__snapshots__/v3-client/${file}.snap`); }); }); + + it('should generate legacy enums', async () => { + await createClient({ + client: 'fetch', + enums: false, + exportCore: true, + exportModels: true, + exportSchemas: true, + exportServices: true, + input: './test/spec/v3.json', + output: './test/generated/v3_legacy_enums/', + useOptions: true, + useLegacyEnums: true, + }); + + sync('./test/generated/v3_legacy_enums/**/*.ts').forEach(file => { + const content = readFileSync(file, 'utf8').toString(); + expect(content).toMatchFileSnapshot(`./__snapshots__/v3-legacy-enums/${file}.snap`); + }); + }); });