From c368db16d926db96b8e95cf45a99c9147262880c Mon Sep 17 00:00:00 2001 From: Jordan Shatford Date: Sun, 24 Mar 2024 09:46:31 +1100 Subject: [PATCH] chore(tests): split snapshot file into smaller parts --- test/__snapshots__/index.spec.ts.snap | 8810 ----------------- .../test/generated/v2/core/ApiError.ts.snap | 21 + .../generated/v2/core/ApiError.ts.ts.snap | 21 + .../v2/core/ApiRequestOptions.ts.snap | 13 + .../v2/core/ApiRequestOptions.ts.ts.snap | 13 + .../test/generated/v2/core/ApiResult.ts.snap | 7 + .../generated/v2/core/ApiResult.ts.ts.snap | 7 + .../v2/core/CancelablePromise.ts.snap | 126 + .../v2/core/CancelablePromise.ts.ts.snap | 126 + .../v2/test/generated/v2/core/OpenAPI.ts.snap | 45 + .../test/generated/v2/core/OpenAPI.ts.ts.snap | 45 + .../v2/test/generated/v2/core/request.ts.snap | 314 + .../test/generated/v2/core/request.ts.ts.snap | 314 + .../v2/test/generated/v2/core/types.ts.snap | 10 + .../test/generated/v2/core/types.ts.ts.snap | 10 + .../v2/test/generated/v2/index.ts.snap | 126 + .../v2/test/generated/v2/index.ts.ts.snap | 126 + .../v2/models/ArrayWithArray.ts.snap | 6 + .../v2/models/ArrayWithArray.ts.ts.snap | 6 + .../v2/models/ArrayWithBooleans.ts.snap | 4 + .../v2/models/ArrayWithBooleans.ts.ts.snap | 4 + .../v2/models/ArrayWithNumbers.ts.snap | 4 + .../v2/models/ArrayWithNumbers.ts.ts.snap | 4 + .../v2/models/ArrayWithProperties.ts.snap | 7 + .../v2/models/ArrayWithProperties.ts.ts.snap | 7 + .../v2/models/ArrayWithReferences.ts.snap | 6 + .../v2/models/ArrayWithReferences.ts.ts.snap | 6 + .../v2/models/ArrayWithStrings.ts.snap | 4 + .../v2/models/ArrayWithStrings.ts.ts.snap | 4 + .../v2/models/CommentWithBackticks.ts.snap | 4 + .../v2/models/CommentWithBackticks.ts.ts.snap | 4 + .../v2/models/CommentWithBreaks.ts.snap | 7 + .../v2/models/CommentWithBreaks.ts.ts.snap | 7 + .../CommentWithExpressionPlaceholders.ts.snap | 4 + ...mmentWithExpressionPlaceholders.ts.ts.snap | 4 + .../v2/models/CommentWithQuotes.ts.snap | 4 + .../v2/models/CommentWithQuotes.ts.ts.snap | 4 + .../CommentWithReservedCharacters.ts.snap | 4 + .../CommentWithReservedCharacters.ts.ts.snap | 4 + .../v2/models/CommentWithSlashes.ts.snap | 4 + .../v2/models/CommentWithSlashes.ts.ts.snap | 4 + .../v2/test/generated/v2/models/Date.ts.snap | 4 + .../test/generated/v2/models/Date.ts.ts.snap | 4 + .../v2/models/DictionaryWithArray.ts.snap | 6 + .../v2/models/DictionaryWithArray.ts.ts.snap | 6 + .../models/DictionaryWithDictionary.ts.snap | 4 + .../DictionaryWithDictionary.ts.ts.snap | 4 + .../models/DictionaryWithProperties.ts.snap | 10 + .../DictionaryWithProperties.ts.ts.snap | 10 + .../v2/models/DictionaryWithReference.ts.snap | 6 + .../models/DictionaryWithReference.ts.ts.snap | 6 + .../v2/models/DictionaryWithString.ts.snap | 4 + .../v2/models/DictionaryWithString.ts.ts.snap | 4 + .../v2/models/EnumFromDescription.ts.snap | 4 + .../v2/models/EnumFromDescription.ts.ts.snap | 4 + .../v2/models/EnumWithExtensions.ts.snap | 19 + .../v2/models/EnumWithExtensions.ts.ts.snap | 19 + .../v2/models/EnumWithNumbers.ts.snap | 22 + .../v2/models/EnumWithNumbers.ts.ts.snap | 22 + .../v2/models/EnumWithStrings.ts.snap | 19 + .../v2/models/EnumWithStrings.ts.ts.snap | 19 + .../v2/models/ModelThatExtends.ts.snap | 9 + .../v2/models/ModelThatExtends.ts.ts.snap | 9 + .../v2/models/ModelThatExtendsExtends.ts.snap | 11 + .../models/ModelThatExtendsExtends.ts.ts.snap | 11 + .../v2/models/ModelWithArray.ts.snap | 10 + .../v2/models/ModelWithArray.ts.ts.snap | 10 + .../v2/models/ModelWithBoolean.ts.snap | 9 + .../v2/models/ModelWithBoolean.ts.ts.snap | 9 + .../models/ModelWithCircularReference.ts.snap | 6 + .../ModelWithCircularReference.ts.ts.snap | 6 + .../v2/models/ModelWithDictionary.ts.snap | 6 + .../v2/models/ModelWithDictionary.ts.ts.snap | 6 + .../models/ModelWithDuplicateImports.ts.snap | 10 + .../ModelWithDuplicateImports.ts.ts.snap | 10 + .../ModelWithDuplicateProperties.ts.snap | 8 + .../ModelWithDuplicateProperties.ts.ts.snap | 8 + .../generated/v2/models/ModelWithEnum.ts.snap | 33 + .../v2/models/ModelWithEnum.ts.ts.snap | 33 + .../ModelWithEnumFromDescription.ts.snap | 9 + .../ModelWithEnumFromDescription.ts.ts.snap | 9 + .../v2/models/ModelWithInteger.ts.snap | 9 + .../v2/models/ModelWithInteger.ts.ts.snap | 9 + .../v2/models/ModelWithNestedEnums.ts.snap | 9 + .../v2/models/ModelWithNestedEnums.ts.ts.snap | 9 + .../models/ModelWithNestedProperties.ts.snap | 10 + .../ModelWithNestedProperties.ts.ts.snap | 10 + .../v2/models/ModelWithNullableString.ts.snap | 13 + .../models/ModelWithNullableString.ts.ts.snap | 13 + .../models/ModelWithOrderedProperties.ts.snap | 8 + .../ModelWithOrderedProperties.ts.ts.snap | 8 + .../v2/models/ModelWithPattern.ts.snap | 14 + .../v2/models/ModelWithPattern.ts.ts.snap | 14 + .../v2/models/ModelWithProperties.ts.snap | 18 + .../v2/models/ModelWithProperties.ts.ts.snap | 18 + .../v2/models/ModelWithReference.ts.snap | 8 + .../v2/models/ModelWithReference.ts.ts.snap | 8 + .../v2/models/ModelWithString.ts.snap | 9 + .../v2/models/ModelWithString.ts.ts.snap | 9 + ...5\255\227\347\254\246\344\270\262.ts.snap" | 4 + ...55\227\347\254\246\344\270\262.ts.ts.snap" | 4 + .../generated/v2/models/SimpleBoolean.ts.snap | 4 + .../v2/models/SimpleBoolean.ts.ts.snap | 4 + .../generated/v2/models/SimpleFile.ts.snap | 4 + .../generated/v2/models/SimpleFile.ts.ts.snap | 4 + .../generated/v2/models/SimpleInteger.ts.snap | 4 + .../v2/models/SimpleInteger.ts.ts.snap | 4 + .../v2/models/SimpleReference.ts.snap | 6 + .../v2/models/SimpleReference.ts.ts.snap | 6 + .../generated/v2/models/SimpleString.ts.snap | 4 + .../v2/models/SimpleString.ts.ts.snap | 4 + .../v2/models/SimpleStringWithPattern.ts.snap | 4 + .../models/SimpleStringWithPattern.ts.ts.snap | 4 + .../test/generated/v2/models/_default.ts.snap | 3 + .../generated/v2/models/_default.ts.ts.snap | 3 + .../v2/schemas/$ArrayWithArray.ts.snap | 9 + .../v2/schemas/$ArrayWithArray.ts.ts.snap | 9 + .../v2/schemas/$ArrayWithBooleans.ts.snap | 6 + .../v2/schemas/$ArrayWithBooleans.ts.ts.snap | 6 + .../v2/schemas/$ArrayWithNumbers.ts.snap | 6 + .../v2/schemas/$ArrayWithNumbers.ts.ts.snap | 6 + .../v2/schemas/$ArrayWithProperties.ts.snap | 13 + .../schemas/$ArrayWithProperties.ts.ts.snap | 13 + .../v2/schemas/$ArrayWithReferences.ts.snap | 6 + .../schemas/$ArrayWithReferences.ts.ts.snap | 6 + .../v2/schemas/$ArrayWithStrings.ts.snap | 6 + .../v2/schemas/$ArrayWithStrings.ts.ts.snap | 6 + .../v2/schemas/$CommentWithBackticks.ts.snap | 4 + .../schemas/$CommentWithBackticks.ts.ts.snap | 4 + .../v2/schemas/$CommentWithBreaks.ts.snap | 7 + .../v2/schemas/$CommentWithBreaks.ts.ts.snap | 7 + ...$CommentWithExpressionPlaceholders.ts.snap | 4 + ...mmentWithExpressionPlaceholders.ts.ts.snap | 4 + .../v2/schemas/$CommentWithQuotes.ts.snap | 4 + .../v2/schemas/$CommentWithQuotes.ts.ts.snap | 4 + .../$CommentWithReservedCharacters.ts.snap | 4 + .../$CommentWithReservedCharacters.ts.ts.snap | 4 + .../v2/schemas/$CommentWithSlashes.ts.snap | 4 + .../v2/schemas/$CommentWithSlashes.ts.ts.snap | 4 + .../test/generated/v2/schemas/$Date.ts.snap | 4 + .../generated/v2/schemas/$Date.ts.ts.snap | 4 + .../v2/schemas/$DictionaryWithArray.ts.snap | 9 + .../schemas/$DictionaryWithArray.ts.ts.snap | 9 + .../schemas/$DictionaryWithDictionary.ts.snap | 9 + .../$DictionaryWithDictionary.ts.ts.snap | 9 + .../schemas/$DictionaryWithProperties.ts.snap | 13 + .../$DictionaryWithProperties.ts.ts.snap | 13 + .../schemas/$DictionaryWithReference.ts.snap | 6 + .../$DictionaryWithReference.ts.ts.snap | 6 + .../v2/schemas/$DictionaryWithString.ts.snap | 6 + .../schemas/$DictionaryWithString.ts.ts.snap | 6 + .../v2/schemas/$EnumFromDescription.ts.snap | 4 + .../schemas/$EnumFromDescription.ts.ts.snap | 4 + .../v2/schemas/$EnumWithExtensions.ts.snap | 3 + .../v2/schemas/$EnumWithExtensions.ts.ts.snap | 3 + .../v2/schemas/$EnumWithNumbers.ts.snap | 3 + .../v2/schemas/$EnumWithNumbers.ts.ts.snap | 3 + .../v2/schemas/$EnumWithStrings.ts.snap | 3 + .../v2/schemas/$EnumWithStrings.ts.ts.snap | 3 + .../v2/schemas/$ModelThatExtends.ts.snap | 19 + .../v2/schemas/$ModelThatExtends.ts.ts.snap | 19 + .../schemas/$ModelThatExtendsExtends.ts.snap | 22 + .../$ModelThatExtendsExtends.ts.ts.snap | 22 + .../v2/schemas/$ModelWithArray.ts.snap | 23 + .../v2/schemas/$ModelWithArray.ts.ts.snap | 23 + .../v2/schemas/$ModelWithBoolean.ts.snap | 9 + .../v2/schemas/$ModelWithBoolean.ts.ts.snap | 9 + .../$ModelWithCircularReference.ts.snap | 8 + .../$ModelWithCircularReference.ts.ts.snap | 8 + .../v2/schemas/$ModelWithDictionary.ts.snap | 11 + .../schemas/$ModelWithDictionary.ts.ts.snap | 11 + .../$ModelWithDuplicateImports.ts.snap | 14 + .../$ModelWithDuplicateImports.ts.ts.snap | 14 + .../$ModelWithDuplicateProperties.ts.snap | 8 + .../$ModelWithDuplicateProperties.ts.ts.snap | 8 + .../v2/schemas/$ModelWithEnum.ts.snap | 15 + .../v2/schemas/$ModelWithEnum.ts.ts.snap | 15 + .../$ModelWithEnumFromDescription.ts.snap | 9 + .../$ModelWithEnumFromDescription.ts.ts.snap | 9 + .../v2/schemas/$ModelWithInteger.ts.snap | 9 + .../v2/schemas/$ModelWithInteger.ts.ts.snap | 9 + .../v2/schemas/$ModelWithNestedEnums.ts.snap | 31 + .../schemas/$ModelWithNestedEnums.ts.ts.snap | 31 + .../$ModelWithNestedProperties.ts.snap | 22 + .../$ModelWithNestedProperties.ts.ts.snap | 22 + .../schemas/$ModelWithNullableString.ts.snap | 16 + .../$ModelWithNullableString.ts.ts.snap | 16 + .../$ModelWithOrderedProperties.ts.snap | 14 + .../$ModelWithOrderedProperties.ts.ts.snap | 14 + .../v2/schemas/$ModelWithPattern.ts.snap | 45 + .../v2/schemas/$ModelWithPattern.ts.ts.snap | 45 + .../v2/schemas/$ModelWithProperties.ts.snap | 43 + .../schemas/$ModelWithProperties.ts.ts.snap | 43 + .../v2/schemas/$ModelWithReference.ts.snap | 8 + .../v2/schemas/$ModelWithReference.ts.ts.snap | 8 + .../v2/schemas/$ModelWithString.ts.snap | 9 + .../v2/schemas/$ModelWithString.ts.ts.snap | 9 + ...5\255\227\347\254\246\344\270\262.ts.snap" | 4 + ...55\227\347\254\246\344\270\262.ts.ts.snap" | 4 + .../v2/schemas/$SimpleBoolean.ts.snap | 4 + .../v2/schemas/$SimpleBoolean.ts.ts.snap | 4 + .../generated/v2/schemas/$SimpleFile.ts.snap | 4 + .../v2/schemas/$SimpleFile.ts.ts.snap | 4 + .../v2/schemas/$SimpleInteger.ts.snap | 4 + .../v2/schemas/$SimpleInteger.ts.ts.snap | 4 + .../v2/schemas/$SimpleReference.ts.snap | 4 + .../v2/schemas/$SimpleReference.ts.ts.snap | 4 + .../v2/schemas/$SimpleString.ts.snap | 4 + .../v2/schemas/$SimpleString.ts.ts.snap | 4 + .../schemas/$SimpleStringWithPattern.ts.snap | 6 + .../$SimpleStringWithPattern.ts.ts.snap | 6 + .../generated/v2/schemas/$_default.ts.snap | 7 + .../generated/v2/schemas/$_default.ts.ts.snap | 7 + .../services/CollectionFormatService.ts.snap | 47 + .../CollectionFormatService.ts.ts.snap | 47 + .../v2/services/ComplexService.ts.snap | 43 + .../v2/services/ComplexService.ts.ts.snap | 43 + .../v2/services/DefaultService.ts.snap | 15 + .../v2/services/DefaultService.ts.ts.snap | 15 + .../v2/services/DefaultsService.ts.snap | 169 + .../v2/services/DefaultsService.ts.ts.snap | 169 + .../v2/services/DescriptionsService.ts.snap | 61 + .../services/DescriptionsService.ts.ts.snap | 61 + .../v2/services/DuplicateService.ts.snap | 45 + .../v2/services/DuplicateService.ts.ts.snap | 45 + .../v2/services/ErrorService.ts.snap | 33 + .../v2/services/ErrorService.ts.ts.snap | 33 + .../v2/services/HeaderService.ts.snap | 21 + .../v2/services/HeaderService.ts.ts.snap | 21 + .../v2/services/MultipleTags1Service.ts.snap | 27 + .../services/MultipleTags1Service.ts.ts.snap | 27 + .../v2/services/MultipleTags2Service.ts.snap | 27 + .../services/MultipleTags2Service.ts.ts.snap | 27 + .../v2/services/MultipleTags3Service.ts.snap | 16 + .../services/MultipleTags3Service.ts.ts.snap | 16 + .../v2/services/NoContentService.ts.snap | 28 + .../v2/services/NoContentService.ts.ts.snap | 28 + ...66\303\264\303\252\303\212Service.ts.snap" | 30 + ...303\264\303\252\303\212Service.ts.ts.snap" | 30 + .../v2/services/ParametersService.ts.snap | 122 + .../v2/services/ParametersService.ts.ts.snap | 122 + .../v2/services/ResponseService.ts.snap | 75 + .../v2/services/ResponseService.ts.ts.snap | 75 + .../v2/services/SimpleService.ts.snap | 75 + .../v2/services/SimpleService.ts.ts.snap | 75 + .../v2/services/TypesService.ts.snap | 76 + .../v2/services/TypesService.ts.ts.snap | 76 + .../test/generated/v3_date/index.ts.snap | 3 + .../test/generated/v3_date/index.ts.ts.snap | 3 + .../v3_date/models/ModelWithPattern.ts.snap | 14 + .../models/ModelWithPattern.ts.ts.snap | 14 + .../v3_date/schemas/$ModelWithPattern.ts.snap | 45 + .../schemas/$ModelWithPattern.ts.ts.snap | 45 + .../v3_options/core/ApiError.ts.snap | 21 + .../v3_options/core/ApiError.ts.ts.snap | 21 + .../v3_options/core/ApiRequestOptions.ts.snap | 13 + .../core/ApiRequestOptions.ts.ts.snap | 13 + .../v3_options/core/ApiResult.ts.snap | 7 + .../v3_options/core/ApiResult.ts.ts.snap | 7 + .../v3_options/core/CancelablePromise.ts.snap | 126 + .../core/CancelablePromise.ts.ts.snap | 126 + .../generated/v3_options/core/OpenAPI.ts.snap | 45 + .../v3_options/core/OpenAPI.ts.ts.snap | 45 + .../generated/v3_options/core/request.ts.snap | 314 + .../v3_options/core/request.ts.ts.snap | 314 + .../generated/v3_options/core/types.ts.snap | 10 + .../v3_options/core/types.ts.ts.snap | 10 + .../test/generated/v3_options/index.ts.snap | 8 + .../generated/v3_options/index.ts.ts.snap | 8 + .../v3_options/models/ModelWithString.ts.snap | 9 + .../models/ModelWithString.ts.ts.snap | 9 + .../services/DefaultsService.ts.snap | 169 + .../services/DefaultsService.ts.ts.snap | 169 + .../test/generated/v3/core/ApiError.ts.snap | 21 + .../generated/v3/core/ApiError.ts.ts.snap | 21 + .../v3/core/ApiRequestOptions.ts.snap | 13 + .../v3/core/ApiRequestOptions.ts.ts.snap | 13 + .../test/generated/v3/core/ApiResult.ts.snap | 7 + .../generated/v3/core/ApiResult.ts.ts.snap | 7 + .../v3/core/CancelablePromise.ts.snap | 126 + .../v3/core/CancelablePromise.ts.ts.snap | 126 + .../v3/test/generated/v3/core/OpenAPI.ts.snap | 45 + .../test/generated/v3/core/OpenAPI.ts.ts.snap | 45 + .../v3/test/generated/v3/core/request.ts.snap | 314 + .../test/generated/v3/core/request.ts.ts.snap | 314 + .../v3/test/generated/v3/core/types.ts.snap | 10 + .../test/generated/v3/core/types.ts.ts.snap | 10 + .../v3/test/generated/v3/index.ts.snap | 226 + .../v3/test/generated/v3/index.ts.ts.snap | 226 + .../v3/models/AnyOfAnyAndNull.ts.snap | 3 + .../v3/models/AnyOfAnyAndNull.ts.ts.snap | 3 + .../generated/v3/models/AnyOfArrays.ts.snap | 13 + .../v3/models/AnyOfArrays.ts.ts.snap | 13 + .../models/ArrayWithAnyOfProperties.ts.snap | 11 + .../ArrayWithAnyOfProperties.ts.ts.snap | 11 + .../v3/models/ArrayWithArray.ts.snap | 6 + .../v3/models/ArrayWithArray.ts.ts.snap | 6 + .../v3/models/ArrayWithBooleans.ts.snap | 4 + .../v3/models/ArrayWithBooleans.ts.ts.snap | 4 + .../v3/models/ArrayWithNumbers.ts.snap | 4 + .../v3/models/ArrayWithNumbers.ts.ts.snap | 4 + .../v3/models/ArrayWithProperties.ts.snap | 7 + .../v3/models/ArrayWithProperties.ts.ts.snap | 7 + .../v3/models/ArrayWithReferences.ts.snap | 6 + .../v3/models/ArrayWithReferences.ts.ts.snap | 6 + .../v3/models/ArrayWithStrings.ts.snap | 4 + .../v3/models/ArrayWithStrings.ts.ts.snap | 4 + .../v3/models/CommentWithBackticks.ts.snap | 4 + .../v3/models/CommentWithBackticks.ts.ts.snap | 4 + .../v3/models/CommentWithBreaks.ts.snap | 7 + .../v3/models/CommentWithBreaks.ts.ts.snap | 7 + .../CommentWithExpressionPlaceholders.ts.snap | 4 + ...mmentWithExpressionPlaceholders.ts.ts.snap | 4 + .../v3/models/CommentWithQuotes.ts.snap | 4 + .../v3/models/CommentWithQuotes.ts.ts.snap | 4 + .../CommentWithReservedCharacters.ts.snap | 4 + .../CommentWithReservedCharacters.ts.ts.snap | 4 + .../v3/models/CommentWithSlashes.ts.snap | 4 + .../v3/models/CommentWithSlashes.ts.ts.snap | 4 + .../v3/models/CompositionBaseModel.ts.snap | 7 + .../v3/models/CompositionBaseModel.ts.ts.snap | 7 + .../models/CompositionExtendedModel.ts.snap | 10 + .../CompositionExtendedModel.ts.ts.snap | 10 + .../CompositionWithAllOfAndNullable.ts.snap | 16 + ...CompositionWithAllOfAndNullable.ts.ts.snap | 16 + .../v3/models/CompositionWithAnyOf.ts.snap | 11 + .../v3/models/CompositionWithAnyOf.ts.ts.snap | 11 + .../CompositionWithAnyOfAndNullable.ts.snap | 17 + ...CompositionWithAnyOfAndNullable.ts.ts.snap | 17 + .../CompositionWithAnyOfAnonymous.ts.snap | 11 + .../CompositionWithAnyOfAnonymous.ts.ts.snap | 11 + ...ompositionWithNestedAnyAndTypeNull.ts.snap | 9 + ...ositionWithNestedAnyAndTypeNull.ts.ts.snap | 9 + .../CompositionWithNestedAnyOfAndNull.ts.snap | 9 + ...mpositionWithNestedAnyOfAndNull.ts.ts.snap | 9 + .../v3/models/CompositionWithOneOf.ts.snap | 11 + .../v3/models/CompositionWithOneOf.ts.ts.snap | 11 + ...WithOneOfAndComplexArrayDictionary.ts.snap | 6 + ...hOneOfAndComplexArrayDictionary.ts.ts.snap | 6 + .../CompositionWithOneOfAndNullable.ts.snap | 17 + ...CompositionWithOneOfAndNullable.ts.ts.snap | 17 + .../CompositionWithOneOfAndProperties.ts.snap | 14 + ...mpositionWithOneOfAndProperties.ts.ts.snap | 14 + ...nWithOneOfAndSimpleArrayDictionary.ts.snap | 6 + ...thOneOfAndSimpleArrayDictionary.ts.ts.snap | 6 + ...sitionWithOneOfAndSimpleDictionary.ts.snap | 6 + ...ionWithOneOfAndSimpleDictionary.ts.ts.snap | 6 + .../CompositionWithOneOfAnonymous.ts.snap | 11 + .../CompositionWithOneOfAnonymous.ts.ts.snap | 11 + .../CompositionWithOneOfDiscriminator.ts.snap | 7 + ...mpositionWithOneOfDiscriminator.ts.ts.snap | 7 + .../generated/v3/models/ConstValue.ts.snap | 1 + .../generated/v3/models/ConstValue.ts.ts.snap | 1 + .../v3/models/DeprecatedModel.ts.snap | 11 + .../v3/models/DeprecatedModel.ts.ts.snap | 11 + .../v3/models/DictionaryWithArray.ts.snap | 6 + .../v3/models/DictionaryWithArray.ts.ts.snap | 6 + .../models/DictionaryWithDictionary.ts.snap | 4 + .../DictionaryWithDictionary.ts.ts.snap | 4 + .../models/DictionaryWithProperties.ts.snap | 10 + .../DictionaryWithProperties.ts.ts.snap | 10 + .../v3/models/DictionaryWithReference.ts.snap | 6 + .../models/DictionaryWithReference.ts.ts.snap | 6 + .../v3/models/DictionaryWithString.ts.snap | 4 + .../v3/models/DictionaryWithString.ts.ts.snap | 4 + .../v3/test/generated/v3/models/Enum1.ts.snap | 6 + .../test/generated/v3/models/Enum1.ts.ts.snap | 6 + .../v3/models/EnumFromDescription.ts.snap | 4 + .../v3/models/EnumFromDescription.ts.ts.snap | 4 + .../v3/models/EnumWithExtensions.ts.snap | 19 + .../v3/models/EnumWithExtensions.ts.ts.snap | 19 + .../v3/models/EnumWithNumbers.ts.snap | 22 + .../v3/models/EnumWithNumbers.ts.ts.snap | 22 + .../models/EnumWithReplacedCharacters.ts.snap | 9 + .../EnumWithReplacedCharacters.ts.ts.snap | 9 + .../v3/models/EnumWithStrings.ts.snap | 19 + .../v3/models/EnumWithStrings.ts.ts.snap | 19 + .../v3/test/generated/v3/models/File.ts.snap | 7 + .../test/generated/v3/models/File.ts.ts.snap | 7 + ...hAdditionalPropertiesEqEmptyObject.ts.snap | 4 + ...ditionalPropertiesEqEmptyObject.ts.ts.snap | 4 + ...jectWithAdditionalPropertiesEqTrue.ts.snap | 4 + ...tWithAdditionalPropertiesEqTrue.ts.ts.snap | 4 + ...mObjectWithoutAdditionalProperties.ts.snap | 4 + ...jectWithoutAdditionalProperties.ts.ts.snap | 4 + .../generated/v3/models/ModelCircle.ts.snap | 7 + .../v3/models/ModelCircle.ts.ts.snap | 7 + .../generated/v3/models/ModelSquare.ts.snap | 7 + .../v3/models/ModelSquare.ts.ts.snap | 7 + .../v3/models/ModelThatExtends.ts.snap | 9 + .../v3/models/ModelThatExtends.ts.ts.snap | 9 + .../v3/models/ModelThatExtendsExtends.ts.snap | 11 + .../models/ModelThatExtendsExtends.ts.ts.snap | 11 + ...odelWithAdditionalPropertiesEqTrue.ts.snap | 10 + ...lWithAdditionalPropertiesEqTrue.ts.ts.snap | 10 + .../v3/models/ModelWithArray.ts.snap | 10 + .../v3/models/ModelWithArray.ts.ts.snap | 10 + ...ModelWithArrayReadOnlyAndWriteOnly.ts.snap | 10 + ...elWithArrayReadOnlyAndWriteOnly.ts.ts.snap | 10 + .../v3/models/ModelWithBoolean.ts.snap | 9 + .../v3/models/ModelWithBoolean.ts.ts.snap | 9 + .../models/ModelWithCircularReference.ts.snap | 6 + .../ModelWithCircularReference.ts.ts.snap | 6 + .../v3/models/ModelWithConst.ts.snap | 6 + .../v3/models/ModelWithConst.ts.ts.snap | 6 + .../v3/models/ModelWithDictionary.ts.snap | 6 + .../v3/models/ModelWithDictionary.ts.ts.snap | 6 + .../models/ModelWithDuplicateImports.ts.snap | 10 + .../ModelWithDuplicateImports.ts.ts.snap | 10 + .../ModelWithDuplicateProperties.ts.snap | 8 + .../ModelWithDuplicateProperties.ts.ts.snap | 8 + .../generated/v3/models/ModelWithEnum.ts.snap | 33 + .../v3/models/ModelWithEnum.ts.ts.snap | 33 + .../ModelWithEnumFromDescription.ts.snap | 9 + .../ModelWithEnumFromDescription.ts.ts.snap | 9 + .../v3/models/ModelWithEnumWithHyphen.ts.snap | 10 + .../models/ModelWithEnumWithHyphen.ts.ts.snap | 10 + .../v3/models/ModelWithInteger.ts.snap | 9 + .../v3/models/ModelWithInteger.ts.ts.snap | 9 + .../models/ModelWithNestedArrayEnums.ts.snap | 6 + .../ModelWithNestedArrayEnums.ts.ts.snap | 6 + .../ModelWithNestedArrayEnumsData.ts.snap | 7 + .../ModelWithNestedArrayEnumsData.ts.ts.snap | 7 + .../ModelWithNestedArrayEnumsDataBar.ts.snap | 6 + ...odelWithNestedArrayEnumsDataBar.ts.ts.snap | 6 + .../ModelWithNestedArrayEnumsDataFoo.ts.snap | 6 + ...odelWithNestedArrayEnumsDataFoo.ts.ts.snap | 6 + .../ModelWithNestedCompositionEnums.ts.snap | 5 + ...ModelWithNestedCompositionEnums.ts.ts.snap | 5 + .../v3/models/ModelWithNestedEnums.ts.snap | 9 + .../v3/models/ModelWithNestedEnums.ts.ts.snap | 9 + .../models/ModelWithNestedProperties.ts.snap | 10 + .../ModelWithNestedProperties.ts.ts.snap | 10 + .../v3/models/ModelWithNullableObject.ts.snap | 5 + .../models/ModelWithNullableObject.ts.ts.snap | 5 + .../v3/models/ModelWithNullableString.ts.snap | 21 + .../models/ModelWithNullableString.ts.ts.snap | 21 + .../v3/models/ModelWithOneOfEnum.ts.snap | 22 + .../v3/models/ModelWithOneOfEnum.ts.ts.snap | 22 + .../models/ModelWithOrderedProperties.ts.snap | 8 + .../ModelWithOrderedProperties.ts.ts.snap | 8 + .../v3/models/ModelWithPattern.ts.snap | 14 + .../v3/models/ModelWithPattern.ts.ts.snap | 14 + .../v3/models/ModelWithProperties.ts.snap | 19 + .../v3/models/ModelWithProperties.ts.ts.snap | 19 + .../ModelWithReadOnlyAndWriteOnly.ts.snap | 5 + .../ModelWithReadOnlyAndWriteOnly.ts.ts.snap | 5 + .../v3/models/ModelWithReference.ts.snap | 8 + .../v3/models/ModelWithReference.ts.ts.snap | 8 + .../v3/models/ModelWithString.ts.snap | 9 + .../v3/models/ModelWithString.ts.ts.snap | 9 + .../models/NestedAnyOfArraysNullable.ts.snap | 3 + .../NestedAnyOfArraysNullable.ts.ts.snap | 3 + ...5\255\227\347\254\246\344\270\262.ts.snap" | 4 + ...55\227\347\254\246\344\270\262.ts.ts.snap" | 4 + .../v3/models/NullableObject.ts.snap | 6 + .../v3/models/NullableObject.ts.ts.snap | 6 + .../test/generated/v3/models/Pageable.ts.snap | 5 + .../generated/v3/models/Pageable.ts.ts.snap | 5 + .../generated/v3/models/SimpleBoolean.ts.snap | 4 + .../v3/models/SimpleBoolean.ts.ts.snap | 4 + .../generated/v3/models/SimpleFile.ts.snap | 4 + .../generated/v3/models/SimpleFile.ts.ts.snap | 4 + .../generated/v3/models/SimpleInteger.ts.snap | 4 + .../v3/models/SimpleInteger.ts.ts.snap | 4 + .../v3/models/SimpleParameter.ts.snap | 4 + .../v3/models/SimpleParameter.ts.ts.snap | 4 + .../v3/models/SimpleReference.ts.snap | 6 + .../v3/models/SimpleReference.ts.ts.snap | 6 + .../generated/v3/models/SimpleString.ts.snap | 4 + .../v3/models/SimpleString.ts.ts.snap | 4 + .../v3/models/SimpleStringWithPattern.ts.snap | 4 + .../models/SimpleStringWithPattern.ts.ts.snap | 4 + .../test/generated/v3/models/_default.ts.snap | 3 + .../generated/v3/models/_default.ts.ts.snap | 3 + .../v3/schemas/$AnyOfAnyAndNull.ts.snap | 15 + .../v3/schemas/$AnyOfAnyAndNull.ts.ts.snap | 15 + .../generated/v3/schemas/$AnyOfArrays.ts.snap | 27 + .../v3/schemas/$AnyOfArrays.ts.ts.snap | 27 + .../schemas/$ArrayWithAnyOfProperties.ts.snap | 22 + .../$ArrayWithAnyOfProperties.ts.ts.snap | 22 + .../v3/schemas/$ArrayWithArray.ts.snap | 9 + .../v3/schemas/$ArrayWithArray.ts.ts.snap | 9 + .../v3/schemas/$ArrayWithBooleans.ts.snap | 6 + .../v3/schemas/$ArrayWithBooleans.ts.ts.snap | 6 + .../v3/schemas/$ArrayWithNumbers.ts.snap | 6 + .../v3/schemas/$ArrayWithNumbers.ts.ts.snap | 6 + .../v3/schemas/$ArrayWithProperties.ts.snap | 13 + .../schemas/$ArrayWithProperties.ts.ts.snap | 13 + .../v3/schemas/$ArrayWithReferences.ts.snap | 6 + .../schemas/$ArrayWithReferences.ts.ts.snap | 6 + .../v3/schemas/$ArrayWithStrings.ts.snap | 6 + .../v3/schemas/$ArrayWithStrings.ts.ts.snap | 6 + .../v3/schemas/$CommentWithBackticks.ts.snap | 4 + .../schemas/$CommentWithBackticks.ts.ts.snap | 4 + .../v3/schemas/$CommentWithBreaks.ts.snap | 7 + .../v3/schemas/$CommentWithBreaks.ts.ts.snap | 7 + ...$CommentWithExpressionPlaceholders.ts.snap | 4 + ...mmentWithExpressionPlaceholders.ts.ts.snap | 4 + .../v3/schemas/$CommentWithQuotes.ts.snap | 4 + .../v3/schemas/$CommentWithQuotes.ts.ts.snap | 4 + .../$CommentWithReservedCharacters.ts.snap | 4 + .../$CommentWithReservedCharacters.ts.ts.snap | 4 + .../v3/schemas/$CommentWithSlashes.ts.snap | 4 + .../v3/schemas/$CommentWithSlashes.ts.ts.snap | 4 + .../v3/schemas/$CompositionBaseModel.ts.snap | 11 + .../schemas/$CompositionBaseModel.ts.ts.snap | 11 + .../schemas/$CompositionExtendedModel.ts.snap | 25 + .../$CompositionExtendedModel.ts.ts.snap | 25 + .../$CompositionWithAllOfAndNullable.ts.snap | 27 + ...CompositionWithAllOfAndNullable.ts.ts.snap | 27 + .../v3/schemas/$CompositionWithAnyOf.ts.snap | 22 + .../schemas/$CompositionWithAnyOf.ts.ts.snap | 22 + .../$CompositionWithAnyOfAndNullable.ts.snap | 27 + ...CompositionWithAnyOfAndNullable.ts.ts.snap | 27 + .../$CompositionWithAnyOfAnonymous.ts.snap | 26 + .../$CompositionWithAnyOfAnonymous.ts.ts.snap | 26 + ...ompositionWithNestedAnyAndTypeNull.ts.snap | 38 + ...ositionWithNestedAnyAndTypeNull.ts.ts.snap | 38 + ...$CompositionWithNestedAnyOfAndNull.ts.snap | 27 + ...mpositionWithNestedAnyOfAndNull.ts.ts.snap | 27 + .../v3/schemas/$CompositionWithOneOf.ts.snap | 22 + .../schemas/$CompositionWithOneOf.ts.ts.snap | 22 + ...WithOneOfAndComplexArrayDictionary.ts.snap | 30 + ...hOneOfAndComplexArrayDictionary.ts.ts.snap | 30 + .../$CompositionWithOneOfAndNullable.ts.snap | 27 + ...CompositionWithOneOfAndNullable.ts.ts.snap | 27 + ...$CompositionWithOneOfAndProperties.ts.snap | 43 + ...mpositionWithOneOfAndProperties.ts.ts.snap | 43 + ...nWithOneOfAndSimpleArrayDictionary.ts.snap | 22 + ...thOneOfAndSimpleArrayDictionary.ts.ts.snap | 22 + ...sitionWithOneOfAndSimpleDictionary.ts.snap | 19 + ...ionWithOneOfAndSimpleDictionary.ts.ts.snap | 19 + .../$CompositionWithOneOfAnonymous.ts.snap | 26 + .../$CompositionWithOneOfAnonymous.ts.ts.snap | 26 + ...$CompositionWithOneOfDiscriminator.ts.snap | 12 + ...mpositionWithOneOfDiscriminator.ts.ts.snap | 12 + .../generated/v3/schemas/$ConstValue.ts.snap | 3 + .../v3/schemas/$ConstValue.ts.ts.snap | 3 + .../v3/schemas/$DeprecatedModel.ts.snap | 9 + .../v3/schemas/$DeprecatedModel.ts.ts.snap | 9 + .../v3/schemas/$DictionaryWithArray.ts.snap | 9 + .../schemas/$DictionaryWithArray.ts.ts.snap | 9 + .../schemas/$DictionaryWithDictionary.ts.snap | 9 + .../$DictionaryWithDictionary.ts.ts.snap | 9 + .../schemas/$DictionaryWithProperties.ts.snap | 13 + .../$DictionaryWithProperties.ts.ts.snap | 13 + .../schemas/$DictionaryWithReference.ts.snap | 6 + .../$DictionaryWithReference.ts.ts.snap | 6 + .../v3/schemas/$DictionaryWithString.ts.snap | 6 + .../schemas/$DictionaryWithString.ts.ts.snap | 6 + .../test/generated/v3/schemas/$Enum1.ts.snap | 3 + .../generated/v3/schemas/$Enum1.ts.ts.snap | 3 + .../v3/schemas/$EnumFromDescription.ts.snap | 4 + .../schemas/$EnumFromDescription.ts.ts.snap | 4 + .../v3/schemas/$EnumWithExtensions.ts.snap | 3 + .../v3/schemas/$EnumWithExtensions.ts.ts.snap | 3 + .../v3/schemas/$EnumWithNumbers.ts.snap | 3 + .../v3/schemas/$EnumWithNumbers.ts.ts.snap | 3 + .../$EnumWithReplacedCharacters.ts.snap | 3 + .../$EnumWithReplacedCharacters.ts.ts.snap | 3 + .../v3/schemas/$EnumWithStrings.ts.snap | 3 + .../v3/schemas/$EnumWithStrings.ts.ts.snap | 3 + .../test/generated/v3/schemas/$File.ts.snap | 30 + .../generated/v3/schemas/$File.ts.ts.snap | 30 + ...hAdditionalPropertiesEqEmptyObject.ts.snap | 6 + ...ditionalPropertiesEqEmptyObject.ts.ts.snap | 6 + ...jectWithAdditionalPropertiesEqTrue.ts.snap | 6 + ...tWithAdditionalPropertiesEqTrue.ts.ts.snap | 6 + ...mObjectWithoutAdditionalProperties.ts.snap | 6 + ...jectWithoutAdditionalProperties.ts.ts.snap | 6 + .../generated/v3/schemas/$ModelCircle.ts.snap | 12 + .../v3/schemas/$ModelCircle.ts.ts.snap | 12 + .../generated/v3/schemas/$ModelSquare.ts.snap | 12 + .../v3/schemas/$ModelSquare.ts.ts.snap | 12 + .../v3/schemas/$ModelThatExtends.ts.snap | 19 + .../v3/schemas/$ModelThatExtends.ts.ts.snap | 19 + .../schemas/$ModelThatExtendsExtends.ts.snap | 22 + .../$ModelThatExtendsExtends.ts.ts.snap | 22 + ...odelWithAdditionalPropertiesEqTrue.ts.snap | 9 + ...lWithAdditionalPropertiesEqTrue.ts.ts.snap | 9 + .../v3/schemas/$ModelWithArray.ts.snap | 23 + .../v3/schemas/$ModelWithArray.ts.ts.snap | 23 + ...ModelWithArrayReadOnlyAndWriteOnly.ts.snap | 23 + ...elWithArrayReadOnlyAndWriteOnly.ts.ts.snap | 23 + .../v3/schemas/$ModelWithBoolean.ts.snap | 9 + .../v3/schemas/$ModelWithBoolean.ts.ts.snap | 9 + .../$ModelWithCircularReference.ts.snap | 8 + .../$ModelWithCircularReference.ts.ts.snap | 8 + .../v3/schemas/$ModelWithConst.ts.snap | 16 + .../v3/schemas/$ModelWithConst.ts.ts.snap | 16 + .../v3/schemas/$ModelWithDictionary.ts.snap | 11 + .../schemas/$ModelWithDictionary.ts.ts.snap | 11 + .../$ModelWithDuplicateImports.ts.snap | 14 + .../$ModelWithDuplicateImports.ts.ts.snap | 14 + .../$ModelWithDuplicateProperties.ts.snap | 8 + .../$ModelWithDuplicateProperties.ts.ts.snap | 8 + .../v3/schemas/$ModelWithEnum.ts.snap | 15 + .../v3/schemas/$ModelWithEnum.ts.ts.snap | 15 + .../$ModelWithEnumFromDescription.ts.snap | 9 + .../$ModelWithEnumFromDescription.ts.ts.snap | 9 + .../schemas/$ModelWithEnumWithHyphen.ts.snap | 8 + .../$ModelWithEnumWithHyphen.ts.ts.snap | 8 + .../v3/schemas/$ModelWithInteger.ts.snap | 9 + .../v3/schemas/$ModelWithInteger.ts.ts.snap | 9 + .../$ModelWithNestedArrayEnums.ts.snap | 18 + .../$ModelWithNestedArrayEnums.ts.ts.snap | 18 + .../$ModelWithNestedArrayEnumsData.ts.snap | 16 + .../$ModelWithNestedArrayEnumsData.ts.ts.snap | 16 + .../$ModelWithNestedArrayEnumsDataBar.ts.snap | 3 + ...odelWithNestedArrayEnumsDataBar.ts.ts.snap | 3 + .../$ModelWithNestedArrayEnumsDataFoo.ts.snap | 3 + ...odelWithNestedArrayEnumsDataFoo.ts.ts.snap | 3 + .../$ModelWithNestedCompositionEnums.ts.snap | 12 + ...ModelWithNestedCompositionEnums.ts.ts.snap | 12 + .../v3/schemas/$ModelWithNestedEnums.ts.snap | 31 + .../schemas/$ModelWithNestedEnums.ts.ts.snap | 31 + .../$ModelWithNestedProperties.ts.snap | 25 + .../$ModelWithNestedProperties.ts.ts.snap | 25 + .../schemas/$ModelWithNullableObject.ts.snap | 7 + .../$ModelWithNullableObject.ts.ts.snap | 7 + .../schemas/$ModelWithNullableString.ts.snap | 27 + .../$ModelWithNullableString.ts.ts.snap | 27 + .../v3/schemas/$ModelWithOneOfEnum.ts.snap | 66 + .../v3/schemas/$ModelWithOneOfEnum.ts.ts.snap | 66 + .../$ModelWithOrderedProperties.ts.snap | 14 + .../$ModelWithOrderedProperties.ts.ts.snap | 14 + .../v3/schemas/$ModelWithPattern.ts.snap | 45 + .../v3/schemas/$ModelWithPattern.ts.ts.snap | 45 + .../v3/schemas/$ModelWithProperties.ts.snap | 48 + .../schemas/$ModelWithProperties.ts.ts.snap | 48 + .../$ModelWithReadOnlyAndWriteOnly.ts.snap | 17 + .../$ModelWithReadOnlyAndWriteOnly.ts.ts.snap | 17 + .../v3/schemas/$ModelWithReference.ts.snap | 8 + .../v3/schemas/$ModelWithReference.ts.ts.snap | 8 + .../v3/schemas/$ModelWithString.ts.snap | 9 + .../v3/schemas/$ModelWithString.ts.ts.snap | 9 + .../$NestedAnyOfArraysNullable.ts.snap | 26 + .../$NestedAnyOfArraysNullable.ts.ts.snap | 26 + ...5\255\227\347\254\246\344\270\262.ts.snap" | 4 + ...55\227\347\254\246\344\270\262.ts.ts.snap" | 4 + .../v3/schemas/$NullableObject.ts.snap | 9 + .../v3/schemas/$NullableObject.ts.ts.snap | 9 + .../generated/v3/schemas/$Pageable.ts.snap | 19 + .../generated/v3/schemas/$Pageable.ts.ts.snap | 19 + .../v3/schemas/$SimpleBoolean.ts.snap | 4 + .../v3/schemas/$SimpleBoolean.ts.ts.snap | 4 + .../generated/v3/schemas/$SimpleFile.ts.snap | 4 + .../v3/schemas/$SimpleFile.ts.ts.snap | 4 + .../v3/schemas/$SimpleInteger.ts.snap | 4 + .../v3/schemas/$SimpleInteger.ts.ts.snap | 4 + .../v3/schemas/$SimpleParameter.ts.snap | 4 + .../v3/schemas/$SimpleParameter.ts.ts.snap | 4 + .../v3/schemas/$SimpleReference.ts.snap | 4 + .../v3/schemas/$SimpleReference.ts.ts.snap | 4 + .../v3/schemas/$SimpleString.ts.snap | 4 + .../v3/schemas/$SimpleString.ts.ts.snap | 4 + .../schemas/$SimpleStringWithPattern.ts.snap | 7 + .../$SimpleStringWithPattern.ts.ts.snap | 7 + .../generated/v3/schemas/$_default.ts.snap | 7 + .../generated/v3/schemas/$_default.ts.ts.snap | 7 + .../services/CollectionFormatService.ts.snap | 47 + .../CollectionFormatService.ts.ts.snap | 47 + .../v3/services/ComplexService.ts.snap | 79 + .../v3/services/ComplexService.ts.ts.snap | 79 + .../v3/services/DefaultService.ts.snap | 37 + .../v3/services/DefaultService.ts.ts.snap | 37 + .../v3/services/DefaultsService.ts.snap | 169 + .../v3/services/DefaultsService.ts.ts.snap | 169 + .../v3/services/DeprecatedService.ts.snap | 28 + .../v3/services/DeprecatedService.ts.ts.snap | 28 + .../v3/services/DescriptionsService.ts.snap | 61 + .../services/DescriptionsService.ts.ts.snap | 61 + .../v3/services/DuplicateService.ts.snap | 45 + .../v3/services/DuplicateService.ts.ts.snap | 45 + .../v3/services/ErrorService.ts.snap | 33 + .../v3/services/ErrorService.ts.ts.snap | 33 + .../v3/services/FileResponseService.ts.snap | 24 + .../services/FileResponseService.ts.ts.snap | 24 + .../v3/services/FormDataService.ts.snap | 33 + .../v3/services/FormDataService.ts.ts.snap | 33 + .../v3/services/HeaderService.ts.snap | 21 + .../v3/services/HeaderService.ts.ts.snap | 21 + .../v3/services/MultipartService.ts.snap | 43 + .../v3/services/MultipartService.ts.ts.snap | 43 + .../v3/services/MultipleTags1Service.ts.snap | 27 + .../services/MultipleTags1Service.ts.ts.snap | 27 + .../v3/services/MultipleTags2Service.ts.snap | 27 + .../services/MultipleTags2Service.ts.ts.snap | 27 + .../v3/services/MultipleTags3Service.ts.snap | 16 + .../services/MultipleTags3Service.ts.ts.snap | 16 + .../v3/services/NoContentService.ts.snap | 28 + .../v3/services/NoContentService.ts.ts.snap | 28 + ...66\303\264\303\252\303\212Service.ts.snap" | 30 + ...303\264\303\252\303\212Service.ts.ts.snap" | 30 + .../v3/services/ParametersService.ts.snap | 233 + .../v3/services/ParametersService.ts.ts.snap | 233 + .../v3/services/RequestBodyService.ts.snap | 33 + .../v3/services/RequestBodyService.ts.ts.snap | 33 + .../v3/services/ResponseService.ts.snap | 75 + .../v3/services/ResponseService.ts.ts.snap | 75 + .../v3/services/SimpleService.ts.snap | 75 + .../v3/services/SimpleService.ts.ts.snap | 75 + .../v3/services/TypesService.ts.snap | 76 + .../v3/services/TypesService.ts.ts.snap | 76 + .../v3/services/UploadService.ts.snap | 27 + .../v3/services/UploadService.ts.ts.snap | 27 + test/index.spec.ts | 8 +- 708 files changed, 14798 insertions(+), 8814 deletions(-) delete mode 100644 test/__snapshots__/index.spec.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/ApiError.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/ApiError.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/ApiRequestOptions.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/ApiRequestOptions.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/ApiResult.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/ApiResult.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/CancelablePromise.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/CancelablePromise.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/OpenAPI.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/OpenAPI.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/request.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/request.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/types.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/core/types.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/index.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/index.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithArray.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithBooleans.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithBooleans.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithNumbers.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithNumbers.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithReferences.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithReferences.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithStrings.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ArrayWithStrings.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithBackticks.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithBackticks.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithBreaks.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithBreaks.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithExpressionPlaceholders.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithExpressionPlaceholders.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithQuotes.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithQuotes.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithReservedCharacters.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithReservedCharacters.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithSlashes.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/CommentWithSlashes.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/Date.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/Date.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/DictionaryWithArray.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/DictionaryWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/DictionaryWithDictionary.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/DictionaryWithDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/DictionaryWithProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/DictionaryWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/DictionaryWithReference.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/DictionaryWithReference.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/DictionaryWithString.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/DictionaryWithString.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/EnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/EnumFromDescription.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/EnumWithExtensions.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/EnumWithExtensions.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/EnumWithNumbers.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/EnumWithNumbers.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/EnumWithStrings.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/EnumWithStrings.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelThatExtends.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelThatExtends.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelThatExtendsExtends.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelThatExtendsExtends.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithArray.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithBoolean.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithBoolean.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithCircularReference.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithCircularReference.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithDictionary.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithDuplicateImports.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithDuplicateImports.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithDuplicateProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithDuplicateProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithEnum.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithEnum.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithEnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithEnumFromDescription.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithInteger.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithInteger.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithNestedEnums.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithNestedEnums.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithNestedProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithNestedProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithNullableString.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithNullableString.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithOrderedProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithOrderedProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithPattern.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithPattern.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithReference.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithReference.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithString.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/ModelWithString.ts.ts.snap create mode 100644 "test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/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.ts.snap" create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleBoolean.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleBoolean.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleFile.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleFile.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleInteger.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleInteger.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleReference.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleReference.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleString.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleString.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleStringWithPattern.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/SimpleStringWithPattern.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/_default.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/models/_default.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithArray.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithBooleans.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithBooleans.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithNumbers.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithNumbers.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithReferences.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithReferences.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithStrings.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithStrings.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithBackticks.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithBackticks.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithBreaks.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithBreaks.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithExpressionPlaceholders.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithExpressionPlaceholders.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithQuotes.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithQuotes.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithReservedCharacters.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithReservedCharacters.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithSlashes.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithSlashes.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$Date.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$Date.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithArray.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithDictionary.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithReference.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithReference.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithString.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithString.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$EnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$EnumFromDescription.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithExtensions.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithExtensions.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithNumbers.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithNumbers.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithStrings.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithStrings.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelThatExtends.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelThatExtends.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelThatExtendsExtends.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelThatExtendsExtends.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithArray.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithBoolean.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithBoolean.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithCircularReference.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithCircularReference.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDictionary.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDuplicateImports.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDuplicateImports.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDuplicateProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDuplicateProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithEnum.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithEnum.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithEnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithEnumFromDescription.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithInteger.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithInteger.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedEnums.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedEnums.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNullableString.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNullableString.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithOrderedProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithOrderedProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithPattern.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithPattern.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithProperties.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithReference.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithReference.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithString.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithString.ts.ts.snap create mode 100644 "test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/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.ts.snap" create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleBoolean.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleBoolean.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleFile.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleFile.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleInteger.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleInteger.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleReference.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleReference.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleString.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleString.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleStringWithPattern.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$SimpleStringWithPattern.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$_default.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/schemas/$_default.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/CollectionFormatService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/CollectionFormatService.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/ComplexService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/ComplexService.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/DefaultService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/DefaultService.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/DefaultsService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/DefaultsService.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/DescriptionsService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/DescriptionsService.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/DuplicateService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/DuplicateService.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/ErrorService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/ErrorService.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/HeaderService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/HeaderService.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/MultipleTags1Service.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/MultipleTags1Service.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/MultipleTags2Service.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/MultipleTags2Service.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/MultipleTags3Service.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/MultipleTags3Service.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/NoContentService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/NoContentService.ts.ts.snap create mode 100644 "test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.ts.snap" create mode 100644 test/__snapshots__/v2/test/generated/v2/services/ParametersService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/ParametersService.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/ResponseService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/ResponseService.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/SimpleService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/SimpleService.ts.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/TypesService.ts.snap create mode 100644 test/__snapshots__/v2/test/generated/v2/services/TypesService.ts.ts.snap create mode 100644 test/__snapshots__/v3-date/test/generated/v3_date/index.ts.snap create mode 100644 test/__snapshots__/v3-date/test/generated/v3_date/index.ts.ts.snap create mode 100644 test/__snapshots__/v3-date/test/generated/v3_date/models/ModelWithPattern.ts.snap create mode 100644 test/__snapshots__/v3-date/test/generated/v3_date/models/ModelWithPattern.ts.ts.snap create mode 100644 test/__snapshots__/v3-date/test/generated/v3_date/schemas/$ModelWithPattern.ts.snap create mode 100644 test/__snapshots__/v3-date/test/generated/v3_date/schemas/$ModelWithPattern.ts.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/ApiError.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/ApiError.ts.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/ApiRequestOptions.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/ApiRequestOptions.ts.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/ApiResult.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/ApiResult.ts.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/CancelablePromise.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/CancelablePromise.ts.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/OpenAPI.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/OpenAPI.ts.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/request.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/request.ts.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/types.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/core/types.ts.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/index.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/index.ts.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/models/ModelWithString.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/models/ModelWithString.ts.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/services/DefaultsService.ts.snap create mode 100644 test/__snapshots__/v3-options/test/generated/v3_options/services/DefaultsService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/ApiError.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/ApiError.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/ApiRequestOptions.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/ApiRequestOptions.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/ApiResult.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/ApiResult.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/CancelablePromise.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/CancelablePromise.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/OpenAPI.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/OpenAPI.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/request.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/request.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/types.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/core/types.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/index.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/index.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/AnyOfAnyAndNull.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/AnyOfAnyAndNull.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/AnyOfArrays.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/AnyOfArrays.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithAnyOfProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithAnyOfProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithArray.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithBooleans.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithBooleans.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithNumbers.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithNumbers.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithReferences.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithReferences.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithStrings.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ArrayWithStrings.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithBackticks.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithBackticks.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithBreaks.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithBreaks.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithExpressionPlaceholders.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithExpressionPlaceholders.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithQuotes.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithQuotes.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithReservedCharacters.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithReservedCharacters.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithSlashes.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CommentWithSlashes.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionBaseModel.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionBaseModel.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionExtendedModel.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionExtendedModel.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithAllOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithAllOfAndNullable.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOf.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOf.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOfAndNullable.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOfAnonymous.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOfAnonymous.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithNestedAnyAndTypeNull.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithNestedAnyAndTypeNull.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithNestedAnyOfAndNull.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithNestedAnyOfAndNull.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOf.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOf.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndComplexArrayDictionary.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndComplexArrayDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndNullable.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndSimpleArrayDictionary.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndSimpleArrayDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndSimpleDictionary.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndSimpleDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAnonymous.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAnonymous.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfDiscriminator.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfDiscriminator.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ConstValue.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ConstValue.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DeprecatedModel.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DeprecatedModel.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DictionaryWithArray.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DictionaryWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DictionaryWithDictionary.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DictionaryWithDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DictionaryWithProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DictionaryWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DictionaryWithReference.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DictionaryWithReference.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DictionaryWithString.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/DictionaryWithString.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/Enum1.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/Enum1.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/EnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/EnumFromDescription.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/EnumWithExtensions.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/EnumWithExtensions.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/EnumWithNumbers.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/EnumWithNumbers.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/EnumWithReplacedCharacters.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/EnumWithReplacedCharacters.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/EnumWithStrings.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/EnumWithStrings.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/File.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/File.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithoutAdditionalProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithoutAdditionalProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelCircle.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelCircle.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelSquare.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelSquare.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelThatExtends.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelThatExtends.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelThatExtendsExtends.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelThatExtendsExtends.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithAdditionalPropertiesEqTrue.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithAdditionalPropertiesEqTrue.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithArray.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithArrayReadOnlyAndWriteOnly.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithArrayReadOnlyAndWriteOnly.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithBoolean.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithBoolean.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithCircularReference.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithCircularReference.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithConst.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithConst.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithDictionary.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithDuplicateImports.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithDuplicateImports.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithDuplicateProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithDuplicateProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithEnum.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithEnum.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumFromDescription.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumWithHyphen.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumWithHyphen.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithInteger.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithInteger.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnums.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnums.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsData.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsData.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataBar.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataBar.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataFoo.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataFoo.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedCompositionEnums.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedCompositionEnums.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedEnums.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedEnums.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableObject.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableObject.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableString.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableString.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithOneOfEnum.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithOneOfEnum.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithOrderedProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithOrderedProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithPattern.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithPattern.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithReadOnlyAndWriteOnly.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithReadOnlyAndWriteOnly.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithReference.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithReference.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithString.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/ModelWithString.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/NestedAnyOfArraysNullable.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/NestedAnyOfArraysNullable.ts.ts.snap create mode 100644 "test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/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.ts.snap" create mode 100644 test/__snapshots__/v3/test/generated/v3/models/NullableObject.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/NullableObject.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/Pageable.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/Pageable.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleBoolean.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleBoolean.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleFile.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleFile.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleInteger.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleInteger.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleParameter.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleParameter.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleReference.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleReference.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleString.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleString.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleStringWithPattern.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/SimpleStringWithPattern.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/_default.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/models/_default.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$AnyOfAnyAndNull.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$AnyOfAnyAndNull.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$AnyOfArrays.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$AnyOfArrays.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithAnyOfProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithAnyOfProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithArray.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithBooleans.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithBooleans.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithNumbers.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithNumbers.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithReferences.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithReferences.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithStrings.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithStrings.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithBackticks.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithBackticks.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithBreaks.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithBreaks.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithExpressionPlaceholders.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithExpressionPlaceholders.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithQuotes.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithQuotes.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithReservedCharacters.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithReservedCharacters.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithSlashes.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithSlashes.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionBaseModel.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionBaseModel.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionExtendedModel.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionExtendedModel.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAllOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAllOfAndNullable.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOf.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOf.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOfAndNullable.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOfAnonymous.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOfAnonymous.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithNestedAnyAndTypeNull.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithNestedAnyAndTypeNull.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithNestedAnyOfAndNull.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithNestedAnyOfAndNull.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOf.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOf.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndNullable.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndNullable.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleDictionary.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAnonymous.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAnonymous.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfDiscriminator.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfDiscriminator.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ConstValue.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ConstValue.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DeprecatedModel.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DeprecatedModel.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithArray.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithDictionary.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithReference.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithReference.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithString.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithString.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$Enum1.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$Enum1.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$EnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$EnumFromDescription.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithExtensions.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithExtensions.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithNumbers.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithNumbers.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithReplacedCharacters.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithReplacedCharacters.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithStrings.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithStrings.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$File.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$File.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelCircle.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelCircle.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelSquare.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelSquare.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelThatExtends.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelThatExtends.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelThatExtendsExtends.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelThatExtendsExtends.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithAdditionalPropertiesEqTrue.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithAdditionalPropertiesEqTrue.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithArray.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithArray.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithBoolean.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithBoolean.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithCircularReference.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithCircularReference.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithConst.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithConst.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDictionary.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDictionary.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDuplicateImports.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDuplicateImports.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDuplicateProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDuplicateProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnum.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnum.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnumFromDescription.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnumFromDescription.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnumWithHyphen.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnumWithHyphen.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithInteger.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithInteger.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnums.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnums.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsData.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsData.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataBar.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataBar.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedCompositionEnums.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedCompositionEnums.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedEnums.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedEnums.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableObject.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableObject.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableString.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableString.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithOneOfEnum.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithOneOfEnum.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithOrderedProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithOrderedProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithPattern.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithPattern.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithProperties.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithProperties.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithReadOnlyAndWriteOnly.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithReadOnlyAndWriteOnly.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithReference.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithReference.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithString.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithString.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$NestedAnyOfArraysNullable.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$NestedAnyOfArraysNullable.ts.ts.snap create mode 100644 "test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/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.ts.snap" create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$NullableObject.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$NullableObject.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$Pageable.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$Pageable.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleBoolean.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleBoolean.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleFile.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleFile.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleInteger.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleInteger.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleParameter.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleParameter.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleReference.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleReference.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleString.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleString.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleStringWithPattern.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$SimpleStringWithPattern.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$_default.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/schemas/$_default.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/CollectionFormatService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/CollectionFormatService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/ComplexService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/ComplexService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/DefaultService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/DefaultService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/DefaultsService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/DefaultsService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/DeprecatedService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/DeprecatedService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/DescriptionsService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/DescriptionsService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/DuplicateService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/DuplicateService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/ErrorService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/ErrorService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/FileResponseService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/FileResponseService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/FormDataService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/FormDataService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/HeaderService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/HeaderService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/MultipartService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/MultipartService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/MultipleTags1Service.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/MultipleTags1Service.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/MultipleTags2Service.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/MultipleTags2Service.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/MultipleTags3Service.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/MultipleTags3Service.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/NoContentService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/NoContentService.ts.ts.snap create mode 100644 "test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.ts.snap" create mode 100644 test/__snapshots__/v3/test/generated/v3/services/ParametersService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/ParametersService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/RequestBodyService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/RequestBodyService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/ResponseService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/ResponseService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/SimpleService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/SimpleService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/TypesService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/TypesService.ts.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/UploadService.ts.snap create mode 100644 test/__snapshots__/v3/test/generated/v3/services/UploadService.ts.ts.snap diff --git a/test/__snapshots__/index.spec.ts.snap b/test/__snapshots__/index.spec.ts.snap deleted file mode 100644 index 6b0080423..000000000 --- a/test/__snapshots__/index.spec.ts.snap +++ /dev/null @@ -1,8810 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`v2 > should generate > ./test/generated/v2/core/ApiError.ts 1`] = ` -"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; - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/core/ApiRequestOptions.ts 1`] = ` -"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; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/core/ApiResult.ts 1`] = ` -"export type ApiResult = { - readonly body: TData; - readonly ok: boolean; - readonly status: number; - readonly statusText: string; - readonly url: string; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/core/CancelablePromise.ts 1`] = ` -"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; - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/core/OpenAPI.ts 1`] = ` -"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; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/core/request.ts 1`] = ` -"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); - } - }); -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/core/types.ts 1`] = ` -"import type { ApiResult } from './ApiResult'; - -export type TResult = 'body' | 'raw'; - -export type TApiResponse = - Exclude extends never ? ApiResult : ApiResult['body']; - -export type TConfig = { - _result?: T; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/index.ts 1`] = ` -"export { ApiError } from './core/ApiError'; -export { CancelablePromise, CancelError } from './core/CancelablePromise'; -export { OpenAPI } from './core/OpenAPI'; -export type { OpenAPIConfig } from './core/OpenAPI'; - -export type { _default } from './models/_default'; -export type { ArrayWithArray } from './models/ArrayWithArray'; -export type { ArrayWithBooleans } from './models/ArrayWithBooleans'; -export type { ArrayWithNumbers } from './models/ArrayWithNumbers'; -export type { ArrayWithProperties } from './models/ArrayWithProperties'; -export type { ArrayWithReferences } from './models/ArrayWithReferences'; -export type { ArrayWithStrings } from './models/ArrayWithStrings'; -export type { CommentWithBackticks } from './models/CommentWithBackticks'; -export type { CommentWithBreaks } from './models/CommentWithBreaks'; -export type { CommentWithExpressionPlaceholders } from './models/CommentWithExpressionPlaceholders'; -export type { CommentWithQuotes } from './models/CommentWithQuotes'; -export type { CommentWithReservedCharacters } from './models/CommentWithReservedCharacters'; -export type { CommentWithSlashes } from './models/CommentWithSlashes'; -export type { Date } from './models/Date'; -export type { DictionaryWithArray } from './models/DictionaryWithArray'; -export type { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; -export type { DictionaryWithProperties } from './models/DictionaryWithProperties'; -export type { DictionaryWithReference } from './models/DictionaryWithReference'; -export type { DictionaryWithString } from './models/DictionaryWithString'; -export type { EnumFromDescription } from './models/EnumFromDescription'; -export type { EnumWithExtensions } from './models/EnumWithExtensions'; -export { EnumWithExtensionsEnum } from './models/EnumWithExtensions'; -export type { EnumWithNumbers } from './models/EnumWithNumbers'; -export { EnumWithNumbersEnum } from './models/EnumWithNumbers'; -export type { EnumWithStrings } from './models/EnumWithStrings'; -export { EnumWithStringsEnum } from './models/EnumWithStrings'; -export type { ModelThatExtends } from './models/ModelThatExtends'; -export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; -export type { ModelWithArray } from './models/ModelWithArray'; -export type { ModelWithBoolean } from './models/ModelWithBoolean'; -export type { ModelWithCircularReference } from './models/ModelWithCircularReference'; -export type { ModelWithDictionary } from './models/ModelWithDictionary'; -export type { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; -export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; -export type { ModelWithEnum } from './models/ModelWithEnum'; -export { TestEnum, StatusCodeEnum } from './models/ModelWithEnum'; -export type { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; -export type { ModelWithInteger } from './models/ModelWithInteger'; -export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; -export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; -export type { ModelWithNullableString } from './models/ModelWithNullableString'; -export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; -export type { ModelWithPattern } from './models/ModelWithPattern'; -export type { ModelWithProperties } from './models/ModelWithProperties'; -export type { ModelWithReference } from './models/ModelWithReference'; -export type { ModelWithString } from './models/ModelWithString'; -export type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from './models/NonAsciiStringæøåÆØÅöôêÊ字符串'; -export type { SimpleBoolean } from './models/SimpleBoolean'; -export type { SimpleFile } from './models/SimpleFile'; -export type { SimpleInteger } from './models/SimpleInteger'; -export type { SimpleReference } from './models/SimpleReference'; -export type { SimpleString } from './models/SimpleString'; -export type { SimpleStringWithPattern } from './models/SimpleStringWithPattern'; - -export { $_default } from './schemas/$_default'; -export { $ArrayWithArray } from './schemas/$ArrayWithArray'; -export { $ArrayWithBooleans } from './schemas/$ArrayWithBooleans'; -export { $ArrayWithNumbers } from './schemas/$ArrayWithNumbers'; -export { $ArrayWithProperties } from './schemas/$ArrayWithProperties'; -export { $ArrayWithReferences } from './schemas/$ArrayWithReferences'; -export { $ArrayWithStrings } from './schemas/$ArrayWithStrings'; -export { $CommentWithBackticks } from './schemas/$CommentWithBackticks'; -export { $CommentWithBreaks } from './schemas/$CommentWithBreaks'; -export { $CommentWithExpressionPlaceholders } from './schemas/$CommentWithExpressionPlaceholders'; -export { $CommentWithQuotes } from './schemas/$CommentWithQuotes'; -export { $CommentWithReservedCharacters } from './schemas/$CommentWithReservedCharacters'; -export { $CommentWithSlashes } from './schemas/$CommentWithSlashes'; -export { $Date } from './schemas/$Date'; -export { $DictionaryWithArray } from './schemas/$DictionaryWithArray'; -export { $DictionaryWithDictionary } from './schemas/$DictionaryWithDictionary'; -export { $DictionaryWithProperties } from './schemas/$DictionaryWithProperties'; -export { $DictionaryWithReference } from './schemas/$DictionaryWithReference'; -export { $DictionaryWithString } from './schemas/$DictionaryWithString'; -export { $EnumFromDescription } from './schemas/$EnumFromDescription'; -export { $EnumWithExtensions } from './schemas/$EnumWithExtensions'; -export { $EnumWithNumbers } from './schemas/$EnumWithNumbers'; -export { $EnumWithStrings } from './schemas/$EnumWithStrings'; -export { $ModelThatExtends } from './schemas/$ModelThatExtends'; -export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends'; -export { $ModelWithArray } from './schemas/$ModelWithArray'; -export { $ModelWithBoolean } from './schemas/$ModelWithBoolean'; -export { $ModelWithCircularReference } from './schemas/$ModelWithCircularReference'; -export { $ModelWithDictionary } from './schemas/$ModelWithDictionary'; -export { $ModelWithDuplicateImports } from './schemas/$ModelWithDuplicateImports'; -export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProperties'; -export { $ModelWithEnum } from './schemas/$ModelWithEnum'; -export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription'; -export { $ModelWithInteger } from './schemas/$ModelWithInteger'; -export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums'; -export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties'; -export { $ModelWithNullableString } from './schemas/$ModelWithNullableString'; -export { $ModelWithOrderedProperties } from './schemas/$ModelWithOrderedProperties'; -export { $ModelWithPattern } from './schemas/$ModelWithPattern'; -export { $ModelWithProperties } from './schemas/$ModelWithProperties'; -export { $ModelWithReference } from './schemas/$ModelWithReference'; -export { $ModelWithString } from './schemas/$ModelWithString'; -export { $NonAsciiStringæøåÆØÅöôêÊ字符串 } from './schemas/$NonAsciiStringæøåÆØÅöôêÊ字符串'; -export { $SimpleBoolean } from './schemas/$SimpleBoolean'; -export { $SimpleFile } from './schemas/$SimpleFile'; -export { $SimpleInteger } from './schemas/$SimpleInteger'; -export { $SimpleReference } from './schemas/$SimpleReference'; -export { $SimpleString } from './schemas/$SimpleString'; -export { $SimpleStringWithPattern } from './schemas/$SimpleStringWithPattern'; - -export { CollectionFormatService } from './services/CollectionFormatService'; -export { ComplexService } from './services/ComplexService'; -export { DefaultService } from './services/DefaultService'; -export { DefaultsService } from './services/DefaultsService'; -export { DescriptionsService } from './services/DescriptionsService'; -export { DuplicateService } from './services/DuplicateService'; -export { ErrorService } from './services/ErrorService'; -export { HeaderService } from './services/HeaderService'; -export { MultipleTags1Service } from './services/MultipleTags1Service'; -export { MultipleTags2Service } from './services/MultipleTags2Service'; -export { MultipleTags3Service } from './services/MultipleTags3Service'; -export { NoContentService } from './services/NoContentService'; -export { NonAsciiÆøåÆøÅöôêÊService } from './services/NonAsciiÆøåÆøÅöôêÊService'; -export { ParametersService } from './services/ParametersService'; -export { ResponseService } from './services/ResponseService'; -export { SimpleService } from './services/SimpleService'; -export { TypesService } from './services/TypesService'; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/_default.ts 1`] = ` -"export type _default = { - name?: string; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ArrayWithArray.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a simple array containing an array - */ -export type ArrayWithArray = Array>; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ArrayWithBooleans.ts 1`] = ` -"/** - * This is a simple array with booleans - */ -export type ArrayWithBooleans = Array; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ArrayWithNumbers.ts 1`] = ` -"/** - * This is a simple array with numbers - */ -export type ArrayWithNumbers = Array; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ArrayWithProperties.ts 1`] = ` -"/** - * This is a simple array with properties - */ -export type ArrayWithProperties = Array<{ - foo?: string; - bar?: string; -}>; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ArrayWithReferences.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a simple array with references - */ -export type ArrayWithReferences = Array; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ArrayWithStrings.ts 1`] = ` -"/** - * This is a simple array with strings - */ -export type ArrayWithStrings = Array; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/CommentWithBackticks.ts 1`] = ` -"/** - * Testing backticks in string: \`backticks\` and \`\`\`multiple backticks\`\`\` should work - */ -export type CommentWithBackticks = number; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/CommentWithBreaks.ts 1`] = ` -"/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type CommentWithBreaks = number; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/CommentWithExpressionPlaceholders.ts 1`] = ` -"/** - * Testing expression placeholders in string: \${expression} should work - */ -export type CommentWithExpressionPlaceholders = number; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/CommentWithQuotes.ts 1`] = ` -"/** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ -export type CommentWithQuotes = number; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/CommentWithReservedCharacters.ts 1`] = ` -"/** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ -export type CommentWithReservedCharacters = number; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/CommentWithSlashes.ts 1`] = ` -"/** - * Testing slashes in string: \\backwards\\\\\\ and /forwards/// should work - */ -export type CommentWithSlashes = number; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/Date.ts 1`] = ` -"/** - * This is a type-only model that defines Date as a string - */ -export type Date = string; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/DictionaryWithArray.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a complex dictionary - */ -export type DictionaryWithArray = Record>; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/DictionaryWithDictionary.ts 1`] = ` -"/** - * This is a string dictionary - */ -export type DictionaryWithDictionary = Record>; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/DictionaryWithProperties.ts 1`] = ` -"/** - * This is a complex dictionary - */ -export type DictionaryWithProperties = Record< - string, - { - foo?: string; - bar?: string; - } ->; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/DictionaryWithReference.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a string reference - */ -export type DictionaryWithReference = Record; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/DictionaryWithString.ts 1`] = ` -"/** - * This is a string dictionary - */ -export type DictionaryWithString = Record; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/EnumFromDescription.ts 1`] = ` -"/** - * Success=1,Warning=2,Error=3 - */ -export type EnumFromDescription = number; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/EnumWithExtensions.ts 1`] = ` -"/** - * This is a simple enum with numbers - */ -export type EnumWithExtensions = 200 | 400 | 500; - -export const EnumWithExtensionsEnum = { - /** - * 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, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/EnumWithNumbers.ts 1`] = ` -"/** - * This is a simple enum with numbers - */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; - -export const EnumWithNumbersEnum = { - _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, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/EnumWithStrings.ts 1`] = ` -"/** - * This is a simple enum with strings - */ -export type EnumWithStrings = - | 'Success' - | 'Warning' - | 'Error' - | "'Single Quote'" - | '"Double Quotes"' - | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; - -export const EnumWithStringsEnum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串', -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelThatExtends.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model that extends another model - */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelThatExtendsExtends.ts 1`] = ` -"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; - }; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithArray.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array; - propWithNumber?: Array; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithBoolean.ts 1`] = ` -"/** - * This is a model with one boolean property - */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithCircularReference.ts 1`] = ` -"/** - * This is a model with one property containing a circular reference - */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithDictionary.ts 1`] = ` -"/** - * This is a model with one property containing a dictionary - */ -export type ModelWithDictionary = { - prop?: Record; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithDuplicateImports.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model with duplicated imports - */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithDuplicateProperties.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model with duplicated properties - */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithEnum.ts 1`] = ` -"/** - * 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; -}; - -export const TestEnum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串', -} as const; - -export const StatusCodeEnum = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar', -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithEnumFromDescription.ts 1`] = ` -"/** - * This is a model with one enum - */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithInteger.ts 1`] = ` -"/** - * This is a model with one number property - */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithNestedEnums.ts 1`] = ` -"/** - * This is a model with nested enums - */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: Record; - dictionaryWithEnumFromDescription?: Record; - arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; - arrayWithDescription?: Array; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithNestedProperties.ts 1`] = ` -"/** - * This is a model with one nested property - */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: string; - }; - }; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithNullableString.ts 1`] = ` -"/** - * This is a model with one string property - */ -export type ModelWithNullableString = { - /** - * This is a simple string property - */ - nullableProp?: string | null; - /** - * This is a simple string property - */ - nullableRequiredProp: string | null; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithOrderedProperties.ts 1`] = ` -"/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithPattern.ts 1`] = ` -"/** - * 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; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithProperties.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model with one nested property - */ -export type ModelWithProperties = { - required: string; - readonly requiredAndReadOnly: string; - string?: string; - number?: number; - boolean?: boolean; - reference?: ModelWithString; - 'property with space'?: string; - default?: string; - try?: string; - readonly '@namespace.string'?: string; - readonly '@namespace.integer'?: number; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithReference.ts 1`] = ` -"import type { ModelWithProperties } from './ModelWithProperties'; - -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/ModelWithString.ts 1`] = ` -"/** - * This is a model with one string property - */ -export type ModelWithString = { - /** - * This is a simple string property - */ - prop?: string; -}; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/NonAsciiStringæøåÆØÅöôêÊ字符串.ts 1`] = ` -"/** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/SimpleBoolean.ts 1`] = ` -"/** - * This is a simple boolean - */ -export type SimpleBoolean = boolean; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/SimpleFile.ts 1`] = ` -"/** - * This is a simple file - */ -export type SimpleFile = Blob; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/SimpleInteger.ts 1`] = ` -"/** - * This is a simple number - */ -export type SimpleInteger = number; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/SimpleReference.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a simple reference - */ -export type SimpleReference = ModelWithString; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/SimpleString.ts 1`] = ` -"/** - * This is a simple string - */ -export type SimpleString = string; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/models/SimpleStringWithPattern.ts 1`] = ` -"/** - * This is a simple string - */ -export type SimpleStringWithPattern = string; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$_default.ts 1`] = ` -"export const $_default = { - properties: { - name: { - type: 'string', - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ArrayWithArray.ts 1`] = ` -"export const $ArrayWithArray = { - type: 'array', - contains: { - type: 'array', - contains: { - type: 'ModelWithString', - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ArrayWithBooleans.ts 1`] = ` -"export const $ArrayWithBooleans = { - type: 'array', - contains: { - type: 'boolean', - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ArrayWithNumbers.ts 1`] = ` -"export const $ArrayWithNumbers = { - type: 'array', - contains: { - type: 'number', - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ArrayWithProperties.ts 1`] = ` -"export const $ArrayWithProperties = { - type: 'array', - contains: { - properties: { - foo: { - type: 'string', - }, - bar: { - type: 'string', - }, - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ArrayWithReferences.ts 1`] = ` -"export const $ArrayWithReferences = { - type: 'array', - contains: { - type: 'ModelWithString', - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ArrayWithStrings.ts 1`] = ` -"export const $ArrayWithStrings = { - type: 'array', - contains: { - type: 'string', - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$CommentWithBackticks.ts 1`] = ` -"export const $CommentWithBackticks = { - type: 'number', - description: \`Testing backticks in string: \\\`backticks\\\` and \\\`\\\`\\\`multiple backticks\\\`\\\`\\\` should work\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$CommentWithBreaks.ts 1`] = ` -"export const $CommentWithBreaks = { - type: 'number', - description: \`Testing multiline comments in string: First line -Second line - -Fourth line\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$CommentWithExpressionPlaceholders.ts 1`] = ` -"export const $CommentWithExpressionPlaceholders = { - type: 'number', - description: \`Testing expression placeholders in string: \\\${expression} should work\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$CommentWithQuotes.ts 1`] = ` -"export const $CommentWithQuotes = { - type: 'number', - description: \`Testing quotes in string: 'single quote''' and "double quotes""" should work\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$CommentWithReservedCharacters.ts 1`] = ` -"export const $CommentWithReservedCharacters = { - type: 'number', - description: \`Testing reserved characters in string: /* inline */ and /** inline **/ should work\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$CommentWithSlashes.ts 1`] = ` -"export const $CommentWithSlashes = { - type: 'number', - description: \`Testing slashes in string: \\\\backwards\\\\\\\\\\\\ and /forwards/// should work\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$Date.ts 1`] = ` -"export const $Date = { - type: 'string', - description: \`This is a type-only model that defines Date as a string\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$DictionaryWithArray.ts 1`] = ` -"export const $DictionaryWithArray = { - type: 'dictionary', - contains: { - type: 'array', - contains: { - type: 'ModelWithString', - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$DictionaryWithDictionary.ts 1`] = ` -"export const $DictionaryWithDictionary = { - type: 'dictionary', - contains: { - type: 'dictionary', - contains: { - type: 'string', - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$DictionaryWithProperties.ts 1`] = ` -"export const $DictionaryWithProperties = { - type: 'dictionary', - contains: { - properties: { - foo: { - type: 'string', - }, - bar: { - type: 'string', - }, - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$DictionaryWithReference.ts 1`] = ` -"export const $DictionaryWithReference = { - type: 'dictionary', - contains: { - type: 'ModelWithString', - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$DictionaryWithString.ts 1`] = ` -"export const $DictionaryWithString = { - type: 'dictionary', - contains: { - type: 'string', - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$EnumFromDescription.ts 1`] = ` -"export const $EnumFromDescription = { - type: 'number', - description: \`Success=1,Warning=2,Error=3\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$EnumWithExtensions.ts 1`] = ` -"export const $EnumWithExtensions = { - type: 'Enum', -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$EnumWithNumbers.ts 1`] = ` -"export const $EnumWithNumbers = { - type: 'Enum', -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$EnumWithStrings.ts 1`] = ` -"export const $EnumWithStrings = { - type: 'Enum', -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelThatExtends.ts 1`] = ` -"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; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelThatExtendsExtends.ts 1`] = ` -"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; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithArray.ts 1`] = ` -"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; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithBoolean.ts 1`] = ` -"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; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithCircularReference.ts 1`] = ` -"export const $ModelWithCircularReference = { - description: \`This is a model with one property containing a circular reference\`, - properties: { - prop: { - type: 'ModelWithCircularReference', - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithDictionary.ts 1`] = ` -"export const $ModelWithDictionary = { - description: \`This is a model with one property containing a dictionary\`, - properties: { - prop: { - type: 'dictionary', - contains: { - type: 'string', - }, - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithDuplicateImports.ts 1`] = ` -"export const $ModelWithDuplicateImports = { - description: \`This is a model with duplicated imports\`, - properties: { - propA: { - type: 'ModelWithString', - }, - propB: { - type: 'ModelWithString', - }, - propC: { - type: 'ModelWithString', - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithDuplicateProperties.ts 1`] = ` -"export const $ModelWithDuplicateProperties = { - description: \`This is a model with duplicated properties\`, - properties: { - prop: { - type: 'ModelWithString', - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithEnum.ts 1`] = ` -"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; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithEnumFromDescription.ts 1`] = ` -"export const $ModelWithEnumFromDescription = { - description: \`This is a model with one enum\`, - properties: { - test: { - type: 'number', - description: \`Success=1,Warning=2,Error=3\`, - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithInteger.ts 1`] = ` -"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; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithNestedEnums.ts 1`] = ` -"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; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithNestedProperties.ts 1`] = ` -"export const $ModelWithNestedProperties = { - description: \`This is a model with one nested property\`, - properties: { - first: { - properties: { - second: { - properties: { - third: { - type: 'string', - isReadOnly: true, - isRequired: true, - }, - }, - isReadOnly: true, - isRequired: true, - }, - }, - isReadOnly: true, - isRequired: true, - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithNullableString.ts 1`] = ` -"export const $ModelWithNullableString = { - description: \`This is a model with one string property\`, - properties: { - nullableProp: { - type: 'string', - description: \`This is a simple string property\`, - isNullable: true, - }, - nullableRequiredProp: { - type: 'string', - description: \`This is a simple string property\`, - isRequired: true, - isNullable: true, - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithOrderedProperties.ts 1`] = ` -"export const $ModelWithOrderedProperties = { - description: \`This is a model with ordered properties\`, - properties: { - zebra: { - type: 'string', - }, - apple: { - type: 'string', - }, - hawaii: { - type: 'string', - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithPattern.ts 1`] = ` -"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; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithProperties.ts 1`] = ` -"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, - }, - 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; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithReference.ts 1`] = ` -"export const $ModelWithReference = { - description: \`This is a model with one property containing a reference\`, - properties: { - prop: { - type: 'ModelWithProperties', - }, - }, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$ModelWithString.ts 1`] = ` -"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; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$NonAsciiStringæøåÆØÅöôêÊ字符串.ts 1`] = ` -"export const $NonAsciiStringæøåÆØÅöôêÊ字符串 = { - type: 'string', - description: \`A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串)\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$SimpleBoolean.ts 1`] = ` -"export const $SimpleBoolean = { - type: 'boolean', - description: \`This is a simple boolean\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$SimpleFile.ts 1`] = ` -"export const $SimpleFile = { - type: 'binary', - description: \`This is a simple file\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$SimpleInteger.ts 1`] = ` -"export const $SimpleInteger = { - type: 'number', - description: \`This is a simple number\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$SimpleReference.ts 1`] = ` -"export const $SimpleReference = { - type: 'ModelWithString', - description: \`This is a simple reference\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$SimpleString.ts 1`] = ` -"export const $SimpleString = { - type: 'string', - description: \`This is a simple string\`, -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/schemas/$SimpleStringWithPattern.ts 1`] = ` -"export const $SimpleStringWithPattern = { - type: 'string', - description: \`This is a simple string\`, - maxLength: 64, - pattern: '^[a-zA-Z0-9_]*$', -} as const; -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/CollectionFormatService.ts 1`] = ` -"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; - /** - * This is an array parameter that is sent as multi format (multiple parameter instances) - */ - parameterArrayMulti: Array; - /** - * This is an array parameter that is sent as pipes format (pipe-separated values) - */ - parameterArrayPipes: Array; - /** - * This is an array parameter that is sent as ssv format (space-separated values) - */ - parameterArraySsv: Array; - /** - * This is an array parameter that is sent as tsv format (tab-separated values) - */ - parameterArrayTsv: Array; -}; - -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, - }, - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/ComplexService.ts 1`] = ` -"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 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\`, - }, - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/DefaultService.ts 1`] = ` -"import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class DefaultService { - /** - * @throws ApiError - */ - public static serviceWithEmptyTag(): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v{api-version}/no-tag', - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/DefaultsService.ts 1`] = ` -"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; - /** - * This is a simple enum with default value - */ - parameterEnum?: 'Success' | 'Warning' | 'Error'; - /** - * This is a simple model with default value - */ - parameterModel?: ModelWithString; - /** - * This is a simple number with default value - */ - parameterNumber?: number; - /** - * This is a simple string with default value - */ - parameterString?: string; -}; -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, - }, - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/DescriptionsService.ts 1`] = ` -"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?: string; - /** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ - parameterWithBreaks?: string; - /** - * Testing expression placeholders in string: \${expression} should work - */ - parameterWithExpressionPlaceholders?: string; - /** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ - parameterWithQuotes?: string; - /** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ - parameterWithReservedCharacters?: string; - /** - * Testing slashes in string: \\backwards\\\\\\ and /forwards/// should work - */ - parameterWithSlashes?: string; -}; - -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, - }, - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/DuplicateService.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/ErrorService.ts 1`] = ` -"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: string; -}; - -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\`, - }, - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/HeaderService.ts 1`] = ` -"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\`, - }, - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/MultipleTags1Service.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/MultipleTags2Service.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/MultipleTags3Service.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/NoContentService.ts 1`] = ` -"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 any 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', - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/NonAsciiÆøåÆøÅöôêÊService.ts 1`] = ` -"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æøåÆøÅöôêÊ, - }, - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/ParametersService.ts 1`] = ` -"import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export type TDataCallWithParameters = { - /** - * This is the parameter that is sent as request body - */ - parameterBody: string; - /** - * This is the parameter that goes into the form data - */ - parameterForm: string; - /** - * This is the parameter that goes into the header - */ - parameterHeader: string; - /** - * This is the parameter that goes into the path - */ - parameterPath: string; - /** - * This is the parameter that goes into the query params - */ - parameterQuery: string; -}; -export type TDataCallWithWeirdParameterNames = { - /** - * This is the parameter with a reserved keyword - */ - _default?: string; - /** - * This is the parameter that is sent as request body - */ - parameterBody: string; - /** - * This is the parameter that goes into the request form data - */ - parameterForm: string; - /** - * This is the parameter that goes into the request header - */ - parameterHeader: string; - /** - * 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; -}; - -export class ParametersService { - /** - * @throws ApiError - */ - public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { - const { parameterBody, parameterForm, parameterHeader, parameterPath, parameterQuery } = data; - return __request(OpenAPI, { - method: 'POST', - url: '/api/v{api-version}/parameters/{parameterPath}', - path: { - parameterPath, - }, - headers: { - parameterHeader, - }, - query: { - parameterQuery, - }, - formData: { - parameterForm, - }, - body: parameterBody, - }); - } - - /** - * @throws ApiError - */ - public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { - const { - _default, - parameterBody, - parameterForm, - parameterHeader, - parameterPath1, - parameterPath2, - parameterPath3, - parameterQuery, - } = 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, - }, - headers: { - 'parameter.header': parameterHeader, - }, - query: { - default: _default, - 'parameter-query': parameterQuery, - }, - formData: { - parameter_form: parameterForm, - }, - body: parameterBody, - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/ResponseService.ts 1`] = ` -"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 any 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 Message for default response - * @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\`, - }, - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/SimpleService.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v2 > should generate > ./test/generated/v2/services/TypesService.ts 1`] = ` -"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; - /** - * This is a boolean parameter - */ - parameterBoolean?: boolean; - /** - * This is a dictionary parameter - */ - parameterDictionary: Record; - /** - * This is an enum parameter - */ - parameterEnum: 'Success' | 'Warning' | 'Error'; - /** - * This is a number parameter - */ - parameterNumber?: number; - /** - * This is an object parameter - */ - parameterObject?: unknown; - /** - * This is a string parameter - */ - parameterString?: string; -}; - -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 any 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, - }, - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/core/ApiError.ts 1`] = ` -"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; - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/core/ApiRequestOptions.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/core/ApiResult.ts 1`] = ` -"export type ApiResult = { - readonly body: TData; - readonly ok: boolean; - readonly status: number; - readonly statusText: string; - readonly url: string; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/core/CancelablePromise.ts 1`] = ` -"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; - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/core/OpenAPI.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/core/request.ts 1`] = ` -"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); - } - }); -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/core/types.ts 1`] = ` -"import type { ApiResult } from './ApiResult'; - -export type TResult = 'body' | 'raw'; - -export type TApiResponse = - Exclude extends never ? ApiResult : ApiResult['body']; - -export type TConfig = { - _result?: T; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/index.ts 1`] = ` -"export { ApiError } from './core/ApiError'; -export { CancelablePromise, CancelError } from './core/CancelablePromise'; -export { OpenAPI } from './core/OpenAPI'; -export type { OpenAPIConfig } from './core/OpenAPI'; - -export type { _default } from './models/_default'; -export type { AnyOfAnyAndNull } from './models/AnyOfAnyAndNull'; -export type { AnyOfArrays } from './models/AnyOfArrays'; -export type { ArrayWithAnyOfProperties } from './models/ArrayWithAnyOfProperties'; -export type { ArrayWithArray } from './models/ArrayWithArray'; -export type { ArrayWithBooleans } from './models/ArrayWithBooleans'; -export type { ArrayWithNumbers } from './models/ArrayWithNumbers'; -export type { ArrayWithProperties } from './models/ArrayWithProperties'; -export type { ArrayWithReferences } from './models/ArrayWithReferences'; -export type { ArrayWithStrings } from './models/ArrayWithStrings'; -export type { CommentWithBackticks } from './models/CommentWithBackticks'; -export type { CommentWithBreaks } from './models/CommentWithBreaks'; -export type { CommentWithExpressionPlaceholders } from './models/CommentWithExpressionPlaceholders'; -export type { CommentWithQuotes } from './models/CommentWithQuotes'; -export type { CommentWithReservedCharacters } from './models/CommentWithReservedCharacters'; -export type { CommentWithSlashes } from './models/CommentWithSlashes'; -export type { CompositionBaseModel } from './models/CompositionBaseModel'; -export type { CompositionExtendedModel } from './models/CompositionExtendedModel'; -export type { CompositionWithAllOfAndNullable } from './models/CompositionWithAllOfAndNullable'; -export type { CompositionWithAnyOf } from './models/CompositionWithAnyOf'; -export type { CompositionWithAnyOfAndNullable } from './models/CompositionWithAnyOfAndNullable'; -export type { CompositionWithAnyOfAnonymous } from './models/CompositionWithAnyOfAnonymous'; -export type { CompositionWithNestedAnyAndTypeNull } from './models/CompositionWithNestedAnyAndTypeNull'; -export type { CompositionWithNestedAnyOfAndNull } from './models/CompositionWithNestedAnyOfAndNull'; -export type { CompositionWithOneOf } from './models/CompositionWithOneOf'; -export type { CompositionWithOneOfAndComplexArrayDictionary } from './models/CompositionWithOneOfAndComplexArrayDictionary'; -export type { CompositionWithOneOfAndNullable } from './models/CompositionWithOneOfAndNullable'; -export type { CompositionWithOneOfAndProperties } from './models/CompositionWithOneOfAndProperties'; -export type { CompositionWithOneOfAndSimpleArrayDictionary } from './models/CompositionWithOneOfAndSimpleArrayDictionary'; -export type { CompositionWithOneOfAndSimpleDictionary } from './models/CompositionWithOneOfAndSimpleDictionary'; -export type { CompositionWithOneOfAnonymous } from './models/CompositionWithOneOfAnonymous'; -export type { CompositionWithOneOfDiscriminator } from './models/CompositionWithOneOfDiscriminator'; -export type { ConstValue } from './models/ConstValue'; -export type { DeprecatedModel } from './models/DeprecatedModel'; -export type { DictionaryWithArray } from './models/DictionaryWithArray'; -export type { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; -export type { DictionaryWithProperties } from './models/DictionaryWithProperties'; -export type { DictionaryWithReference } from './models/DictionaryWithReference'; -export type { DictionaryWithString } from './models/DictionaryWithString'; -export type { Enum1 } from './models/Enum1'; -export { Enum1Enum } from './models/Enum1'; -export type { EnumFromDescription } from './models/EnumFromDescription'; -export type { EnumWithExtensions } from './models/EnumWithExtensions'; -export { EnumWithExtensionsEnum } from './models/EnumWithExtensions'; -export type { EnumWithNumbers } from './models/EnumWithNumbers'; -export { EnumWithNumbersEnum } from './models/EnumWithNumbers'; -export type { EnumWithReplacedCharacters } from './models/EnumWithReplacedCharacters'; -export { EnumWithReplacedCharactersEnum } from './models/EnumWithReplacedCharacters'; -export type { EnumWithStrings } from './models/EnumWithStrings'; -export { EnumWithStringsEnum } from './models/EnumWithStrings'; -export type { File } from './models/File'; -export type { FreeFormObjectWithAdditionalPropertiesEqEmptyObject } from './models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject'; -export type { FreeFormObjectWithAdditionalPropertiesEqTrue } from './models/FreeFormObjectWithAdditionalPropertiesEqTrue'; -export type { FreeFormObjectWithoutAdditionalProperties } from './models/FreeFormObjectWithoutAdditionalProperties'; -export type { ModelCircle } from './models/ModelCircle'; -export type { ModelSquare } from './models/ModelSquare'; -export type { ModelThatExtends } from './models/ModelThatExtends'; -export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; -export type { ModelWithAdditionalPropertiesEqTrue } from './models/ModelWithAdditionalPropertiesEqTrue'; -export type { ModelWithArray } from './models/ModelWithArray'; -export type { ModelWithArrayReadOnlyAndWriteOnly } from './models/ModelWithArrayReadOnlyAndWriteOnly'; -export type { ModelWithBoolean } from './models/ModelWithBoolean'; -export type { ModelWithCircularReference } from './models/ModelWithCircularReference'; -export type { ModelWithConst } from './models/ModelWithConst'; -export type { ModelWithDictionary } from './models/ModelWithDictionary'; -export type { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; -export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; -export type { ModelWithEnum } from './models/ModelWithEnum'; -export { TestEnum, StatusCodeEnum } from './models/ModelWithEnum'; -export type { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; -export type { ModelWithEnumWithHyphen } from './models/ModelWithEnumWithHyphen'; -export { FooBarBazQuxEnum } from './models/ModelWithEnumWithHyphen'; -export type { ModelWithInteger } from './models/ModelWithInteger'; -export type { ModelWithNestedArrayEnums } from './models/ModelWithNestedArrayEnums'; -export type { ModelWithNestedArrayEnumsData } from './models/ModelWithNestedArrayEnumsData'; -export type { ModelWithNestedArrayEnumsDataBar } from './models/ModelWithNestedArrayEnumsDataBar'; -export { ModelWithNestedArrayEnumsDataBarEnum } from './models/ModelWithNestedArrayEnumsDataBar'; -export type { ModelWithNestedArrayEnumsDataFoo } from './models/ModelWithNestedArrayEnumsDataFoo'; -export { ModelWithNestedArrayEnumsDataFooEnum } from './models/ModelWithNestedArrayEnumsDataFoo'; -export type { ModelWithNestedCompositionEnums } from './models/ModelWithNestedCompositionEnums'; -export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; -export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; -export type { ModelWithNullableObject } from './models/ModelWithNullableObject'; -export type { ModelWithNullableString } from './models/ModelWithNullableString'; -export type { ModelWithOneOfEnum } from './models/ModelWithOneOfEnum'; -export { FooEnum } from './models/ModelWithOneOfEnum'; -export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; -export type { ModelWithPattern } from './models/ModelWithPattern'; -export type { ModelWithProperties } from './models/ModelWithProperties'; -export type { ModelWithReadOnlyAndWriteOnly } from './models/ModelWithReadOnlyAndWriteOnly'; -export type { ModelWithReference } from './models/ModelWithReference'; -export type { ModelWithString } from './models/ModelWithString'; -export type { NestedAnyOfArraysNullable } from './models/NestedAnyOfArraysNullable'; -export type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from './models/NonAsciiStringæøåÆØÅöôêÊ字符串'; -export type { NullableObject } from './models/NullableObject'; -export type { Pageable } from './models/Pageable'; -export type { SimpleBoolean } from './models/SimpleBoolean'; -export type { SimpleFile } from './models/SimpleFile'; -export type { SimpleInteger } from './models/SimpleInteger'; -export type { SimpleParameter } from './models/SimpleParameter'; -export type { SimpleReference } from './models/SimpleReference'; -export type { SimpleString } from './models/SimpleString'; -export type { SimpleStringWithPattern } from './models/SimpleStringWithPattern'; - -export { $_default } from './schemas/$_default'; -export { $AnyOfAnyAndNull } from './schemas/$AnyOfAnyAndNull'; -export { $AnyOfArrays } from './schemas/$AnyOfArrays'; -export { $ArrayWithAnyOfProperties } from './schemas/$ArrayWithAnyOfProperties'; -export { $ArrayWithArray } from './schemas/$ArrayWithArray'; -export { $ArrayWithBooleans } from './schemas/$ArrayWithBooleans'; -export { $ArrayWithNumbers } from './schemas/$ArrayWithNumbers'; -export { $ArrayWithProperties } from './schemas/$ArrayWithProperties'; -export { $ArrayWithReferences } from './schemas/$ArrayWithReferences'; -export { $ArrayWithStrings } from './schemas/$ArrayWithStrings'; -export { $CommentWithBackticks } from './schemas/$CommentWithBackticks'; -export { $CommentWithBreaks } from './schemas/$CommentWithBreaks'; -export { $CommentWithExpressionPlaceholders } from './schemas/$CommentWithExpressionPlaceholders'; -export { $CommentWithQuotes } from './schemas/$CommentWithQuotes'; -export { $CommentWithReservedCharacters } from './schemas/$CommentWithReservedCharacters'; -export { $CommentWithSlashes } from './schemas/$CommentWithSlashes'; -export { $CompositionBaseModel } from './schemas/$CompositionBaseModel'; -export { $CompositionExtendedModel } from './schemas/$CompositionExtendedModel'; -export { $CompositionWithAllOfAndNullable } from './schemas/$CompositionWithAllOfAndNullable'; -export { $CompositionWithAnyOf } from './schemas/$CompositionWithAnyOf'; -export { $CompositionWithAnyOfAndNullable } from './schemas/$CompositionWithAnyOfAndNullable'; -export { $CompositionWithAnyOfAnonymous } from './schemas/$CompositionWithAnyOfAnonymous'; -export { $CompositionWithNestedAnyAndTypeNull } from './schemas/$CompositionWithNestedAnyAndTypeNull'; -export { $CompositionWithNestedAnyOfAndNull } from './schemas/$CompositionWithNestedAnyOfAndNull'; -export { $CompositionWithOneOf } from './schemas/$CompositionWithOneOf'; -export { $CompositionWithOneOfAndComplexArrayDictionary } from './schemas/$CompositionWithOneOfAndComplexArrayDictionary'; -export { $CompositionWithOneOfAndNullable } from './schemas/$CompositionWithOneOfAndNullable'; -export { $CompositionWithOneOfAndProperties } from './schemas/$CompositionWithOneOfAndProperties'; -export { $CompositionWithOneOfAndSimpleArrayDictionary } from './schemas/$CompositionWithOneOfAndSimpleArrayDictionary'; -export { $CompositionWithOneOfAndSimpleDictionary } from './schemas/$CompositionWithOneOfAndSimpleDictionary'; -export { $CompositionWithOneOfAnonymous } from './schemas/$CompositionWithOneOfAnonymous'; -export { $CompositionWithOneOfDiscriminator } from './schemas/$CompositionWithOneOfDiscriminator'; -export { $ConstValue } from './schemas/$ConstValue'; -export { $DeprecatedModel } from './schemas/$DeprecatedModel'; -export { $DictionaryWithArray } from './schemas/$DictionaryWithArray'; -export { $DictionaryWithDictionary } from './schemas/$DictionaryWithDictionary'; -export { $DictionaryWithProperties } from './schemas/$DictionaryWithProperties'; -export { $DictionaryWithReference } from './schemas/$DictionaryWithReference'; -export { $DictionaryWithString } from './schemas/$DictionaryWithString'; -export { $Enum1 } from './schemas/$Enum1'; -export { $EnumFromDescription } from './schemas/$EnumFromDescription'; -export { $EnumWithExtensions } from './schemas/$EnumWithExtensions'; -export { $EnumWithNumbers } from './schemas/$EnumWithNumbers'; -export { $EnumWithReplacedCharacters } from './schemas/$EnumWithReplacedCharacters'; -export { $EnumWithStrings } from './schemas/$EnumWithStrings'; -export { $File } from './schemas/$File'; -export { $FreeFormObjectWithAdditionalPropertiesEqEmptyObject } from './schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject'; -export { $FreeFormObjectWithAdditionalPropertiesEqTrue } from './schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue'; -export { $FreeFormObjectWithoutAdditionalProperties } from './schemas/$FreeFormObjectWithoutAdditionalProperties'; -export { $ModelCircle } from './schemas/$ModelCircle'; -export { $ModelSquare } from './schemas/$ModelSquare'; -export { $ModelThatExtends } from './schemas/$ModelThatExtends'; -export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends'; -export { $ModelWithAdditionalPropertiesEqTrue } from './schemas/$ModelWithAdditionalPropertiesEqTrue'; -export { $ModelWithArray } from './schemas/$ModelWithArray'; -export { $ModelWithArrayReadOnlyAndWriteOnly } from './schemas/$ModelWithArrayReadOnlyAndWriteOnly'; -export { $ModelWithBoolean } from './schemas/$ModelWithBoolean'; -export { $ModelWithCircularReference } from './schemas/$ModelWithCircularReference'; -export { $ModelWithConst } from './schemas/$ModelWithConst'; -export { $ModelWithDictionary } from './schemas/$ModelWithDictionary'; -export { $ModelWithDuplicateImports } from './schemas/$ModelWithDuplicateImports'; -export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProperties'; -export { $ModelWithEnum } from './schemas/$ModelWithEnum'; -export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription'; -export { $ModelWithEnumWithHyphen } from './schemas/$ModelWithEnumWithHyphen'; -export { $ModelWithInteger } from './schemas/$ModelWithInteger'; -export { $ModelWithNestedArrayEnums } from './schemas/$ModelWithNestedArrayEnums'; -export { $ModelWithNestedArrayEnumsData } from './schemas/$ModelWithNestedArrayEnumsData'; -export { $ModelWithNestedArrayEnumsDataBar } from './schemas/$ModelWithNestedArrayEnumsDataBar'; -export { $ModelWithNestedArrayEnumsDataFoo } from './schemas/$ModelWithNestedArrayEnumsDataFoo'; -export { $ModelWithNestedCompositionEnums } from './schemas/$ModelWithNestedCompositionEnums'; -export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums'; -export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties'; -export { $ModelWithNullableObject } from './schemas/$ModelWithNullableObject'; -export { $ModelWithNullableString } from './schemas/$ModelWithNullableString'; -export { $ModelWithOneOfEnum } from './schemas/$ModelWithOneOfEnum'; -export { $ModelWithOrderedProperties } from './schemas/$ModelWithOrderedProperties'; -export { $ModelWithPattern } from './schemas/$ModelWithPattern'; -export { $ModelWithProperties } from './schemas/$ModelWithProperties'; -export { $ModelWithReadOnlyAndWriteOnly } from './schemas/$ModelWithReadOnlyAndWriteOnly'; -export { $ModelWithReference } from './schemas/$ModelWithReference'; -export { $ModelWithString } from './schemas/$ModelWithString'; -export { $NestedAnyOfArraysNullable } from './schemas/$NestedAnyOfArraysNullable'; -export { $NonAsciiStringæøåÆØÅöôêÊ字符串 } from './schemas/$NonAsciiStringæøåÆØÅöôêÊ字符串'; -export { $NullableObject } from './schemas/$NullableObject'; -export { $Pageable } from './schemas/$Pageable'; -export { $SimpleBoolean } from './schemas/$SimpleBoolean'; -export { $SimpleFile } from './schemas/$SimpleFile'; -export { $SimpleInteger } from './schemas/$SimpleInteger'; -export { $SimpleParameter } from './schemas/$SimpleParameter'; -export { $SimpleReference } from './schemas/$SimpleReference'; -export { $SimpleString } from './schemas/$SimpleString'; -export { $SimpleStringWithPattern } from './schemas/$SimpleStringWithPattern'; - -export { CollectionFormatService } from './services/CollectionFormatService'; -export { ComplexService } from './services/ComplexService'; -export { DefaultService } from './services/DefaultService'; -export { DefaultsService } from './services/DefaultsService'; -export { DeprecatedService } from './services/DeprecatedService'; -export { DescriptionsService } from './services/DescriptionsService'; -export { DuplicateService } from './services/DuplicateService'; -export { ErrorService } from './services/ErrorService'; -export { FileResponseService } from './services/FileResponseService'; -export { FormDataService } from './services/FormDataService'; -export { HeaderService } from './services/HeaderService'; -export { MultipartService } from './services/MultipartService'; -export { MultipleTags1Service } from './services/MultipleTags1Service'; -export { MultipleTags2Service } from './services/MultipleTags2Service'; -export { MultipleTags3Service } from './services/MultipleTags3Service'; -export { NoContentService } from './services/NoContentService'; -export { NonAsciiÆøåÆøÅöôêÊService } from './services/NonAsciiÆøåÆøÅöôêÊService'; -export { ParametersService } from './services/ParametersService'; -export { RequestBodyService } from './services/RequestBodyService'; -export { ResponseService } from './services/ResponseService'; -export { SimpleService } from './services/SimpleService'; -export { TypesService } from './services/TypesService'; -export { UploadService } from './services/UploadService'; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/_default.ts 1`] = ` -"export type _default = { - name?: string; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/AnyOfAnyAndNull.ts 1`] = ` -"export type AnyOfAnyAndNull = { - data?: unknown | null; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/AnyOfArrays.ts 1`] = ` -"/** - * This is a simple array with any of properties - */ -export type AnyOfArrays = { - results?: Array< - | { - foo?: string; - } - | { - bar?: string; - } - >; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ArrayWithAnyOfProperties.ts 1`] = ` -"/** - * This is a simple array with any of properties - */ -export type ArrayWithAnyOfProperties = Array< - | { - foo?: string; - } - | { - bar?: string; - } ->; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ArrayWithArray.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a simple array containing an array - */ -export type ArrayWithArray = Array>; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ArrayWithBooleans.ts 1`] = ` -"/** - * This is a simple array with booleans - */ -export type ArrayWithBooleans = Array; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ArrayWithNumbers.ts 1`] = ` -"/** - * This is a simple array with numbers - */ -export type ArrayWithNumbers = Array; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ArrayWithProperties.ts 1`] = ` -"/** - * This is a simple array with properties - */ -export type ArrayWithProperties = Array<{ - foo?: string; - bar?: string; -}>; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ArrayWithReferences.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a simple array with references - */ -export type ArrayWithReferences = Array; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ArrayWithStrings.ts 1`] = ` -"/** - * This is a simple array with strings - */ -export type ArrayWithStrings = Array; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CommentWithBackticks.ts 1`] = ` -"/** - * Testing backticks in string: \`backticks\` and \`\`\`multiple backticks\`\`\` should work - */ -export type CommentWithBackticks = number; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CommentWithBreaks.ts 1`] = ` -"/** - * Testing multiline comments in string: First line - * Second line - * - * Fourth line - */ -export type CommentWithBreaks = number; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CommentWithExpressionPlaceholders.ts 1`] = ` -"/** - * Testing expression placeholders in string: \${expression} should work - */ -export type CommentWithExpressionPlaceholders = number; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CommentWithQuotes.ts 1`] = ` -"/** - * Testing quotes in string: 'single quote''' and "double quotes""" should work - */ -export type CommentWithQuotes = number; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CommentWithReservedCharacters.ts 1`] = ` -"/** - * Testing reserved characters in string: * inline * and ** inline ** should work - */ -export type CommentWithReservedCharacters = number; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CommentWithSlashes.ts 1`] = ` -"/** - * Testing slashes in string: \\backwards\\\\\\ and /forwards/// should work - */ -export type CommentWithSlashes = number; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionBaseModel.ts 1`] = ` -"/** - * This is a base model with two simple optional properties - */ -export type CompositionBaseModel = { - firstName?: string; - lastname?: string; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionExtendedModel.ts 1`] = ` -"import type { CompositionBaseModel } from './CompositionBaseModel'; - -/** - * This is a model that extends the base model - */ -export type CompositionExtendedModel = CompositionBaseModel & { - firstName: string; - lastname: string; - age: number; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithAllOfAndNullable.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithAnyOf.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithAnyOfAndNullable.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithAnyOfAnonymous.ts 1`] = ` -"/** - * 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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithNestedAnyAndTypeNull.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithNestedAnyOfAndNull.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithOneOf.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithOneOfAndComplexArrayDictionary.ts 1`] = ` -"/** - * This is a model that contains a dictionary of complex arrays (composited) within composition - */ -export type CompositionWithOneOfAndComplexArrayDictionary = { - propA?: boolean | Record>; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithOneOfAndNullable.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithOneOfAndProperties.ts 1`] = ` -"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; - }; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithOneOfAndSimpleArrayDictionary.ts 1`] = ` -"/** - * This is a model that contains a dictionary of simple arrays within composition - */ -export type CompositionWithOneOfAndSimpleArrayDictionary = { - propA?: boolean | Record>; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithOneOfAndSimpleDictionary.ts 1`] = ` -"/** - * This is a model that contains a simple dictionary within composition - */ -export type CompositionWithOneOfAndSimpleDictionary = { - propA?: boolean | Record; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithOneOfAnonymous.ts 1`] = ` -"/** - * 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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/CompositionWithOneOfDiscriminator.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ConstValue.ts 1`] = ` -"export type ConstValue = 'ConstValue'; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/DeprecatedModel.ts 1`] = ` -"/** - * This is a deprecated model with a deprecated property - * @deprecated - */ -export type DeprecatedModel = { - /** - * This is a deprecated property - * @deprecated - */ - prop?: string; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/DictionaryWithArray.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a complex dictionary - */ -export type DictionaryWithArray = Record>; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/DictionaryWithDictionary.ts 1`] = ` -"/** - * This is a string dictionary - */ -export type DictionaryWithDictionary = Record>; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/DictionaryWithProperties.ts 1`] = ` -"/** - * This is a complex dictionary - */ -export type DictionaryWithProperties = Record< - string, - { - foo?: string; - bar?: string; - } ->; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/DictionaryWithReference.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a string reference - */ -export type DictionaryWithReference = Record; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/DictionaryWithString.ts 1`] = ` -"/** - * This is a string dictionary - */ -export type DictionaryWithString = Record; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/Enum1.ts 1`] = ` -"export type Enum1 = 'Bird' | 'Dog'; - -export const Enum1Enum = { - BIRD: 'Bird', - DOG: 'Dog', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/EnumFromDescription.ts 1`] = ` -"/** - * Success=1,Warning=2,Error=3 - */ -export type EnumFromDescription = number; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/EnumWithExtensions.ts 1`] = ` -"/** - * This is a simple enum with numbers - */ -export type EnumWithExtensions = 200 | 400 | 500; - -export const EnumWithExtensionsEnum = { - /** - * 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, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/EnumWithNumbers.ts 1`] = ` -"/** - * This is a simple enum with numbers - */ -export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; - -export const EnumWithNumbersEnum = { - _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, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/EnumWithReplacedCharacters.ts 1`] = ` -"export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; - -export const EnumWithReplacedCharactersEnum = { - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', - '_3.1': 3.1, - EMPTY_STRING: '', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/EnumWithStrings.ts 1`] = ` -"/** - * This is a simple enum with strings - */ -export type EnumWithStrings = - | 'Success' - | 'Warning' - | 'Error' - | "'Single Quote'" - | '"Double Quotes"' - | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; - -export const EnumWithStringsEnum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - _SINGLE_QUOTE_: "'Single Quote'", - _DOUBLE_QUOTES_: '"Double Quotes"', - NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/File.ts 1`] = ` -"export type File = { - readonly id?: string; - readonly updated_at?: string; - readonly created_at?: string; - mime: string; - readonly file?: string; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts 1`] = ` -"/** - * This is a free-form object with additionalProperties: {}. - */ -export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = Record; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts 1`] = ` -"/** - * This is a free-form object with additionalProperties: true. - */ -export type FreeFormObjectWithAdditionalPropertiesEqTrue = Record; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/FreeFormObjectWithoutAdditionalProperties.ts 1`] = ` -"/** - * This is a free-form object without additionalProperties. - */ -export type FreeFormObjectWithoutAdditionalProperties = Record; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelCircle.ts 1`] = ` -"/** - * Circle - */ -export type ModelCircle = { - kind: 'circle'; - radius?: number; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelSquare.ts 1`] = ` -"/** - * Square - */ -export type ModelSquare = { - kind: 'square'; - sideLength?: number; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelThatExtends.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model that extends another model - */ -export type ModelThatExtends = ModelWithString & { - propExtendsA?: string; - propExtendsB?: ModelWithString; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelThatExtendsExtends.ts 1`] = ` -"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; - }; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithAdditionalPropertiesEqTrue.ts 1`] = ` -"/** - * This is a model with one property and additionalProperties: true - */ -export type ModelWithAdditionalPropertiesEqTrue = { - /** - * This is a simple string property - */ - prop?: string; - [key: string]: unknown; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithArray.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArray = { - prop?: Array; - propWithFile?: Array; - propWithNumber?: Array; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithArrayReadOnlyAndWriteOnly.ts 1`] = ` -"import type { ModelWithReadOnlyAndWriteOnly } from './ModelWithReadOnlyAndWriteOnly'; - -/** - * This is a model with one property containing an array - */ -export type ModelWithArrayReadOnlyAndWriteOnly = { - prop?: Array; - propWithFile?: Array; - propWithNumber?: Array; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithBoolean.ts 1`] = ` -"/** - * This is a model with one boolean property - */ -export type ModelWithBoolean = { - /** - * This is a simple boolean property - */ - prop?: boolean; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithCircularReference.ts 1`] = ` -"/** - * This is a model with one property containing a circular reference - */ -export type ModelWithCircularReference = { - prop?: ModelWithCircularReference; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithConst.ts 1`] = ` -"export type ModelWithConst = { - String?: 'String'; - number?: 0; - null?: null; - withType?: 'Some string'; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithDictionary.ts 1`] = ` -"/** - * This is a model with one property containing a dictionary - */ -export type ModelWithDictionary = { - prop?: Record; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithDuplicateImports.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model with duplicated imports - */ -export type ModelWithDuplicateImports = { - propA?: ModelWithString; - propB?: ModelWithString; - propC?: ModelWithString; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithDuplicateProperties.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model with duplicated properties - */ -export type ModelWithDuplicateProperties = { - prop?: ModelWithString; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithEnum.ts 1`] = ` -"/** - * 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; -}; - -export const TestEnum = { - SUCCESS: 'Success', - WARNING: 'Warning', - ERROR: 'Error', - ØÆÅ字符串: 'ØÆÅ字符串', -} as const; - -export const StatusCodeEnum = { - _100: '100', - _200_FOO: '200 FOO', - _300_FOO_BAR: '300 FOO_BAR', - _400_FOO_BAR: '400 foo-bar', - _500_FOO_BAR: '500 foo.bar', - _600_FOO_BAR: '600 foo&bar', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithEnumFromDescription.ts 1`] = ` -"/** - * This is a model with one enum - */ -export type ModelWithEnumFromDescription = { - /** - * Success=1,Warning=2,Error=3 - */ - test?: number; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithEnumWithHyphen.ts 1`] = ` -"/** - * This is a model with one enum with escaped name - */ -export type ModelWithEnumWithHyphen = { - 'foo-bar-baz-qux'?: '3.0'; -}; - -export const FooBarBazQuxEnum = { - _3_0: '3.0', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithInteger.ts 1`] = ` -"/** - * This is a model with one number property - */ -export type ModelWithInteger = { - /** - * This is a simple number property - */ - prop?: number; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithNestedArrayEnums.ts 1`] = ` -"import type { ModelWithNestedArrayEnumsData } from './ModelWithNestedArrayEnumsData'; - -export type ModelWithNestedArrayEnums = { - array_strings?: Array; - data?: ModelWithNestedArrayEnumsData; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithNestedArrayEnumsData.ts 1`] = ` -"import type { ModelWithNestedArrayEnumsDataBar } from './ModelWithNestedArrayEnumsDataBar'; -import type { ModelWithNestedArrayEnumsDataFoo } from './ModelWithNestedArrayEnumsDataFoo'; - -export type ModelWithNestedArrayEnumsData = { - foo?: Array; - bar?: Array; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithNestedArrayEnumsDataBar.ts 1`] = ` -"export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; - -export const ModelWithNestedArrayEnumsDataBarEnum = { - BAZ: 'baz', - QUX: 'qux', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithNestedArrayEnumsDataFoo.ts 1`] = ` -"export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; - -export const ModelWithNestedArrayEnumsDataFooEnum = { - FOO: 'foo', - BAR: 'bar', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithNestedCompositionEnums.ts 1`] = ` -"import type { ModelWithNestedArrayEnumsDataFoo } from './ModelWithNestedArrayEnumsDataFoo'; - -export type ModelWithNestedCompositionEnums = { - foo?: ModelWithNestedArrayEnumsDataFoo; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithNestedEnums.ts 1`] = ` -"/** - * This is a model with nested enums - */ -export type ModelWithNestedEnums = { - dictionaryWithEnum?: Record; - dictionaryWithEnumFromDescription?: Record; - arrayWithEnum?: Array<'Success' | 'Warning' | 'Error'>; - arrayWithDescription?: Array; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithNestedProperties.ts 1`] = ` -"/** - * This is a model with one nested property - */ -export type ModelWithNestedProperties = { - readonly first: { - readonly second: { - readonly third: string | null; - } | null; - } | null; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithNullableObject.ts 1`] = ` -"import type { NullableObject } from './NullableObject'; - -export type ModelWithNullableObject = { - data?: NullableObject; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithNullableString.ts 1`] = ` -"/** - * 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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithOneOfEnum.ts 1`] = ` -"export type ModelWithOneOfEnum = - | { - foo: 'Bar'; - } - | { - foo: 'Baz'; - } - | { - foo: 'Qux'; - } - | { - content: string; - foo: 'Quux'; - } - | { - content: [string, string]; - foo: 'Corge'; - }; - -export const FooEnum = { - BAR: 'Bar', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithOrderedProperties.ts 1`] = ` -"/** - * This is a model with ordered properties - */ -export type ModelWithOrderedProperties = { - zebra?: string; - apple?: string; - hawaii?: string; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithPattern.ts 1`] = ` -"/** - * 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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithProperties.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithReadOnlyAndWriteOnly.ts 1`] = ` -"export type ModelWithReadOnlyAndWriteOnly = { - foo: string; - readonly bar: string; - baz: string; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithReference.ts 1`] = ` -"import type { ModelWithProperties } from './ModelWithProperties'; - -/** - * This is a model with one property containing a reference - */ -export type ModelWithReference = { - prop?: ModelWithProperties; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/ModelWithString.ts 1`] = ` -"/** - * This is a model with one string property - */ -export type ModelWithString = { - /** - * This is a simple string property - */ - prop?: string; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/NestedAnyOfArraysNullable.ts 1`] = ` -"export type NestedAnyOfArraysNullable = { - nullableArray?: Array | null; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/NonAsciiStringæøåÆØÅöôêÊ字符串.ts 1`] = ` -"/** - * A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串) - */ -export type NonAsciiStringæøåÆØÅöôêÊ字符串 = string; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/NullableObject.ts 1`] = ` -"/** - * An object that can be null - */ -export type NullableObject = { - foo?: string; -} | null; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/Pageable.ts 1`] = ` -"export type Pageable = { - page?: number; - size?: number; - sort?: Array; -}; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/SimpleBoolean.ts 1`] = ` -"/** - * This is a simple boolean - */ -export type SimpleBoolean = boolean; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/SimpleFile.ts 1`] = ` -"/** - * This is a simple file - */ -export type SimpleFile = Blob; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/SimpleInteger.ts 1`] = ` -"/** - * This is a simple number - */ -export type SimpleInteger = number; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/SimpleParameter.ts 1`] = ` -"/** - * This is a reusable parameter - */ -export type SimpleParameter = string; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/SimpleReference.ts 1`] = ` -"import type { ModelWithString } from './ModelWithString'; - -/** - * This is a simple reference - */ -export type SimpleReference = ModelWithString; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/SimpleString.ts 1`] = ` -"/** - * This is a simple string - */ -export type SimpleString = string; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/models/SimpleStringWithPattern.ts 1`] = ` -"/** - * This is a simple string - */ -export type SimpleStringWithPattern = string | null; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$_default.ts 1`] = ` -"export const $_default = { - properties: { - name: { - type: 'string', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$AnyOfAnyAndNull.ts 1`] = ` -"export const $AnyOfAnyAndNull = { - properties: { - data: { - type: 'any-of', - contains: [ - { - properties: {}, - }, - { - type: 'null', - }, - ], - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$AnyOfArrays.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ArrayWithAnyOfProperties.ts 1`] = ` -"export const $ArrayWithAnyOfProperties = { - type: 'array', - contains: { - type: 'any-of', - contains: [ - { - properties: { - foo: { - type: 'string', - }, - }, - }, - { - properties: { - bar: { - type: 'string', - }, - }, - }, - ], - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ArrayWithArray.ts 1`] = ` -"export const $ArrayWithArray = { - type: 'array', - contains: { - type: 'array', - contains: { - type: 'ModelWithString', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ArrayWithBooleans.ts 1`] = ` -"export const $ArrayWithBooleans = { - type: 'array', - contains: { - type: 'boolean', - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ArrayWithNumbers.ts 1`] = ` -"export const $ArrayWithNumbers = { - type: 'array', - contains: { - type: 'number', - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ArrayWithProperties.ts 1`] = ` -"export const $ArrayWithProperties = { - type: 'array', - contains: { - properties: { - foo: { - type: 'string', - }, - bar: { - type: 'string', - }, - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ArrayWithReferences.ts 1`] = ` -"export const $ArrayWithReferences = { - type: 'array', - contains: { - type: 'ModelWithString', - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ArrayWithStrings.ts 1`] = ` -"export const $ArrayWithStrings = { - type: 'array', - contains: { - type: 'string', - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CommentWithBackticks.ts 1`] = ` -"export const $CommentWithBackticks = { - type: 'number', - description: \`Testing backticks in string: \\\`backticks\\\` and \\\`\\\`\\\`multiple backticks\\\`\\\`\\\` should work\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CommentWithBreaks.ts 1`] = ` -"export const $CommentWithBreaks = { - type: 'number', - description: \`Testing multiline comments in string: First line -Second line - -Fourth line\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CommentWithExpressionPlaceholders.ts 1`] = ` -"export const $CommentWithExpressionPlaceholders = { - type: 'number', - description: \`Testing expression placeholders in string: \\\${expression} should work\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CommentWithQuotes.ts 1`] = ` -"export const $CommentWithQuotes = { - type: 'number', - description: \`Testing quotes in string: 'single quote''' and "double quotes""" should work\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CommentWithReservedCharacters.ts 1`] = ` -"export const $CommentWithReservedCharacters = { - type: 'number', - description: \`Testing reserved characters in string: /* inline */ and /** inline **/ should work\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CommentWithSlashes.ts 1`] = ` -"export const $CommentWithSlashes = { - type: 'number', - description: \`Testing slashes in string: \\\\backwards\\\\\\\\\\\\ and /forwards/// should work\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionBaseModel.ts 1`] = ` -"export const $CompositionBaseModel = { - description: \`This is a base model with two simple optional properties\`, - properties: { - firstName: { - type: 'string', - }, - lastname: { - type: 'string', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionExtendedModel.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithAllOfAndNullable.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithAnyOf.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithAnyOfAndNullable.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithAnyOfAnonymous.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithNestedAnyAndTypeNull.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithNestedAnyOfAndNull.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithOneOf.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithOneOfAndNullable.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithOneOfAndProperties.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithOneOfAndSimpleDictionary.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithOneOfAnonymous.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$CompositionWithOneOfDiscriminator.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ConstValue.ts 1`] = ` -"export const $ConstValue = { - type: '"ConstValue"', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$DeprecatedModel.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$DictionaryWithArray.ts 1`] = ` -"export const $DictionaryWithArray = { - type: 'dictionary', - contains: { - type: 'array', - contains: { - type: 'ModelWithString', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$DictionaryWithDictionary.ts 1`] = ` -"export const $DictionaryWithDictionary = { - type: 'dictionary', - contains: { - type: 'dictionary', - contains: { - type: 'string', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$DictionaryWithProperties.ts 1`] = ` -"export const $DictionaryWithProperties = { - type: 'dictionary', - contains: { - properties: { - foo: { - type: 'string', - }, - bar: { - type: 'string', - }, - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$DictionaryWithReference.ts 1`] = ` -"export const $DictionaryWithReference = { - type: 'dictionary', - contains: { - type: 'ModelWithString', - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$DictionaryWithString.ts 1`] = ` -"export const $DictionaryWithString = { - type: 'dictionary', - contains: { - type: 'string', - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$Enum1.ts 1`] = ` -"export const $Enum1 = { - type: 'Enum', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$EnumFromDescription.ts 1`] = ` -"export const $EnumFromDescription = { - type: 'number', - description: \`Success=1,Warning=2,Error=3\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$EnumWithExtensions.ts 1`] = ` -"export const $EnumWithExtensions = { - type: 'Enum', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$EnumWithNumbers.ts 1`] = ` -"export const $EnumWithNumbers = { - type: 'Enum', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$EnumWithReplacedCharacters.ts 1`] = ` -"export const $EnumWithReplacedCharacters = { - type: 'Enum', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$EnumWithStrings.ts 1`] = ` -"export const $EnumWithStrings = { - type: 'Enum', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$File.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts 1`] = ` -"export const $FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { - type: 'dictionary', - contains: { - properties: {}, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts 1`] = ` -"export const $FreeFormObjectWithAdditionalPropertiesEqTrue = { - type: 'dictionary', - contains: { - properties: {}, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$FreeFormObjectWithoutAdditionalProperties.ts 1`] = ` -"export const $FreeFormObjectWithoutAdditionalProperties = { - type: 'dictionary', - contains: { - properties: {}, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelCircle.ts 1`] = ` -"export const $ModelCircle = { - description: \`Circle\`, - properties: { - kind: { - type: 'string', - isRequired: true, - }, - radius: { - type: 'number', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelSquare.ts 1`] = ` -"export const $ModelSquare = { - description: \`Square\`, - properties: { - kind: { - type: 'string', - isRequired: true, - }, - sideLength: { - type: 'number', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelThatExtends.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelThatExtendsExtends.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithAdditionalPropertiesEqTrue.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithArray.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithBoolean.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithCircularReference.ts 1`] = ` -"export const $ModelWithCircularReference = { - description: \`This is a model with one property containing a circular reference\`, - properties: { - prop: { - type: 'ModelWithCircularReference', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithConst.ts 1`] = ` -"export const $ModelWithConst = { - properties: { - String: { - type: '"String"', - }, - number: { - type: '0', - }, - null: { - type: 'null', - }, - withType: { - type: '"Some string"', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithDictionary.ts 1`] = ` -"export const $ModelWithDictionary = { - description: \`This is a model with one property containing a dictionary\`, - properties: { - prop: { - type: 'dictionary', - contains: { - type: 'string', - }, - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithDuplicateImports.ts 1`] = ` -"export const $ModelWithDuplicateImports = { - description: \`This is a model with duplicated imports\`, - properties: { - propA: { - type: 'ModelWithString', - }, - propB: { - type: 'ModelWithString', - }, - propC: { - type: 'ModelWithString', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithDuplicateProperties.ts 1`] = ` -"export const $ModelWithDuplicateProperties = { - description: \`This is a model with duplicated properties\`, - properties: { - prop: { - type: 'ModelWithString', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithEnum.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithEnumFromDescription.ts 1`] = ` -"export const $ModelWithEnumFromDescription = { - description: \`This is a model with one enum\`, - properties: { - test: { - type: 'number', - description: \`Success=1,Warning=2,Error=3\`, - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithEnumWithHyphen.ts 1`] = ` -"export const $ModelWithEnumWithHyphen = { - description: \`This is a model with one enum with escaped name\`, - properties: { - 'foo-bar-baz-qux': { - type: 'Enum', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithInteger.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithNestedArrayEnums.ts 1`] = ` -"export const $ModelWithNestedArrayEnums = { - properties: { - array_strings: { - type: 'array', - contains: { - type: 'string', - }, - }, - data: { - type: 'all-of', - contains: [ - { - type: 'ModelWithNestedArrayEnumsData', - }, - ], - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithNestedArrayEnumsData.ts 1`] = ` -"export const $ModelWithNestedArrayEnumsData = { - properties: { - foo: { - type: 'array', - contains: { - type: 'ModelWithNestedArrayEnumsDataFoo', - }, - }, - bar: { - type: 'array', - contains: { - type: 'ModelWithNestedArrayEnumsDataBar', - }, - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataBar.ts 1`] = ` -"export const $ModelWithNestedArrayEnumsDataBar = { - type: 'Enum', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataFoo.ts 1`] = ` -"export const $ModelWithNestedArrayEnumsDataFoo = { - type: 'Enum', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithNestedCompositionEnums.ts 1`] = ` -"export const $ModelWithNestedCompositionEnums = { - properties: { - foo: { - type: 'all-of', - contains: [ - { - type: 'ModelWithNestedArrayEnumsDataFoo', - }, - ], - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithNestedEnums.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithNestedProperties.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithNullableObject.ts 1`] = ` -"export const $ModelWithNullableObject = { - properties: { - data: { - type: 'NullableObject', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithNullableString.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithOneOfEnum.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithOrderedProperties.ts 1`] = ` -"export const $ModelWithOrderedProperties = { - description: \`This is a model with ordered properties\`, - properties: { - zebra: { - type: 'string', - }, - apple: { - type: 'string', - }, - hawaii: { - type: 'string', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithPattern.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithProperties.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithReadOnlyAndWriteOnly.ts 1`] = ` -"export const $ModelWithReadOnlyAndWriteOnly = { - properties: { - foo: { - type: 'string', - isRequired: true, - }, - bar: { - type: 'string', - isReadOnly: true, - isRequired: true, - }, - baz: { - type: 'string', - isRequired: true, - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithReference.ts 1`] = ` -"export const $ModelWithReference = { - description: \`This is a model with one property containing a reference\`, - properties: { - prop: { - type: 'ModelWithProperties', - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$ModelWithString.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$NestedAnyOfArraysNullable.ts 1`] = ` -"export const $NestedAnyOfArraysNullable = { - properties: { - nullableArray: { - type: 'any-of', - contains: [ - { - type: 'array', - contains: { - type: 'any-of', - contains: [ - { - type: 'string', - }, - { - type: 'boolean', - }, - ], - }, - }, - { - type: 'null', - }, - ], - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$NonAsciiStringæøåÆØÅöôêÊ字符串.ts 1`] = ` -"export const $NonAsciiStringæøåÆØÅöôêÊ字符串 = { - type: 'string', - description: \`A string with non-ascii (unicode) characters valid in typescript identifiers (æøåÆØÅöÔèÈ字符串)\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$NullableObject.ts 1`] = ` -"export const $NullableObject = { - description: \`An object that can be null\`, - properties: { - foo: { - type: 'string', - }, - }, - isNullable: true, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$Pageable.ts 1`] = ` -"export const $Pageable = { - properties: { - page: { - type: 'number', - format: 'int32', - }, - size: { - type: 'number', - format: 'int32', - minimum: 1, - }, - sort: { - type: 'array', - contains: { - type: 'string', - }, - }, - }, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$SimpleBoolean.ts 1`] = ` -"export const $SimpleBoolean = { - type: 'boolean', - description: \`This is a simple boolean\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$SimpleFile.ts 1`] = ` -"export const $SimpleFile = { - type: 'binary', - description: \`This is a simple file\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$SimpleInteger.ts 1`] = ` -"export const $SimpleInteger = { - type: 'number', - description: \`This is a simple number\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$SimpleParameter.ts 1`] = ` -"export const $SimpleParameter = { - type: 'string', - description: \`This is a reusable parameter\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$SimpleReference.ts 1`] = ` -"export const $SimpleReference = { - type: 'ModelWithString', - description: \`This is a simple reference\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$SimpleString.ts 1`] = ` -"export const $SimpleString = { - type: 'string', - description: \`This is a simple string\`, -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/schemas/$SimpleStringWithPattern.ts 1`] = ` -"export const $SimpleStringWithPattern = { - type: 'string', - description: \`This is a simple string\`, - isNullable: true, - maxLength: 64, - pattern: '^[a-zA-Z0-9_]*$', -} as const; -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/CollectionFormatService.ts 1`] = ` -"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, - }, - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/ComplexService.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/DefaultService.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/DefaultsService.ts 1`] = ` -"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, - }, - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/DeprecatedService.ts 1`] = ` -"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, - }, - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/DescriptionsService.ts 1`] = ` -"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, - }, - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/DuplicateService.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/ErrorService.ts 1`] = ` -"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\`, - }, - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/FileResponseService.ts 1`] = ` -"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, - }, - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/FormDataService.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/HeaderService.ts 1`] = ` -"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\`, - }, - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/MultipartService.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/MultipleTags1Service.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/MultipleTags2Service.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/MultipleTags3Service.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/NoContentService.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/NonAsciiÆøåÆøÅöôêÊService.ts 1`] = ` -"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æøåÆøÅöôêÊ, - }, - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/ParametersService.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/RequestBodyService.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/ResponseService.ts 1`] = ` -"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\`, - }, - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/SimpleService.ts 1`] = ` -"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', - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/TypesService.ts 1`] = ` -"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, - }, - }); - } -} -" -`; - -exports[`v3 > should generate > ./test/generated/v3/services/UploadService.ts 1`] = ` -"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, - }, - }); - } -} -" -`; - -exports[`v3 > should generate Date types > ./test/generated/v3_date/index.ts 1`] = ` -"export type { ModelWithPattern } from './models/ModelWithPattern'; - -export { $ModelWithPattern } from './schemas/$ModelWithPattern'; -" -`; - -exports[`v3 > should generate Date types > ./test/generated/v3_date/models/ModelWithPattern.ts 1`] = ` -"/** - * This is a model that contains a some patterns - */ -export type ModelWithPattern = { - key: string; - name: string; - readonly enabled?: boolean; - readonly modified?: Date; - id?: string; - text?: string; - patternWithSingleQuotes?: string; - patternWithNewline?: string; - patternWithBacktick?: string; -}; -" -`; - -exports[`v3 > should generate Date types > ./test/generated/v3_date/schemas/$ModelWithPattern.ts 1`] = ` -"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; -" -`; - -exports[`v3 > should generate optional argument > ./test/generated/v3_options/core/ApiError.ts 1`] = ` -"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; - } -} -" -`; - -exports[`v3 > should generate optional argument > ./test/generated/v3_options/core/ApiRequestOptions.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate optional argument > ./test/generated/v3_options/core/ApiResult.ts 1`] = ` -"export type ApiResult = { - readonly body: TData; - readonly ok: boolean; - readonly status: number; - readonly statusText: string; - readonly url: string; -}; -" -`; - -exports[`v3 > should generate optional argument > ./test/generated/v3_options/core/CancelablePromise.ts 1`] = ` -"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; - } -} -" -`; - -exports[`v3 > should generate optional argument > ./test/generated/v3_options/core/OpenAPI.ts 1`] = ` -"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; -}; -" -`; - -exports[`v3 > should generate optional argument > ./test/generated/v3_options/core/request.ts 1`] = ` -"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); - } - }); -}; -" -`; - -exports[`v3 > should generate optional argument > ./test/generated/v3_options/core/types.ts 1`] = ` -"import type { ApiResult } from './ApiResult'; - -export type TResult = 'body' | 'raw'; - -export type TApiResponse = - Exclude extends never ? ApiResult : ApiResult['body']; - -export type TConfig = { - _result?: T; -}; -" -`; - -exports[`v3 > should generate optional argument > ./test/generated/v3_options/index.ts 1`] = ` -"export { ApiError } from './core/ApiError'; -export { CancelablePromise, CancelError } from './core/CancelablePromise'; -export { OpenAPI } from './core/OpenAPI'; -export type { OpenAPIConfig } from './core/OpenAPI'; - -export type { ModelWithString } from './models/ModelWithString'; - -export { DefaultsService } from './services/DefaultsService'; -" -`; - -exports[`v3 > should generate optional argument > ./test/generated/v3_options/models/ModelWithString.ts 1`] = ` -"/** - * This is a model with one string property - */ -export type ModelWithString = { - /** - * This is a simple string property - */ - prop?: string; -}; -" -`; - -exports[`v3 > should generate optional argument > ./test/generated/v3_options/services/DefaultsService.ts 1`] = ` -"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__/v2/test/generated/v2/core/ApiError.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/ApiError.ts.snap new file mode 100644 index 000000000..2c11b4136 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/core/ApiError.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/ApiError.ts.ts.snap new file mode 100644 index 000000000..2c11b4136 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/core/ApiError.ts.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__/v2/test/generated/v2/core/ApiRequestOptions.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/ApiRequestOptions.ts.snap new file mode 100644 index 000000000..e93003ee7 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/core/ApiRequestOptions.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/ApiRequestOptions.ts.ts.snap new file mode 100644 index 000000000..e93003ee7 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/core/ApiRequestOptions.ts.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__/v2/test/generated/v2/core/ApiResult.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/ApiResult.ts.snap new file mode 100644 index 000000000..caa79c2ea --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/core/ApiResult.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/ApiResult.ts.ts.snap new file mode 100644 index 000000000..caa79c2ea --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/core/ApiResult.ts.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__/v2/test/generated/v2/core/CancelablePromise.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/CancelablePromise.ts.snap new file mode 100644 index 000000000..0e480dd1d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/core/CancelablePromise.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/CancelablePromise.ts.ts.snap new file mode 100644 index 000000000..0e480dd1d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/core/CancelablePromise.ts.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__/v2/test/generated/v2/core/OpenAPI.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/OpenAPI.ts.snap new file mode 100644 index 000000000..9308c908f --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/core/OpenAPI.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/OpenAPI.ts.ts.snap new file mode 100644 index 000000000..9308c908f --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/core/OpenAPI.ts.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__/v2/test/generated/v2/core/request.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/request.ts.snap new file mode 100644 index 000000000..7bc4c87bc --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/core/request.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/request.ts.ts.snap new file mode 100644 index 000000000..7bc4c87bc --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/core/request.ts.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__/v2/test/generated/v2/core/types.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/types.ts.snap new file mode 100644 index 000000000..e33a5d996 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/core/types.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/core/types.ts.ts.snap new file mode 100644 index 000000000..e33a5d996 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/core/types.ts.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__/v2/test/generated/v2/index.ts.snap b/test/__snapshots__/v2/test/generated/v2/index.ts.snap new file mode 100644 index 000000000..b205a7e46 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/index.ts.snap @@ -0,0 +1,126 @@ +export { ApiError } from './core/ApiError'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI } from './core/OpenAPI'; +export type { OpenAPIConfig } from './core/OpenAPI'; + +export type { _default } from './models/_default'; +export type { ArrayWithArray } from './models/ArrayWithArray'; +export type { ArrayWithBooleans } from './models/ArrayWithBooleans'; +export type { ArrayWithNumbers } from './models/ArrayWithNumbers'; +export type { ArrayWithProperties } from './models/ArrayWithProperties'; +export type { ArrayWithReferences } from './models/ArrayWithReferences'; +export type { ArrayWithStrings } from './models/ArrayWithStrings'; +export type { CommentWithBackticks } from './models/CommentWithBackticks'; +export type { CommentWithBreaks } from './models/CommentWithBreaks'; +export type { CommentWithExpressionPlaceholders } from './models/CommentWithExpressionPlaceholders'; +export type { CommentWithQuotes } from './models/CommentWithQuotes'; +export type { CommentWithReservedCharacters } from './models/CommentWithReservedCharacters'; +export type { CommentWithSlashes } from './models/CommentWithSlashes'; +export type { Date } from './models/Date'; +export type { DictionaryWithArray } from './models/DictionaryWithArray'; +export type { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; +export type { DictionaryWithProperties } from './models/DictionaryWithProperties'; +export type { DictionaryWithReference } from './models/DictionaryWithReference'; +export type { DictionaryWithString } from './models/DictionaryWithString'; +export type { EnumFromDescription } from './models/EnumFromDescription'; +export type { EnumWithExtensions } from './models/EnumWithExtensions'; +export { EnumWithExtensionsEnum } from './models/EnumWithExtensions'; +export type { EnumWithNumbers } from './models/EnumWithNumbers'; +export { EnumWithNumbersEnum } from './models/EnumWithNumbers'; +export type { EnumWithStrings } from './models/EnumWithStrings'; +export { EnumWithStringsEnum } from './models/EnumWithStrings'; +export type { ModelThatExtends } from './models/ModelThatExtends'; +export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; +export type { ModelWithArray } from './models/ModelWithArray'; +export type { ModelWithBoolean } from './models/ModelWithBoolean'; +export type { ModelWithCircularReference } from './models/ModelWithCircularReference'; +export type { ModelWithDictionary } from './models/ModelWithDictionary'; +export type { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; +export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; +export type { ModelWithEnum } from './models/ModelWithEnum'; +export { TestEnum, StatusCodeEnum } from './models/ModelWithEnum'; +export type { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; +export type { ModelWithInteger } from './models/ModelWithInteger'; +export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; +export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; +export type { ModelWithNullableString } from './models/ModelWithNullableString'; +export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; +export type { ModelWithPattern } from './models/ModelWithPattern'; +export type { ModelWithProperties } from './models/ModelWithProperties'; +export type { ModelWithReference } from './models/ModelWithReference'; +export type { ModelWithString } from './models/ModelWithString'; +export type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from './models/NonAsciiStringæøåÆØÅöôêÊ字符串'; +export type { SimpleBoolean } from './models/SimpleBoolean'; +export type { SimpleFile } from './models/SimpleFile'; +export type { SimpleInteger } from './models/SimpleInteger'; +export type { SimpleReference } from './models/SimpleReference'; +export type { SimpleString } from './models/SimpleString'; +export type { SimpleStringWithPattern } from './models/SimpleStringWithPattern'; + +export { $_default } from './schemas/$_default'; +export { $ArrayWithArray } from './schemas/$ArrayWithArray'; +export { $ArrayWithBooleans } from './schemas/$ArrayWithBooleans'; +export { $ArrayWithNumbers } from './schemas/$ArrayWithNumbers'; +export { $ArrayWithProperties } from './schemas/$ArrayWithProperties'; +export { $ArrayWithReferences } from './schemas/$ArrayWithReferences'; +export { $ArrayWithStrings } from './schemas/$ArrayWithStrings'; +export { $CommentWithBackticks } from './schemas/$CommentWithBackticks'; +export { $CommentWithBreaks } from './schemas/$CommentWithBreaks'; +export { $CommentWithExpressionPlaceholders } from './schemas/$CommentWithExpressionPlaceholders'; +export { $CommentWithQuotes } from './schemas/$CommentWithQuotes'; +export { $CommentWithReservedCharacters } from './schemas/$CommentWithReservedCharacters'; +export { $CommentWithSlashes } from './schemas/$CommentWithSlashes'; +export { $Date } from './schemas/$Date'; +export { $DictionaryWithArray } from './schemas/$DictionaryWithArray'; +export { $DictionaryWithDictionary } from './schemas/$DictionaryWithDictionary'; +export { $DictionaryWithProperties } from './schemas/$DictionaryWithProperties'; +export { $DictionaryWithReference } from './schemas/$DictionaryWithReference'; +export { $DictionaryWithString } from './schemas/$DictionaryWithString'; +export { $EnumFromDescription } from './schemas/$EnumFromDescription'; +export { $EnumWithExtensions } from './schemas/$EnumWithExtensions'; +export { $EnumWithNumbers } from './schemas/$EnumWithNumbers'; +export { $EnumWithStrings } from './schemas/$EnumWithStrings'; +export { $ModelThatExtends } from './schemas/$ModelThatExtends'; +export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends'; +export { $ModelWithArray } from './schemas/$ModelWithArray'; +export { $ModelWithBoolean } from './schemas/$ModelWithBoolean'; +export { $ModelWithCircularReference } from './schemas/$ModelWithCircularReference'; +export { $ModelWithDictionary } from './schemas/$ModelWithDictionary'; +export { $ModelWithDuplicateImports } from './schemas/$ModelWithDuplicateImports'; +export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProperties'; +export { $ModelWithEnum } from './schemas/$ModelWithEnum'; +export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription'; +export { $ModelWithInteger } from './schemas/$ModelWithInteger'; +export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums'; +export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties'; +export { $ModelWithNullableString } from './schemas/$ModelWithNullableString'; +export { $ModelWithOrderedProperties } from './schemas/$ModelWithOrderedProperties'; +export { $ModelWithPattern } from './schemas/$ModelWithPattern'; +export { $ModelWithProperties } from './schemas/$ModelWithProperties'; +export { $ModelWithReference } from './schemas/$ModelWithReference'; +export { $ModelWithString } from './schemas/$ModelWithString'; +export { $NonAsciiStringæøåÆØÅöôêÊ字符串 } from './schemas/$NonAsciiStringæøåÆØÅöôêÊ字符串'; +export { $SimpleBoolean } from './schemas/$SimpleBoolean'; +export { $SimpleFile } from './schemas/$SimpleFile'; +export { $SimpleInteger } from './schemas/$SimpleInteger'; +export { $SimpleReference } from './schemas/$SimpleReference'; +export { $SimpleString } from './schemas/$SimpleString'; +export { $SimpleStringWithPattern } from './schemas/$SimpleStringWithPattern'; + +export { CollectionFormatService } from './services/CollectionFormatService'; +export { ComplexService } from './services/ComplexService'; +export { DefaultService } from './services/DefaultService'; +export { DefaultsService } from './services/DefaultsService'; +export { DescriptionsService } from './services/DescriptionsService'; +export { DuplicateService } from './services/DuplicateService'; +export { ErrorService } from './services/ErrorService'; +export { HeaderService } from './services/HeaderService'; +export { MultipleTags1Service } from './services/MultipleTags1Service'; +export { MultipleTags2Service } from './services/MultipleTags2Service'; +export { MultipleTags3Service } from './services/MultipleTags3Service'; +export { NoContentService } from './services/NoContentService'; +export { NonAsciiÆøåÆøÅöôêÊService } from './services/NonAsciiÆøåÆøÅöôêÊService'; +export { ParametersService } from './services/ParametersService'; +export { ResponseService } from './services/ResponseService'; +export { SimpleService } from './services/SimpleService'; +export { TypesService } from './services/TypesService'; diff --git a/test/__snapshots__/v2/test/generated/v2/index.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/index.ts.ts.snap new file mode 100644 index 000000000..b205a7e46 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/index.ts.ts.snap @@ -0,0 +1,126 @@ +export { ApiError } from './core/ApiError'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI } from './core/OpenAPI'; +export type { OpenAPIConfig } from './core/OpenAPI'; + +export type { _default } from './models/_default'; +export type { ArrayWithArray } from './models/ArrayWithArray'; +export type { ArrayWithBooleans } from './models/ArrayWithBooleans'; +export type { ArrayWithNumbers } from './models/ArrayWithNumbers'; +export type { ArrayWithProperties } from './models/ArrayWithProperties'; +export type { ArrayWithReferences } from './models/ArrayWithReferences'; +export type { ArrayWithStrings } from './models/ArrayWithStrings'; +export type { CommentWithBackticks } from './models/CommentWithBackticks'; +export type { CommentWithBreaks } from './models/CommentWithBreaks'; +export type { CommentWithExpressionPlaceholders } from './models/CommentWithExpressionPlaceholders'; +export type { CommentWithQuotes } from './models/CommentWithQuotes'; +export type { CommentWithReservedCharacters } from './models/CommentWithReservedCharacters'; +export type { CommentWithSlashes } from './models/CommentWithSlashes'; +export type { Date } from './models/Date'; +export type { DictionaryWithArray } from './models/DictionaryWithArray'; +export type { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; +export type { DictionaryWithProperties } from './models/DictionaryWithProperties'; +export type { DictionaryWithReference } from './models/DictionaryWithReference'; +export type { DictionaryWithString } from './models/DictionaryWithString'; +export type { EnumFromDescription } from './models/EnumFromDescription'; +export type { EnumWithExtensions } from './models/EnumWithExtensions'; +export { EnumWithExtensionsEnum } from './models/EnumWithExtensions'; +export type { EnumWithNumbers } from './models/EnumWithNumbers'; +export { EnumWithNumbersEnum } from './models/EnumWithNumbers'; +export type { EnumWithStrings } from './models/EnumWithStrings'; +export { EnumWithStringsEnum } from './models/EnumWithStrings'; +export type { ModelThatExtends } from './models/ModelThatExtends'; +export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; +export type { ModelWithArray } from './models/ModelWithArray'; +export type { ModelWithBoolean } from './models/ModelWithBoolean'; +export type { ModelWithCircularReference } from './models/ModelWithCircularReference'; +export type { ModelWithDictionary } from './models/ModelWithDictionary'; +export type { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; +export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; +export type { ModelWithEnum } from './models/ModelWithEnum'; +export { TestEnum, StatusCodeEnum } from './models/ModelWithEnum'; +export type { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; +export type { ModelWithInteger } from './models/ModelWithInteger'; +export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; +export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; +export type { ModelWithNullableString } from './models/ModelWithNullableString'; +export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; +export type { ModelWithPattern } from './models/ModelWithPattern'; +export type { ModelWithProperties } from './models/ModelWithProperties'; +export type { ModelWithReference } from './models/ModelWithReference'; +export type { ModelWithString } from './models/ModelWithString'; +export type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from './models/NonAsciiStringæøåÆØÅöôêÊ字符串'; +export type { SimpleBoolean } from './models/SimpleBoolean'; +export type { SimpleFile } from './models/SimpleFile'; +export type { SimpleInteger } from './models/SimpleInteger'; +export type { SimpleReference } from './models/SimpleReference'; +export type { SimpleString } from './models/SimpleString'; +export type { SimpleStringWithPattern } from './models/SimpleStringWithPattern'; + +export { $_default } from './schemas/$_default'; +export { $ArrayWithArray } from './schemas/$ArrayWithArray'; +export { $ArrayWithBooleans } from './schemas/$ArrayWithBooleans'; +export { $ArrayWithNumbers } from './schemas/$ArrayWithNumbers'; +export { $ArrayWithProperties } from './schemas/$ArrayWithProperties'; +export { $ArrayWithReferences } from './schemas/$ArrayWithReferences'; +export { $ArrayWithStrings } from './schemas/$ArrayWithStrings'; +export { $CommentWithBackticks } from './schemas/$CommentWithBackticks'; +export { $CommentWithBreaks } from './schemas/$CommentWithBreaks'; +export { $CommentWithExpressionPlaceholders } from './schemas/$CommentWithExpressionPlaceholders'; +export { $CommentWithQuotes } from './schemas/$CommentWithQuotes'; +export { $CommentWithReservedCharacters } from './schemas/$CommentWithReservedCharacters'; +export { $CommentWithSlashes } from './schemas/$CommentWithSlashes'; +export { $Date } from './schemas/$Date'; +export { $DictionaryWithArray } from './schemas/$DictionaryWithArray'; +export { $DictionaryWithDictionary } from './schemas/$DictionaryWithDictionary'; +export { $DictionaryWithProperties } from './schemas/$DictionaryWithProperties'; +export { $DictionaryWithReference } from './schemas/$DictionaryWithReference'; +export { $DictionaryWithString } from './schemas/$DictionaryWithString'; +export { $EnumFromDescription } from './schemas/$EnumFromDescription'; +export { $EnumWithExtensions } from './schemas/$EnumWithExtensions'; +export { $EnumWithNumbers } from './schemas/$EnumWithNumbers'; +export { $EnumWithStrings } from './schemas/$EnumWithStrings'; +export { $ModelThatExtends } from './schemas/$ModelThatExtends'; +export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends'; +export { $ModelWithArray } from './schemas/$ModelWithArray'; +export { $ModelWithBoolean } from './schemas/$ModelWithBoolean'; +export { $ModelWithCircularReference } from './schemas/$ModelWithCircularReference'; +export { $ModelWithDictionary } from './schemas/$ModelWithDictionary'; +export { $ModelWithDuplicateImports } from './schemas/$ModelWithDuplicateImports'; +export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProperties'; +export { $ModelWithEnum } from './schemas/$ModelWithEnum'; +export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription'; +export { $ModelWithInteger } from './schemas/$ModelWithInteger'; +export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums'; +export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties'; +export { $ModelWithNullableString } from './schemas/$ModelWithNullableString'; +export { $ModelWithOrderedProperties } from './schemas/$ModelWithOrderedProperties'; +export { $ModelWithPattern } from './schemas/$ModelWithPattern'; +export { $ModelWithProperties } from './schemas/$ModelWithProperties'; +export { $ModelWithReference } from './schemas/$ModelWithReference'; +export { $ModelWithString } from './schemas/$ModelWithString'; +export { $NonAsciiStringæøåÆØÅöôêÊ字符串 } from './schemas/$NonAsciiStringæøåÆØÅöôêÊ字符串'; +export { $SimpleBoolean } from './schemas/$SimpleBoolean'; +export { $SimpleFile } from './schemas/$SimpleFile'; +export { $SimpleInteger } from './schemas/$SimpleInteger'; +export { $SimpleReference } from './schemas/$SimpleReference'; +export { $SimpleString } from './schemas/$SimpleString'; +export { $SimpleStringWithPattern } from './schemas/$SimpleStringWithPattern'; + +export { CollectionFormatService } from './services/CollectionFormatService'; +export { ComplexService } from './services/ComplexService'; +export { DefaultService } from './services/DefaultService'; +export { DefaultsService } from './services/DefaultsService'; +export { DescriptionsService } from './services/DescriptionsService'; +export { DuplicateService } from './services/DuplicateService'; +export { ErrorService } from './services/ErrorService'; +export { HeaderService } from './services/HeaderService'; +export { MultipleTags1Service } from './services/MultipleTags1Service'; +export { MultipleTags2Service } from './services/MultipleTags2Service'; +export { MultipleTags3Service } from './services/MultipleTags3Service'; +export { NoContentService } from './services/NoContentService'; +export { NonAsciiÆøåÆøÅöôêÊService } from './services/NonAsciiÆøåÆøÅöôêÊService'; +export { ParametersService } from './services/ParametersService'; +export { ResponseService } from './services/ResponseService'; +export { SimpleService } from './services/SimpleService'; +export { TypesService } from './services/TypesService'; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ArrayWithArray.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithArray.ts.snap new file mode 100644 index 000000000..e22d6a4be --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ArrayWithArray.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithArray.ts.ts.snap new file mode 100644 index 000000000..e22d6a4be --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithArray.ts.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__/v2/test/generated/v2/models/ArrayWithBooleans.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithBooleans.ts.snap new file mode 100644 index 000000000..47c9c25ad --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithBooleans.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ArrayWithBooleans.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithBooleans.ts.ts.snap new file mode 100644 index 000000000..47c9c25ad --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithBooleans.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ArrayWithNumbers.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithNumbers.ts.snap new file mode 100644 index 000000000..e19d5c773 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithNumbers.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ArrayWithNumbers.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithNumbers.ts.ts.snap new file mode 100644 index 000000000..e19d5c773 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithNumbers.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ArrayWithProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithProperties.ts.snap new file mode 100644 index 000000000..2cb636892 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ArrayWithProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithProperties.ts.ts.snap new file mode 100644 index 000000000..2cb636892 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithProperties.ts.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__/v2/test/generated/v2/models/ArrayWithReferences.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithReferences.ts.snap new file mode 100644 index 000000000..cce8ccacb --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ArrayWithReferences.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithReferences.ts.ts.snap new file mode 100644 index 000000000..cce8ccacb --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithReferences.ts.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__/v2/test/generated/v2/models/ArrayWithStrings.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithStrings.ts.snap new file mode 100644 index 000000000..df2b24751 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithStrings.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ArrayWithStrings.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithStrings.ts.ts.snap new file mode 100644 index 000000000..df2b24751 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ArrayWithStrings.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array; diff --git a/test/__snapshots__/v2/test/generated/v2/models/CommentWithBackticks.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithBackticks.ts.snap new file mode 100644 index 000000000..8821bb20e --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/CommentWithBackticks.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithBackticks.ts.ts.snap new file mode 100644 index 000000000..8821bb20e --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/CommentWithBackticks.ts.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__/v2/test/generated/v2/models/CommentWithBreaks.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithBreaks.ts.snap new file mode 100644 index 000000000..1901bb6c3 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/CommentWithBreaks.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithBreaks.ts.ts.snap new file mode 100644 index 000000000..1901bb6c3 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/CommentWithBreaks.ts.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__/v2/test/generated/v2/models/CommentWithExpressionPlaceholders.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithExpressionPlaceholders.ts.snap new file mode 100644 index 000000000..5fc8b7e03 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/CommentWithExpressionPlaceholders.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithExpressionPlaceholders.ts.ts.snap new file mode 100644 index 000000000..5fc8b7e03 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/CommentWithExpressionPlaceholders.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; diff --git a/test/__snapshots__/v2/test/generated/v2/models/CommentWithQuotes.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithQuotes.ts.snap new file mode 100644 index 000000000..f5abb3c73 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/CommentWithQuotes.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithQuotes.ts.ts.snap new file mode 100644 index 000000000..f5abb3c73 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/CommentWithQuotes.ts.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__/v2/test/generated/v2/models/CommentWithReservedCharacters.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithReservedCharacters.ts.snap new file mode 100644 index 000000000..0a8ee6de3 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/CommentWithReservedCharacters.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithReservedCharacters.ts.ts.snap new file mode 100644 index 000000000..0a8ee6de3 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/CommentWithReservedCharacters.ts.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__/v2/test/generated/v2/models/CommentWithSlashes.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithSlashes.ts.snap new file mode 100644 index 000000000..ec9d9f26d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/CommentWithSlashes.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/CommentWithSlashes.ts.ts.snap new file mode 100644 index 000000000..ec9d9f26d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/CommentWithSlashes.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ +export type CommentWithSlashes = number; diff --git a/test/__snapshots__/v2/test/generated/v2/models/Date.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/Date.ts.snap new file mode 100644 index 000000000..737654224 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/Date.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a type-only model that defines Date as a string + */ +export type Date = string; diff --git a/test/__snapshots__/v2/test/generated/v2/models/Date.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/Date.ts.ts.snap new file mode 100644 index 000000000..737654224 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/Date.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a type-only model that defines Date as a string + */ +export type Date = string; diff --git a/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithArray.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithArray.ts.snap new file mode 100644 index 000000000..1f607589c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/DictionaryWithArray.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithArray.ts.ts.snap new file mode 100644 index 000000000..1f607589c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithArray.ts.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__/v2/test/generated/v2/models/DictionaryWithDictionary.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithDictionary.ts.snap new file mode 100644 index 000000000..8de230522 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithDictionary.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = Record>; diff --git a/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithDictionary.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithDictionary.ts.ts.snap new file mode 100644 index 000000000..8de230522 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithDictionary.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = Record>; diff --git a/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithProperties.ts.snap new file mode 100644 index 000000000..4997b3540 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/DictionaryWithProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithProperties.ts.ts.snap new file mode 100644 index 000000000..4997b3540 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithProperties.ts.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__/v2/test/generated/v2/models/DictionaryWithReference.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithReference.ts.snap new file mode 100644 index 000000000..9c6984d91 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/DictionaryWithReference.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithReference.ts.ts.snap new file mode 100644 index 000000000..9c6984d91 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithReference.ts.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__/v2/test/generated/v2/models/DictionaryWithString.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithString.ts.snap new file mode 100644 index 000000000..8cdba767c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithString.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a string dictionary + */ +export type DictionaryWithString = Record; diff --git a/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithString.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithString.ts.ts.snap new file mode 100644 index 000000000..8cdba767c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/DictionaryWithString.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a string dictionary + */ +export type DictionaryWithString = Record; diff --git a/test/__snapshots__/v2/test/generated/v2/models/EnumFromDescription.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/EnumFromDescription.ts.snap new file mode 100644 index 000000000..c399deac4 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/EnumFromDescription.ts.snap @@ -0,0 +1,4 @@ +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; diff --git a/test/__snapshots__/v2/test/generated/v2/models/EnumFromDescription.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/EnumFromDescription.ts.ts.snap new file mode 100644 index 000000000..c399deac4 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/EnumFromDescription.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; diff --git a/test/__snapshots__/v2/test/generated/v2/models/EnumWithExtensions.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/EnumWithExtensions.ts.snap new file mode 100644 index 000000000..d5ca1e898 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/EnumWithExtensions.ts.snap @@ -0,0 +1,19 @@ +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export const EnumWithExtensionsEnum = { + /** + * 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, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/models/EnumWithExtensions.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/EnumWithExtensions.ts.ts.snap new file mode 100644 index 000000000..d5ca1e898 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/EnumWithExtensions.ts.ts.snap @@ -0,0 +1,19 @@ +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export const EnumWithExtensionsEnum = { + /** + * 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, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/models/EnumWithNumbers.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/EnumWithNumbers.ts.snap new file mode 100644 index 000000000..b2f85dc12 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/EnumWithNumbers.ts.snap @@ -0,0 +1,22 @@ +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +export const EnumWithNumbersEnum = { + _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, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/models/EnumWithNumbers.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/EnumWithNumbers.ts.ts.snap new file mode 100644 index 000000000..b2f85dc12 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/EnumWithNumbers.ts.ts.snap @@ -0,0 +1,22 @@ +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +export const EnumWithNumbersEnum = { + _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, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/models/EnumWithStrings.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/EnumWithStrings.ts.snap new file mode 100644 index 000000000..126afe0c1 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/EnumWithStrings.ts.snap @@ -0,0 +1,19 @@ +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = + | 'Success' + | 'Warning' + | 'Error' + | "'Single Quote'" + | '"Double Quotes"' + | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export const EnumWithStringsEnum = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + _SINGLE_QUOTE_: "'Single Quote'", + _DOUBLE_QUOTES_: '"Double Quotes"', + NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/models/EnumWithStrings.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/EnumWithStrings.ts.ts.snap new file mode 100644 index 000000000..126afe0c1 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/EnumWithStrings.ts.ts.snap @@ -0,0 +1,19 @@ +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = + | 'Success' + | 'Warning' + | 'Error' + | "'Single Quote'" + | '"Double Quotes"' + | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export const EnumWithStringsEnum = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + _SINGLE_QUOTE_: "'Single Quote'", + _DOUBLE_QUOTES_: '"Double Quotes"', + NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ModelThatExtends.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelThatExtends.ts.snap new file mode 100644 index 000000000..4ae9a1b85 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelThatExtends.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelThatExtends.ts.ts.snap new file mode 100644 index 000000000..4ae9a1b85 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelThatExtends.ts.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__/v2/test/generated/v2/models/ModelThatExtendsExtends.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelThatExtendsExtends.ts.snap new file mode 100644 index 000000000..8207bd040 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelThatExtendsExtends.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelThatExtendsExtends.ts.ts.snap new file mode 100644 index 000000000..8207bd040 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelThatExtendsExtends.ts.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__/v2/test/generated/v2/models/ModelWithArray.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithArray.ts.snap new file mode 100644 index 000000000..b3caea287 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithArray.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithArray.ts.ts.snap new file mode 100644 index 000000000..b3caea287 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithArray.ts.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__/v2/test/generated/v2/models/ModelWithBoolean.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithBoolean.ts.snap new file mode 100644 index 000000000..3fb0b51c4 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithBoolean.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithBoolean.ts.ts.snap new file mode 100644 index 000000000..3fb0b51c4 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithBoolean.ts.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__/v2/test/generated/v2/models/ModelWithCircularReference.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithCircularReference.ts.snap new file mode 100644 index 000000000..02560acd2 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithCircularReference.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithCircularReference.ts.ts.snap new file mode 100644 index 000000000..02560acd2 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithCircularReference.ts.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__/v2/test/generated/v2/models/ModelWithDictionary.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithDictionary.ts.snap new file mode 100644 index 000000000..34e8b2904 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithDictionary.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithDictionary.ts.ts.snap new file mode 100644 index 000000000..34e8b2904 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithDictionary.ts.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__/v2/test/generated/v2/models/ModelWithDuplicateImports.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithDuplicateImports.ts.snap new file mode 100644 index 000000000..55a879e42 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithDuplicateImports.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithDuplicateImports.ts.ts.snap new file mode 100644 index 000000000..55a879e42 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithDuplicateImports.ts.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__/v2/test/generated/v2/models/ModelWithDuplicateProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithDuplicateProperties.ts.snap new file mode 100644 index 000000000..865db789c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithDuplicateProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithDuplicateProperties.ts.ts.snap new file mode 100644 index 000000000..865db789c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithDuplicateProperties.ts.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__/v2/test/generated/v2/models/ModelWithEnum.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithEnum.ts.snap new file mode 100644 index 000000000..848b2f336 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithEnum.ts.snap @@ -0,0 +1,33 @@ +/** + * 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; +}; + +export const TestEnum = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + ØÆÅ字符串: 'ØÆÅ字符串', +} as const; + +export const StatusCodeEnum = { + _100: '100', + _200_FOO: '200 FOO', + _300_FOO_BAR: '300 FOO_BAR', + _400_FOO_BAR: '400 foo-bar', + _500_FOO_BAR: '500 foo.bar', + _600_FOO_BAR: '600 foo&bar', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ModelWithEnum.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithEnum.ts.ts.snap new file mode 100644 index 000000000..848b2f336 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithEnum.ts.ts.snap @@ -0,0 +1,33 @@ +/** + * 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; +}; + +export const TestEnum = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + ØÆÅ字符串: 'ØÆÅ字符串', +} as const; + +export const StatusCodeEnum = { + _100: '100', + _200_FOO: '200 FOO', + _300_FOO_BAR: '300 FOO_BAR', + _400_FOO_BAR: '400 foo-bar', + _500_FOO_BAR: '500 foo.bar', + _600_FOO_BAR: '600 foo&bar', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ModelWithEnumFromDescription.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithEnumFromDescription.ts.snap new file mode 100644 index 000000000..d34988f55 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithEnumFromDescription.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithEnumFromDescription.ts.ts.snap new file mode 100644 index 000000000..d34988f55 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithEnumFromDescription.ts.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__/v2/test/generated/v2/models/ModelWithInteger.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithInteger.ts.snap new file mode 100644 index 000000000..fcf3ed1d6 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithInteger.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithInteger.ts.ts.snap new file mode 100644 index 000000000..fcf3ed1d6 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithInteger.ts.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__/v2/test/generated/v2/models/ModelWithNestedEnums.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithNestedEnums.ts.snap new file mode 100644 index 000000000..8e1ed1cd8 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithNestedEnums.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithNestedEnums.ts.ts.snap new file mode 100644 index 000000000..8e1ed1cd8 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithNestedEnums.ts.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__/v2/test/generated/v2/models/ModelWithNestedProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithNestedProperties.ts.snap new file mode 100644 index 000000000..8433962f3 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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; + }; + }; +}; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ModelWithNestedProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithNestedProperties.ts.ts.snap new file mode 100644 index 000000000..8433962f3 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithNestedProperties.ts.ts.snap @@ -0,0 +1,10 @@ +/** + * This is a model with one nested property + */ +export type ModelWithNestedProperties = { + readonly first: { + readonly second: { + readonly third: string; + }; + }; +}; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ModelWithNullableString.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithNullableString.ts.snap new file mode 100644 index 000000000..df207875f --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithNullableString.ts.snap @@ -0,0 +1,13 @@ +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp: string | null; +}; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ModelWithNullableString.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithNullableString.ts.ts.snap new file mode 100644 index 000000000..df207875f --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithNullableString.ts.ts.snap @@ -0,0 +1,13 @@ +/** + * This is a model with one string property + */ +export type ModelWithNullableString = { + /** + * This is a simple string property + */ + nullableProp?: string | null; + /** + * This is a simple string property + */ + nullableRequiredProp: string | null; +}; diff --git a/test/__snapshots__/v2/test/generated/v2/models/ModelWithOrderedProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithOrderedProperties.ts.snap new file mode 100644 index 000000000..d9e532738 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithOrderedProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithOrderedProperties.ts.ts.snap new file mode 100644 index 000000000..d9e532738 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithOrderedProperties.ts.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__/v2/test/generated/v2/models/ModelWithPattern.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithPattern.ts.snap new file mode 100644 index 000000000..ca88e528c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithPattern.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithPattern.ts.ts.snap new file mode 100644 index 000000000..ca88e528c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithPattern.ts.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__/v2/test/generated/v2/models/ModelWithProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithProperties.ts.snap new file mode 100644 index 000000000..0d909b539 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithProperties.ts.snap @@ -0,0 +1,18 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + 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__/v2/test/generated/v2/models/ModelWithProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithProperties.ts.ts.snap new file mode 100644 index 000000000..0d909b539 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithProperties.ts.ts.snap @@ -0,0 +1,18 @@ +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model with one nested property + */ +export type ModelWithProperties = { + required: string; + readonly requiredAndReadOnly: string; + 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__/v2/test/generated/v2/models/ModelWithReference.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithReference.ts.snap new file mode 100644 index 000000000..80dbd078b --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithReference.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithReference.ts.ts.snap new file mode 100644 index 000000000..80dbd078b --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithReference.ts.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__/v2/test/generated/v2/models/ModelWithString.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithString.ts.snap new file mode 100644 index 000000000..7e0e7b336 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/ModelWithString.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/ModelWithString.ts.ts.snap new file mode 100644 index 000000000..7e0e7b336 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/ModelWithString.ts.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__/v2/test/generated/v2/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__/v2/test/generated/v2/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__/v2/test/generated/v2/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__/v2/test/generated/v2/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.ts.snap" "b/test/__snapshots__/v2/test/generated/v2/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.ts.snap" new file mode 100644 index 000000000..72359bbde --- /dev/null +++ "b/test/__snapshots__/v2/test/generated/v2/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.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__/v2/test/generated/v2/models/SimpleBoolean.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleBoolean.ts.snap new file mode 100644 index 000000000..99b020679 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/SimpleBoolean.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; diff --git a/test/__snapshots__/v2/test/generated/v2/models/SimpleBoolean.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleBoolean.ts.ts.snap new file mode 100644 index 000000000..99b020679 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/SimpleBoolean.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; diff --git a/test/__snapshots__/v2/test/generated/v2/models/SimpleFile.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleFile.ts.snap new file mode 100644 index 000000000..b206fcf96 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/SimpleFile.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple file + */ +export type SimpleFile = Blob; diff --git a/test/__snapshots__/v2/test/generated/v2/models/SimpleFile.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleFile.ts.ts.snap new file mode 100644 index 000000000..b206fcf96 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/SimpleFile.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple file + */ +export type SimpleFile = Blob; diff --git a/test/__snapshots__/v2/test/generated/v2/models/SimpleInteger.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleInteger.ts.snap new file mode 100644 index 000000000..7a547a495 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/SimpleInteger.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple number + */ +export type SimpleInteger = number; diff --git a/test/__snapshots__/v2/test/generated/v2/models/SimpleInteger.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleInteger.ts.ts.snap new file mode 100644 index 000000000..7a547a495 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/SimpleInteger.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple number + */ +export type SimpleInteger = number; diff --git a/test/__snapshots__/v2/test/generated/v2/models/SimpleReference.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleReference.ts.snap new file mode 100644 index 000000000..d4ddda16f --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/models/SimpleReference.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleReference.ts.ts.snap new file mode 100644 index 000000000..d4ddda16f --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/SimpleReference.ts.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__/v2/test/generated/v2/models/SimpleString.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleString.ts.snap new file mode 100644 index 000000000..ce4410ecf --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/SimpleString.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple string + */ +export type SimpleString = string; diff --git a/test/__snapshots__/v2/test/generated/v2/models/SimpleString.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleString.ts.ts.snap new file mode 100644 index 000000000..ce4410ecf --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/SimpleString.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple string + */ +export type SimpleString = string; diff --git a/test/__snapshots__/v2/test/generated/v2/models/SimpleStringWithPattern.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleStringWithPattern.ts.snap new file mode 100644 index 000000000..10eacc0ba --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/SimpleStringWithPattern.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple string + */ +export type SimpleStringWithPattern = string; diff --git a/test/__snapshots__/v2/test/generated/v2/models/SimpleStringWithPattern.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/SimpleStringWithPattern.ts.ts.snap new file mode 100644 index 000000000..10eacc0ba --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/SimpleStringWithPattern.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple string + */ +export type SimpleStringWithPattern = string; diff --git a/test/__snapshots__/v2/test/generated/v2/models/_default.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/_default.ts.snap new file mode 100644 index 000000000..0867799ba --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/_default.ts.snap @@ -0,0 +1,3 @@ +export type _default = { + name?: string; +}; diff --git a/test/__snapshots__/v2/test/generated/v2/models/_default.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/models/_default.ts.ts.snap new file mode 100644 index 000000000..0867799ba --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/models/_default.ts.ts.snap @@ -0,0 +1,3 @@ +export type _default = { + name?: string; +}; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithArray.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithArray.ts.snap new file mode 100644 index 000000000..ff5558c55 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ArrayWithArray.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithArray.ts.ts.snap new file mode 100644 index 000000000..ff5558c55 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithArray.ts.ts.snap @@ -0,0 +1,9 @@ +export const $ArrayWithArray = { + type: 'array', + contains: { + type: 'array', + contains: { + type: 'ModelWithString', + }, + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithBooleans.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithBooleans.ts.snap new file mode 100644 index 000000000..74eee001b --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithBooleans.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithBooleans = { + type: 'array', + contains: { + type: 'boolean', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithBooleans.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithBooleans.ts.ts.snap new file mode 100644 index 000000000..74eee001b --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithBooleans.ts.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithBooleans = { + type: 'array', + contains: { + type: 'boolean', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithNumbers.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithNumbers.ts.snap new file mode 100644 index 000000000..4aa83e3bc --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithNumbers.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithNumbers = { + type: 'array', + contains: { + type: 'number', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithNumbers.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithNumbers.ts.ts.snap new file mode 100644 index 000000000..4aa83e3bc --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithNumbers.ts.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithNumbers = { + type: 'array', + contains: { + type: 'number', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithProperties.ts.snap new file mode 100644 index 000000000..96a1feb9c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ArrayWithProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithProperties.ts.ts.snap new file mode 100644 index 000000000..96a1feb9c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithProperties.ts.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__/v2/test/generated/v2/schemas/$ArrayWithReferences.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithReferences.ts.snap new file mode 100644 index 000000000..8954542ce --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithReferences.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithReferences = { + type: 'array', + contains: { + type: 'ModelWithString', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithReferences.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithReferences.ts.ts.snap new file mode 100644 index 000000000..8954542ce --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithReferences.ts.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithReferences = { + type: 'array', + contains: { + type: 'ModelWithString', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithStrings.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithStrings.ts.snap new file mode 100644 index 000000000..6960a863c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithStrings.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithStrings = { + type: 'array', + contains: { + type: 'string', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithStrings.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithStrings.ts.ts.snap new file mode 100644 index 000000000..6960a863c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ArrayWithStrings.ts.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithStrings = { + type: 'array', + contains: { + type: 'string', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithBackticks.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithBackticks.ts.snap new file mode 100644 index 000000000..80988c7ee --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$CommentWithBackticks.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithBackticks.ts.ts.snap new file mode 100644 index 000000000..80988c7ee --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithBackticks.ts.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__/v2/test/generated/v2/schemas/$CommentWithBreaks.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithBreaks.ts.snap new file mode 100644 index 000000000..8f5c9d94d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$CommentWithBreaks.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithBreaks.ts.ts.snap new file mode 100644 index 000000000..8f5c9d94d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithBreaks.ts.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__/v2/test/generated/v2/schemas/$CommentWithExpressionPlaceholders.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithExpressionPlaceholders.ts.snap new file mode 100644 index 000000000..dffe2676e --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$CommentWithExpressionPlaceholders.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithExpressionPlaceholders.ts.ts.snap new file mode 100644 index 000000000..dffe2676e --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithExpressionPlaceholders.ts.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__/v2/test/generated/v2/schemas/$CommentWithQuotes.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithQuotes.ts.snap new file mode 100644 index 000000000..a71cb895a --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$CommentWithQuotes.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithQuotes.ts.ts.snap new file mode 100644 index 000000000..a71cb895a --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithQuotes.ts.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__/v2/test/generated/v2/schemas/$CommentWithReservedCharacters.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithReservedCharacters.ts.snap new file mode 100644 index 000000000..1436feefa --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$CommentWithReservedCharacters.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithReservedCharacters.ts.ts.snap new file mode 100644 index 000000000..1436feefa --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithReservedCharacters.ts.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__/v2/test/generated/v2/schemas/$CommentWithSlashes.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithSlashes.ts.snap new file mode 100644 index 000000000..6f72210de --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$CommentWithSlashes.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithSlashes.ts.ts.snap new file mode 100644 index 000000000..6f72210de --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$CommentWithSlashes.ts.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__/v2/test/generated/v2/schemas/$Date.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$Date.ts.snap new file mode 100644 index 000000000..6c797f179 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$Date.ts.snap @@ -0,0 +1,4 @@ +export const $Date = { + type: 'string', + description: `This is a type-only model that defines Date as a string`, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$Date.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$Date.ts.ts.snap new file mode 100644 index 000000000..6c797f179 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$Date.ts.ts.snap @@ -0,0 +1,4 @@ +export const $Date = { + type: 'string', + description: `This is a type-only model that defines Date as a string`, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithArray.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithArray.ts.snap new file mode 100644 index 000000000..265bcb6f8 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$DictionaryWithArray.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithArray.ts.ts.snap new file mode 100644 index 000000000..265bcb6f8 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithArray.ts.ts.snap @@ -0,0 +1,9 @@ +export const $DictionaryWithArray = { + type: 'dictionary', + contains: { + type: 'array', + contains: { + type: 'ModelWithString', + }, + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithDictionary.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithDictionary.ts.snap new file mode 100644 index 000000000..9c65fceec --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$DictionaryWithDictionary.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithDictionary.ts.ts.snap new file mode 100644 index 000000000..9c65fceec --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithDictionary.ts.ts.snap @@ -0,0 +1,9 @@ +export const $DictionaryWithDictionary = { + type: 'dictionary', + contains: { + type: 'dictionary', + contains: { + type: 'string', + }, + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithProperties.ts.snap new file mode 100644 index 000000000..3c5686647 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$DictionaryWithProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithProperties.ts.ts.snap new file mode 100644 index 000000000..3c5686647 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithProperties.ts.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__/v2/test/generated/v2/schemas/$DictionaryWithReference.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithReference.ts.snap new file mode 100644 index 000000000..a17eceac4 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithReference.ts.snap @@ -0,0 +1,6 @@ +export const $DictionaryWithReference = { + type: 'dictionary', + contains: { + type: 'ModelWithString', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithReference.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithReference.ts.ts.snap new file mode 100644 index 000000000..a17eceac4 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithReference.ts.ts.snap @@ -0,0 +1,6 @@ +export const $DictionaryWithReference = { + type: 'dictionary', + contains: { + type: 'ModelWithString', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithString.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithString.ts.snap new file mode 100644 index 000000000..82e59b164 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithString.ts.snap @@ -0,0 +1,6 @@ +export const $DictionaryWithString = { + type: 'dictionary', + contains: { + type: 'string', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithString.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithString.ts.ts.snap new file mode 100644 index 000000000..82e59b164 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$DictionaryWithString.ts.ts.snap @@ -0,0 +1,6 @@ +export const $DictionaryWithString = { + type: 'dictionary', + contains: { + type: 'string', + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$EnumFromDescription.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumFromDescription.ts.snap new file mode 100644 index 000000000..55e07639d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$EnumFromDescription.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumFromDescription.ts.ts.snap new file mode 100644 index 000000000..55e07639d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumFromDescription.ts.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__/v2/test/generated/v2/schemas/$EnumWithExtensions.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithExtensions.ts.snap new file mode 100644 index 000000000..0dcfaa539 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithExtensions.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithExtensions = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithExtensions.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithExtensions.ts.ts.snap new file mode 100644 index 000000000..0dcfaa539 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithExtensions.ts.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithExtensions = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithNumbers.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithNumbers.ts.snap new file mode 100644 index 000000000..d571cd240 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithNumbers.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithNumbers = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithNumbers.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithNumbers.ts.ts.snap new file mode 100644 index 000000000..d571cd240 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithNumbers.ts.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithNumbers = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithStrings.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithStrings.ts.snap new file mode 100644 index 000000000..a44fadd2f --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithStrings.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithStrings = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithStrings.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithStrings.ts.ts.snap new file mode 100644 index 000000000..a44fadd2f --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$EnumWithStrings.ts.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithStrings = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ModelThatExtends.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelThatExtends.ts.snap new file mode 100644 index 000000000..c9b2fb64e --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelThatExtends.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelThatExtends.ts.ts.snap new file mode 100644 index 000000000..c9b2fb64e --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelThatExtends.ts.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__/v2/test/generated/v2/schemas/$ModelThatExtendsExtends.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelThatExtendsExtends.ts.snap new file mode 100644 index 000000000..ade58bc66 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelThatExtendsExtends.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelThatExtendsExtends.ts.ts.snap new file mode 100644 index 000000000..ade58bc66 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelThatExtendsExtends.ts.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__/v2/test/generated/v2/schemas/$ModelWithArray.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithArray.ts.snap new file mode 100644 index 000000000..a45c6dc1e --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithArray.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithArray.ts.ts.snap new file mode 100644 index 000000000..a45c6dc1e --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithArray.ts.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__/v2/test/generated/v2/schemas/$ModelWithBoolean.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithBoolean.ts.snap new file mode 100644 index 000000000..ddea6e065 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithBoolean.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithBoolean.ts.ts.snap new file mode 100644 index 000000000..ddea6e065 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithBoolean.ts.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__/v2/test/generated/v2/schemas/$ModelWithCircularReference.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithCircularReference.ts.snap new file mode 100644 index 000000000..6bdf72a9d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithCircularReference.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithCircularReference.ts.ts.snap new file mode 100644 index 000000000..6bdf72a9d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithCircularReference.ts.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__/v2/test/generated/v2/schemas/$ModelWithDictionary.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDictionary.ts.snap new file mode 100644 index 000000000..1206c8664 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithDictionary.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDictionary.ts.ts.snap new file mode 100644 index 000000000..1206c8664 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDictionary.ts.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__/v2/test/generated/v2/schemas/$ModelWithDuplicateImports.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDuplicateImports.ts.snap new file mode 100644 index 000000000..43d77d2d9 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithDuplicateImports.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDuplicateImports.ts.ts.snap new file mode 100644 index 000000000..43d77d2d9 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDuplicateImports.ts.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__/v2/test/generated/v2/schemas/$ModelWithDuplicateProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDuplicateProperties.ts.snap new file mode 100644 index 000000000..e0b6a9210 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithDuplicateProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDuplicateProperties.ts.ts.snap new file mode 100644 index 000000000..e0b6a9210 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithDuplicateProperties.ts.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__/v2/test/generated/v2/schemas/$ModelWithEnum.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithEnum.ts.snap new file mode 100644 index 000000000..51a60c553 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithEnum.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithEnum.ts.ts.snap new file mode 100644 index 000000000..51a60c553 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithEnum.ts.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__/v2/test/generated/v2/schemas/$ModelWithEnumFromDescription.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithEnumFromDescription.ts.snap new file mode 100644 index 000000000..0e07bbbd0 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithEnumFromDescription.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithEnumFromDescription.ts.ts.snap new file mode 100644 index 000000000..0e07bbbd0 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithEnumFromDescription.ts.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__/v2/test/generated/v2/schemas/$ModelWithInteger.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithInteger.ts.snap new file mode 100644 index 000000000..99a8b75e6 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithInteger.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithInteger.ts.ts.snap new file mode 100644 index 000000000..99a8b75e6 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithInteger.ts.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__/v2/test/generated/v2/schemas/$ModelWithNestedEnums.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedEnums.ts.snap new file mode 100644 index 000000000..646cd8612 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithNestedEnums.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedEnums.ts.ts.snap new file mode 100644 index 000000000..646cd8612 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedEnums.ts.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__/v2/test/generated/v2/schemas/$ModelWithNestedProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedProperties.ts.snap new file mode 100644 index 000000000..d9af2b359 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedProperties.ts.snap @@ -0,0 +1,22 @@ +export const $ModelWithNestedProperties = { + description: `This is a model with one nested property`, + properties: { + first: { + properties: { + second: { + properties: { + third: { + type: 'string', + isReadOnly: true, + isRequired: true, + }, + }, + isReadOnly: true, + isRequired: true, + }, + }, + isReadOnly: true, + isRequired: true, + }, + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedProperties.ts.ts.snap new file mode 100644 index 000000000..d9af2b359 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNestedProperties.ts.ts.snap @@ -0,0 +1,22 @@ +export const $ModelWithNestedProperties = { + description: `This is a model with one nested property`, + properties: { + first: { + properties: { + second: { + properties: { + third: { + type: 'string', + isReadOnly: true, + isRequired: true, + }, + }, + isReadOnly: true, + isRequired: true, + }, + }, + isReadOnly: true, + isRequired: true, + }, + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNullableString.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNullableString.ts.snap new file mode 100644 index 000000000..9b7978f7b --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNullableString.ts.snap @@ -0,0 +1,16 @@ +export const $ModelWithNullableString = { + description: `This is a model with one string property`, + properties: { + nullableProp: { + type: 'string', + description: `This is a simple string property`, + isNullable: true, + }, + nullableRequiredProp: { + type: 'string', + description: `This is a simple string property`, + isRequired: true, + isNullable: true, + }, + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNullableString.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNullableString.ts.ts.snap new file mode 100644 index 000000000..9b7978f7b --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithNullableString.ts.ts.snap @@ -0,0 +1,16 @@ +export const $ModelWithNullableString = { + description: `This is a model with one string property`, + properties: { + nullableProp: { + type: 'string', + description: `This is a simple string property`, + isNullable: true, + }, + nullableRequiredProp: { + type: 'string', + description: `This is a simple string property`, + isRequired: true, + isNullable: true, + }, + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithOrderedProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithOrderedProperties.ts.snap new file mode 100644 index 000000000..b26c44366 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithOrderedProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithOrderedProperties.ts.ts.snap new file mode 100644 index 000000000..b26c44366 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithOrderedProperties.ts.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__/v2/test/generated/v2/schemas/$ModelWithPattern.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithPattern.ts.snap new file mode 100644 index 000000000..be54e210f --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithPattern.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithPattern.ts.ts.snap new file mode 100644 index 000000000..be54e210f --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithPattern.ts.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__/v2/test/generated/v2/schemas/$ModelWithProperties.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithProperties.ts.snap new file mode 100644 index 000000000..fa43ba0c5 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithProperties.ts.snap @@ -0,0 +1,43 @@ +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, + }, + 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__/v2/test/generated/v2/schemas/$ModelWithProperties.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithProperties.ts.ts.snap new file mode 100644 index 000000000..fa43ba0c5 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithProperties.ts.ts.snap @@ -0,0 +1,43 @@ +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, + }, + 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__/v2/test/generated/v2/schemas/$ModelWithReference.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithReference.ts.snap new file mode 100644 index 000000000..92b55aa89 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithReference.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithReference.ts.ts.snap new file mode 100644 index 000000000..92b55aa89 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithReference.ts.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__/v2/test/generated/v2/schemas/$ModelWithString.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithString.ts.snap new file mode 100644 index 000000000..6fe3639a7 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$ModelWithString.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithString.ts.ts.snap new file mode 100644 index 000000000..6fe3639a7 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$ModelWithString.ts.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__/v2/test/generated/v2/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__/v2/test/generated/v2/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__/v2/test/generated/v2/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__/v2/test/generated/v2/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.ts.snap" "b/test/__snapshots__/v2/test/generated/v2/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.ts.snap" new file mode 100644 index 000000000..e13d8b667 --- /dev/null +++ "b/test/__snapshots__/v2/test/generated/v2/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.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__/v2/test/generated/v2/schemas/$SimpleBoolean.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleBoolean.ts.snap new file mode 100644 index 000000000..2b76fbf1a --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$SimpleBoolean.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleBoolean.ts.ts.snap new file mode 100644 index 000000000..2b76fbf1a --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleBoolean.ts.ts.snap @@ -0,0 +1,4 @@ +export const $SimpleBoolean = { + type: 'boolean', + description: `This is a simple boolean`, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleFile.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleFile.ts.snap new file mode 100644 index 000000000..2b54958e2 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$SimpleFile.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleFile.ts.ts.snap new file mode 100644 index 000000000..2b54958e2 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleFile.ts.ts.snap @@ -0,0 +1,4 @@ +export const $SimpleFile = { + type: 'binary', + description: `This is a simple file`, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleInteger.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleInteger.ts.snap new file mode 100644 index 000000000..c4607071c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$SimpleInteger.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleInteger.ts.ts.snap new file mode 100644 index 000000000..c4607071c --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleInteger.ts.ts.snap @@ -0,0 +1,4 @@ +export const $SimpleInteger = { + type: 'number', + description: `This is a simple number`, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleReference.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleReference.ts.snap new file mode 100644 index 000000000..02091af33 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$SimpleReference.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleReference.ts.ts.snap new file mode 100644 index 000000000..02091af33 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleReference.ts.ts.snap @@ -0,0 +1,4 @@ +export const $SimpleReference = { + type: 'ModelWithString', + description: `This is a simple reference`, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleString.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleString.ts.snap new file mode 100644 index 000000000..ad4de9003 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/schemas/$SimpleString.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleString.ts.ts.snap new file mode 100644 index 000000000..ad4de9003 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleString.ts.ts.snap @@ -0,0 +1,4 @@ +export const $SimpleString = { + type: 'string', + description: `This is a simple string`, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleStringWithPattern.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleStringWithPattern.ts.snap new file mode 100644 index 000000000..63d4d57d4 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleStringWithPattern.ts.snap @@ -0,0 +1,6 @@ +export const $SimpleStringWithPattern = { + type: 'string', + description: `This is a simple string`, + maxLength: 64, + pattern: '^[a-zA-Z0-9_]*$', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleStringWithPattern.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleStringWithPattern.ts.ts.snap new file mode 100644 index 000000000..63d4d57d4 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$SimpleStringWithPattern.ts.ts.snap @@ -0,0 +1,6 @@ +export const $SimpleStringWithPattern = { + type: 'string', + description: `This is a simple string`, + maxLength: 64, + pattern: '^[a-zA-Z0-9_]*$', +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$_default.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$_default.ts.snap new file mode 100644 index 000000000..c8fa6c53e --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$_default.ts.snap @@ -0,0 +1,7 @@ +export const $_default = { + properties: { + name: { + type: 'string', + }, + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/schemas/$_default.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/schemas/$_default.ts.ts.snap new file mode 100644 index 000000000..c8fa6c53e --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/schemas/$_default.ts.ts.snap @@ -0,0 +1,7 @@ +export const $_default = { + properties: { + name: { + type: 'string', + }, + }, +} as const; diff --git a/test/__snapshots__/v2/test/generated/v2/services/CollectionFormatService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/CollectionFormatService.ts.snap new file mode 100644 index 000000000..35cb1d748 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySsv: Array; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTsv: Array; +}; + +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__/v2/test/generated/v2/services/CollectionFormatService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/CollectionFormatService.ts.ts.snap new file mode 100644 index 000000000..35cb1d748 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/CollectionFormatService.ts.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; + /** + * This is an array parameter that is sent as multi format (multiple parameter instances) + */ + parameterArrayMulti: Array; + /** + * This is an array parameter that is sent as pipes format (pipe-separated values) + */ + parameterArrayPipes: Array; + /** + * This is an array parameter that is sent as ssv format (space-separated values) + */ + parameterArraySsv: Array; + /** + * This is an array parameter that is sent as tsv format (tab-separated values) + */ + parameterArrayTsv: Array; +}; + +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__/v2/test/generated/v2/services/ComplexService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/ComplexService.ts.snap new file mode 100644 index 000000000..e76236ae8 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/ComplexService.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 TDataComplexTypes = { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; +}; + +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`, + }, + }); + } +} diff --git a/test/__snapshots__/v2/test/generated/v2/services/ComplexService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/ComplexService.ts.ts.snap new file mode 100644 index 000000000..e76236ae8 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/ComplexService.ts.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 TDataComplexTypes = { + /** + * Parameter containing object + */ + parameterObject: { + first?: { + second?: { + third?: string; + }; + }; + }; + /** + * Parameter containing reference + */ + parameterReference: ModelWithString; +}; + +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`, + }, + }); + } +} diff --git a/test/__snapshots__/v2/test/generated/v2/services/DefaultService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/DefaultService.ts.snap new file mode 100644 index 000000000..f8039bead --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/DefaultService.ts.snap @@ -0,0 +1,15 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class DefaultService { + /** + * @throws ApiError + */ + public static serviceWithEmptyTag(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-tag', + }); + } +} diff --git a/test/__snapshots__/v2/test/generated/v2/services/DefaultService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/DefaultService.ts.ts.snap new file mode 100644 index 000000000..f8039bead --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/DefaultService.ts.ts.snap @@ -0,0 +1,15 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export class DefaultService { + /** + * @throws ApiError + */ + public static serviceWithEmptyTag(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v{api-version}/no-tag', + }); + } +} diff --git a/test/__snapshots__/v2/test/generated/v2/services/DefaultsService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/DefaultsService.ts.snap new file mode 100644 index 000000000..a80783668 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number with default value + */ + parameterNumber?: number; + /** + * This is a simple string with default value + */ + parameterString?: string; +}; +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__/v2/test/generated/v2/services/DefaultsService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/DefaultsService.ts.ts.snap new file mode 100644 index 000000000..a80783668 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/DefaultsService.ts.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; + /** + * This is a simple enum with default value + */ + parameterEnum?: 'Success' | 'Warning' | 'Error'; + /** + * This is a simple model with default value + */ + parameterModel?: ModelWithString; + /** + * This is a simple number with default value + */ + parameterNumber?: number; + /** + * This is a simple string with default value + */ + parameterString?: string; +}; +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__/v2/test/generated/v2/services/DescriptionsService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/DescriptionsService.ts.snap new file mode 100644 index 000000000..78d1d560b --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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?: string; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: string; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: string; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: string; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: string; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: string; +}; + +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__/v2/test/generated/v2/services/DescriptionsService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/DescriptionsService.ts.ts.snap new file mode 100644 index 000000000..78d1d560b --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/DescriptionsService.ts.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?: string; + /** + * Testing multiline comments in string: First line + * Second line + * + * Fourth line + */ + parameterWithBreaks?: string; + /** + * Testing expression placeholders in string: ${expression} should work + */ + parameterWithExpressionPlaceholders?: string; + /** + * Testing quotes in string: 'single quote''' and "double quotes""" should work + */ + parameterWithQuotes?: string; + /** + * Testing reserved characters in string: * inline * and ** inline ** should work + */ + parameterWithReservedCharacters?: string; + /** + * Testing slashes in string: \backwards\\\ and /forwards/// should work + */ + parameterWithSlashes?: string; +}; + +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__/v2/test/generated/v2/services/DuplicateService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/DuplicateService.ts.snap new file mode 100644 index 000000000..7381aac77 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/services/DuplicateService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/DuplicateService.ts.ts.snap new file mode 100644 index 000000000..7381aac77 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/DuplicateService.ts.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__/v2/test/generated/v2/services/ErrorService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/ErrorService.ts.snap new file mode 100644 index 000000000..35b6cd253 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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: string; +}; + +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__/v2/test/generated/v2/services/ErrorService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/ErrorService.ts.ts.snap new file mode 100644 index 000000000..35b6cd253 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/ErrorService.ts.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: string; +}; + +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__/v2/test/generated/v2/services/HeaderService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/HeaderService.ts.snap new file mode 100644 index 000000000..e451c3035 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/services/HeaderService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/HeaderService.ts.ts.snap new file mode 100644 index 000000000..e451c3035 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/HeaderService.ts.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__/v2/test/generated/v2/services/MultipleTags1Service.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/MultipleTags1Service.ts.snap new file mode 100644 index 000000000..21cac6e19 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/services/MultipleTags1Service.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/MultipleTags1Service.ts.ts.snap new file mode 100644 index 000000000..21cac6e19 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/MultipleTags1Service.ts.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__/v2/test/generated/v2/services/MultipleTags2Service.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/MultipleTags2Service.ts.snap new file mode 100644 index 000000000..1c86961ad --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/services/MultipleTags2Service.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/MultipleTags2Service.ts.ts.snap new file mode 100644 index 000000000..1c86961ad --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/MultipleTags2Service.ts.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__/v2/test/generated/v2/services/MultipleTags3Service.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/MultipleTags3Service.ts.snap new file mode 100644 index 000000000..15fc09d44 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/services/MultipleTags3Service.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/MultipleTags3Service.ts.ts.snap new file mode 100644 index 000000000..15fc09d44 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/MultipleTags3Service.ts.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__/v2/test/generated/v2/services/NoContentService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/NoContentService.ts.snap new file mode 100644 index 000000000..c7836aaf8 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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 any 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__/v2/test/generated/v2/services/NoContentService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/NoContentService.ts.ts.snap new file mode 100644 index 000000000..c7836aaf8 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/NoContentService.ts.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 any 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__/v2/test/generated/v2/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__/v2/test/generated/v2/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..692693edd --- /dev/null +++ "b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.ts.snap" "b/test/__snapshots__/v2/test/generated/v2/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.ts.snap" new file mode 100644 index 000000000..692693edd --- /dev/null +++ "b/test/__snapshots__/v2/test/generated/v2/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.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__/v2/test/generated/v2/services/ParametersService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/ParametersService.ts.snap new file mode 100644 index 000000000..9dd6a1267 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/ParametersService.ts.snap @@ -0,0 +1,122 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataCallWithParameters = { + /** + * This is the parameter that is sent as request body + */ + parameterBody: string; + /** + * This is the parameter that goes into the form data + */ + parameterForm: string; + /** + * This is the parameter that goes into the header + */ + parameterHeader: string; + /** + * This is the parameter that goes into the path + */ + parameterPath: string; + /** + * This is the parameter that goes into the query params + */ + parameterQuery: string; +}; +export type TDataCallWithWeirdParameterNames = { + /** + * This is the parameter with a reserved keyword + */ + _default?: string; + /** + * This is the parameter that is sent as request body + */ + parameterBody: string; + /** + * This is the parameter that goes into the request form data + */ + parameterForm: string; + /** + * This is the parameter that goes into the request header + */ + parameterHeader: string; + /** + * 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; +}; + +export class ParametersService { + /** + * @throws ApiError + */ + public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { + const { parameterBody, parameterForm, parameterHeader, parameterPath, parameterQuery } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameterPath}', + path: { + parameterPath, + }, + headers: { + parameterHeader, + }, + query: { + parameterQuery, + }, + formData: { + parameterForm, + }, + body: parameterBody, + }); + } + + /** + * @throws ApiError + */ + public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { + const { + _default, + parameterBody, + parameterForm, + parameterHeader, + parameterPath1, + parameterPath2, + parameterPath3, + parameterQuery, + } = 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, + }, + headers: { + 'parameter.header': parameterHeader, + }, + query: { + default: _default, + 'parameter-query': parameterQuery, + }, + formData: { + parameter_form: parameterForm, + }, + body: parameterBody, + }); + } +} diff --git a/test/__snapshots__/v2/test/generated/v2/services/ParametersService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/ParametersService.ts.ts.snap new file mode 100644 index 000000000..9dd6a1267 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/ParametersService.ts.ts.snap @@ -0,0 +1,122 @@ +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; + +export type TDataCallWithParameters = { + /** + * This is the parameter that is sent as request body + */ + parameterBody: string; + /** + * This is the parameter that goes into the form data + */ + parameterForm: string; + /** + * This is the parameter that goes into the header + */ + parameterHeader: string; + /** + * This is the parameter that goes into the path + */ + parameterPath: string; + /** + * This is the parameter that goes into the query params + */ + parameterQuery: string; +}; +export type TDataCallWithWeirdParameterNames = { + /** + * This is the parameter with a reserved keyword + */ + _default?: string; + /** + * This is the parameter that is sent as request body + */ + parameterBody: string; + /** + * This is the parameter that goes into the request form data + */ + parameterForm: string; + /** + * This is the parameter that goes into the request header + */ + parameterHeader: string; + /** + * 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; +}; + +export class ParametersService { + /** + * @throws ApiError + */ + public static callWithParameters(data: TDataCallWithParameters): CancelablePromise { + const { parameterBody, parameterForm, parameterHeader, parameterPath, parameterQuery } = data; + return __request(OpenAPI, { + method: 'POST', + url: '/api/v{api-version}/parameters/{parameterPath}', + path: { + parameterPath, + }, + headers: { + parameterHeader, + }, + query: { + parameterQuery, + }, + formData: { + parameterForm, + }, + body: parameterBody, + }); + } + + /** + * @throws ApiError + */ + public static callWithWeirdParameterNames(data: TDataCallWithWeirdParameterNames): CancelablePromise { + const { + _default, + parameterBody, + parameterForm, + parameterHeader, + parameterPath1, + parameterPath2, + parameterPath3, + parameterQuery, + } = 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, + }, + headers: { + 'parameter.header': parameterHeader, + }, + query: { + default: _default, + 'parameter-query': parameterQuery, + }, + formData: { + parameter_form: parameterForm, + }, + body: parameterBody, + }); + } +} diff --git a/test/__snapshots__/v2/test/generated/v2/services/ResponseService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/ResponseService.ts.snap new file mode 100644 index 000000000..9a53f3147 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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 any 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 Message for default response + * @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__/v2/test/generated/v2/services/ResponseService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/ResponseService.ts.ts.snap new file mode 100644 index 000000000..9a53f3147 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/ResponseService.ts.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 any 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 Message for default response + * @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__/v2/test/generated/v2/services/SimpleService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/SimpleService.ts.snap new file mode 100644 index 000000000..733ff7439 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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__/v2/test/generated/v2/services/SimpleService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/SimpleService.ts.ts.snap new file mode 100644 index 000000000..733ff7439 --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/SimpleService.ts.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__/v2/test/generated/v2/services/TypesService.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/TypesService.ts.snap new file mode 100644 index 000000000..a0bee9c3d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/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; + /** + * This is a boolean parameter + */ + parameterBoolean?: boolean; + /** + * This is a dictionary parameter + */ + parameterDictionary: Record; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error'; + /** + * This is a number parameter + */ + parameterNumber?: number; + /** + * This is an object parameter + */ + parameterObject?: unknown; + /** + * This is a string parameter + */ + parameterString?: string; +}; + +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 any 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__/v2/test/generated/v2/services/TypesService.ts.ts.snap b/test/__snapshots__/v2/test/generated/v2/services/TypesService.ts.ts.snap new file mode 100644 index 000000000..a0bee9c3d --- /dev/null +++ b/test/__snapshots__/v2/test/generated/v2/services/TypesService.ts.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; + /** + * This is a boolean parameter + */ + parameterBoolean?: boolean; + /** + * This is a dictionary parameter + */ + parameterDictionary: Record; + /** + * This is an enum parameter + */ + parameterEnum: 'Success' | 'Warning' | 'Error'; + /** + * This is a number parameter + */ + parameterNumber?: number; + /** + * This is an object parameter + */ + parameterObject?: unknown; + /** + * This is a string parameter + */ + parameterString?: string; +}; + +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 any 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-date/test/generated/v3_date/index.ts.snap b/test/__snapshots__/v3-date/test/generated/v3_date/index.ts.snap new file mode 100644 index 000000000..347c02309 --- /dev/null +++ b/test/__snapshots__/v3-date/test/generated/v3_date/index.ts.snap @@ -0,0 +1,3 @@ +export type { ModelWithPattern } from './models/ModelWithPattern'; + +export { $ModelWithPattern } from './schemas/$ModelWithPattern'; diff --git a/test/__snapshots__/v3-date/test/generated/v3_date/index.ts.ts.snap b/test/__snapshots__/v3-date/test/generated/v3_date/index.ts.ts.snap new file mode 100644 index 000000000..347c02309 --- /dev/null +++ b/test/__snapshots__/v3-date/test/generated/v3_date/index.ts.ts.snap @@ -0,0 +1,3 @@ +export type { ModelWithPattern } from './models/ModelWithPattern'; + +export { $ModelWithPattern } from './schemas/$ModelWithPattern'; diff --git a/test/__snapshots__/v3-date/test/generated/v3_date/models/ModelWithPattern.ts.snap b/test/__snapshots__/v3-date/test/generated/v3_date/models/ModelWithPattern.ts.snap new file mode 100644 index 000000000..50059d14c --- /dev/null +++ b/test/__snapshots__/v3-date/test/generated/v3_date/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?: Date; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; diff --git a/test/__snapshots__/v3-date/test/generated/v3_date/models/ModelWithPattern.ts.ts.snap b/test/__snapshots__/v3-date/test/generated/v3_date/models/ModelWithPattern.ts.ts.snap new file mode 100644 index 000000000..50059d14c --- /dev/null +++ b/test/__snapshots__/v3-date/test/generated/v3_date/models/ModelWithPattern.ts.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?: Date; + id?: string; + text?: string; + patternWithSingleQuotes?: string; + patternWithNewline?: string; + patternWithBacktick?: string; +}; diff --git a/test/__snapshots__/v3-date/test/generated/v3_date/schemas/$ModelWithPattern.ts.snap b/test/__snapshots__/v3-date/test/generated/v3_date/schemas/$ModelWithPattern.ts.snap new file mode 100644 index 000000000..be54e210f --- /dev/null +++ b/test/__snapshots__/v3-date/test/generated/v3_date/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-date/test/generated/v3_date/schemas/$ModelWithPattern.ts.ts.snap b/test/__snapshots__/v3-date/test/generated/v3_date/schemas/$ModelWithPattern.ts.ts.snap new file mode 100644 index 000000000..be54e210f --- /dev/null +++ b/test/__snapshots__/v3-date/test/generated/v3_date/schemas/$ModelWithPattern.ts.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-options/test/generated/v3_options/core/ApiError.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/ApiError.ts.snap new file mode 100644 index 000000000..2c11b4136 --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/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-options/test/generated/v3_options/core/ApiError.ts.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/ApiError.ts.ts.snap new file mode 100644 index 000000000..2c11b4136 --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/core/ApiError.ts.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-options/test/generated/v3_options/core/ApiRequestOptions.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/ApiRequestOptions.ts.snap new file mode 100644 index 000000000..e93003ee7 --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/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-options/test/generated/v3_options/core/ApiRequestOptions.ts.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/ApiRequestOptions.ts.ts.snap new file mode 100644 index 000000000..e93003ee7 --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/core/ApiRequestOptions.ts.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-options/test/generated/v3_options/core/ApiResult.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/ApiResult.ts.snap new file mode 100644 index 000000000..caa79c2ea --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/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-options/test/generated/v3_options/core/ApiResult.ts.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/ApiResult.ts.ts.snap new file mode 100644 index 000000000..caa79c2ea --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/core/ApiResult.ts.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-options/test/generated/v3_options/core/CancelablePromise.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/CancelablePromise.ts.snap new file mode 100644 index 000000000..0e480dd1d --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/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-options/test/generated/v3_options/core/CancelablePromise.ts.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/CancelablePromise.ts.ts.snap new file mode 100644 index 000000000..0e480dd1d --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/core/CancelablePromise.ts.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-options/test/generated/v3_options/core/OpenAPI.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/OpenAPI.ts.snap new file mode 100644 index 000000000..9308c908f --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/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-options/test/generated/v3_options/core/OpenAPI.ts.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/OpenAPI.ts.ts.snap new file mode 100644 index 000000000..9308c908f --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/core/OpenAPI.ts.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-options/test/generated/v3_options/core/request.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/request.ts.snap new file mode 100644 index 000000000..7bc4c87bc --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/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-options/test/generated/v3_options/core/request.ts.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/request.ts.ts.snap new file mode 100644 index 000000000..7bc4c87bc --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/core/request.ts.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-options/test/generated/v3_options/core/types.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/types.ts.snap new file mode 100644 index 000000000..e33a5d996 --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/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-options/test/generated/v3_options/core/types.ts.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/core/types.ts.ts.snap new file mode 100644 index 000000000..e33a5d996 --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/core/types.ts.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-options/test/generated/v3_options/index.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/index.ts.snap new file mode 100644 index 000000000..37c5eab68 --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/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 type { ModelWithString } from './models/ModelWithString'; + +export { DefaultsService } from './services/DefaultsService'; diff --git a/test/__snapshots__/v3-options/test/generated/v3_options/index.ts.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/index.ts.ts.snap new file mode 100644 index 000000000..37c5eab68 --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/index.ts.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 type { ModelWithString } from './models/ModelWithString'; + +export { DefaultsService } from './services/DefaultsService'; diff --git a/test/__snapshots__/v3-options/test/generated/v3_options/models/ModelWithString.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/models/ModelWithString.ts.snap new file mode 100644 index 000000000..7e0e7b336 --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/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-options/test/generated/v3_options/models/ModelWithString.ts.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/models/ModelWithString.ts.ts.snap new file mode 100644 index 000000000..7e0e7b336 --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/models/ModelWithString.ts.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-options/test/generated/v3_options/services/DefaultsService.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/services/DefaultsService.ts.snap new file mode 100644 index 000000000..2113b1b5a --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/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-options/test/generated/v3_options/services/DefaultsService.ts.ts.snap b/test/__snapshots__/v3-options/test/generated/v3_options/services/DefaultsService.ts.ts.snap new file mode 100644 index 000000000..2113b1b5a --- /dev/null +++ b/test/__snapshots__/v3-options/test/generated/v3_options/services/DefaultsService.ts.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/test/generated/v3/core/ApiError.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/ApiError.ts.snap new file mode 100644 index 000000000..2c11b4136 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/core/ApiError.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/ApiError.ts.ts.snap new file mode 100644 index 000000000..2c11b4136 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/core/ApiError.ts.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/test/generated/v3/core/ApiRequestOptions.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/ApiRequestOptions.ts.snap new file mode 100644 index 000000000..e93003ee7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/core/ApiRequestOptions.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/ApiRequestOptions.ts.ts.snap new file mode 100644 index 000000000..e93003ee7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/core/ApiRequestOptions.ts.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/test/generated/v3/core/ApiResult.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/ApiResult.ts.snap new file mode 100644 index 000000000..caa79c2ea --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/core/ApiResult.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/ApiResult.ts.ts.snap new file mode 100644 index 000000000..caa79c2ea --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/core/ApiResult.ts.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/test/generated/v3/core/CancelablePromise.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/CancelablePromise.ts.snap new file mode 100644 index 000000000..0e480dd1d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/core/CancelablePromise.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/CancelablePromise.ts.ts.snap new file mode 100644 index 000000000..0e480dd1d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/core/CancelablePromise.ts.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/test/generated/v3/core/OpenAPI.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/OpenAPI.ts.snap new file mode 100644 index 000000000..9308c908f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/core/OpenAPI.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/OpenAPI.ts.ts.snap new file mode 100644 index 000000000..9308c908f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/core/OpenAPI.ts.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/test/generated/v3/core/request.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/request.ts.snap new file mode 100644 index 000000000..7bc4c87bc --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/core/request.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/request.ts.ts.snap new file mode 100644 index 000000000..7bc4c87bc --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/core/request.ts.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/test/generated/v3/core/types.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/types.ts.snap new file mode 100644 index 000000000..e33a5d996 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/core/types.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/core/types.ts.ts.snap new file mode 100644 index 000000000..e33a5d996 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/core/types.ts.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/test/generated/v3/index.ts.snap b/test/__snapshots__/v3/test/generated/v3/index.ts.snap new file mode 100644 index 000000000..7bcc38a4b --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/index.ts.snap @@ -0,0 +1,226 @@ +export { ApiError } from './core/ApiError'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI } from './core/OpenAPI'; +export type { OpenAPIConfig } from './core/OpenAPI'; + +export type { _default } from './models/_default'; +export type { AnyOfAnyAndNull } from './models/AnyOfAnyAndNull'; +export type { AnyOfArrays } from './models/AnyOfArrays'; +export type { ArrayWithAnyOfProperties } from './models/ArrayWithAnyOfProperties'; +export type { ArrayWithArray } from './models/ArrayWithArray'; +export type { ArrayWithBooleans } from './models/ArrayWithBooleans'; +export type { ArrayWithNumbers } from './models/ArrayWithNumbers'; +export type { ArrayWithProperties } from './models/ArrayWithProperties'; +export type { ArrayWithReferences } from './models/ArrayWithReferences'; +export type { ArrayWithStrings } from './models/ArrayWithStrings'; +export type { CommentWithBackticks } from './models/CommentWithBackticks'; +export type { CommentWithBreaks } from './models/CommentWithBreaks'; +export type { CommentWithExpressionPlaceholders } from './models/CommentWithExpressionPlaceholders'; +export type { CommentWithQuotes } from './models/CommentWithQuotes'; +export type { CommentWithReservedCharacters } from './models/CommentWithReservedCharacters'; +export type { CommentWithSlashes } from './models/CommentWithSlashes'; +export type { CompositionBaseModel } from './models/CompositionBaseModel'; +export type { CompositionExtendedModel } from './models/CompositionExtendedModel'; +export type { CompositionWithAllOfAndNullable } from './models/CompositionWithAllOfAndNullable'; +export type { CompositionWithAnyOf } from './models/CompositionWithAnyOf'; +export type { CompositionWithAnyOfAndNullable } from './models/CompositionWithAnyOfAndNullable'; +export type { CompositionWithAnyOfAnonymous } from './models/CompositionWithAnyOfAnonymous'; +export type { CompositionWithNestedAnyAndTypeNull } from './models/CompositionWithNestedAnyAndTypeNull'; +export type { CompositionWithNestedAnyOfAndNull } from './models/CompositionWithNestedAnyOfAndNull'; +export type { CompositionWithOneOf } from './models/CompositionWithOneOf'; +export type { CompositionWithOneOfAndComplexArrayDictionary } from './models/CompositionWithOneOfAndComplexArrayDictionary'; +export type { CompositionWithOneOfAndNullable } from './models/CompositionWithOneOfAndNullable'; +export type { CompositionWithOneOfAndProperties } from './models/CompositionWithOneOfAndProperties'; +export type { CompositionWithOneOfAndSimpleArrayDictionary } from './models/CompositionWithOneOfAndSimpleArrayDictionary'; +export type { CompositionWithOneOfAndSimpleDictionary } from './models/CompositionWithOneOfAndSimpleDictionary'; +export type { CompositionWithOneOfAnonymous } from './models/CompositionWithOneOfAnonymous'; +export type { CompositionWithOneOfDiscriminator } from './models/CompositionWithOneOfDiscriminator'; +export type { ConstValue } from './models/ConstValue'; +export type { DeprecatedModel } from './models/DeprecatedModel'; +export type { DictionaryWithArray } from './models/DictionaryWithArray'; +export type { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; +export type { DictionaryWithProperties } from './models/DictionaryWithProperties'; +export type { DictionaryWithReference } from './models/DictionaryWithReference'; +export type { DictionaryWithString } from './models/DictionaryWithString'; +export type { Enum1 } from './models/Enum1'; +export { Enum1Enum } from './models/Enum1'; +export type { EnumFromDescription } from './models/EnumFromDescription'; +export type { EnumWithExtensions } from './models/EnumWithExtensions'; +export { EnumWithExtensionsEnum } from './models/EnumWithExtensions'; +export type { EnumWithNumbers } from './models/EnumWithNumbers'; +export { EnumWithNumbersEnum } from './models/EnumWithNumbers'; +export type { EnumWithReplacedCharacters } from './models/EnumWithReplacedCharacters'; +export { EnumWithReplacedCharactersEnum } from './models/EnumWithReplacedCharacters'; +export type { EnumWithStrings } from './models/EnumWithStrings'; +export { EnumWithStringsEnum } from './models/EnumWithStrings'; +export type { File } from './models/File'; +export type { FreeFormObjectWithAdditionalPropertiesEqEmptyObject } from './models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject'; +export type { FreeFormObjectWithAdditionalPropertiesEqTrue } from './models/FreeFormObjectWithAdditionalPropertiesEqTrue'; +export type { FreeFormObjectWithoutAdditionalProperties } from './models/FreeFormObjectWithoutAdditionalProperties'; +export type { ModelCircle } from './models/ModelCircle'; +export type { ModelSquare } from './models/ModelSquare'; +export type { ModelThatExtends } from './models/ModelThatExtends'; +export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; +export type { ModelWithAdditionalPropertiesEqTrue } from './models/ModelWithAdditionalPropertiesEqTrue'; +export type { ModelWithArray } from './models/ModelWithArray'; +export type { ModelWithArrayReadOnlyAndWriteOnly } from './models/ModelWithArrayReadOnlyAndWriteOnly'; +export type { ModelWithBoolean } from './models/ModelWithBoolean'; +export type { ModelWithCircularReference } from './models/ModelWithCircularReference'; +export type { ModelWithConst } from './models/ModelWithConst'; +export type { ModelWithDictionary } from './models/ModelWithDictionary'; +export type { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; +export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; +export type { ModelWithEnum } from './models/ModelWithEnum'; +export { TestEnum, StatusCodeEnum } from './models/ModelWithEnum'; +export type { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; +export type { ModelWithEnumWithHyphen } from './models/ModelWithEnumWithHyphen'; +export { FooBarBazQuxEnum } from './models/ModelWithEnumWithHyphen'; +export type { ModelWithInteger } from './models/ModelWithInteger'; +export type { ModelWithNestedArrayEnums } from './models/ModelWithNestedArrayEnums'; +export type { ModelWithNestedArrayEnumsData } from './models/ModelWithNestedArrayEnumsData'; +export type { ModelWithNestedArrayEnumsDataBar } from './models/ModelWithNestedArrayEnumsDataBar'; +export { ModelWithNestedArrayEnumsDataBarEnum } from './models/ModelWithNestedArrayEnumsDataBar'; +export type { ModelWithNestedArrayEnumsDataFoo } from './models/ModelWithNestedArrayEnumsDataFoo'; +export { ModelWithNestedArrayEnumsDataFooEnum } from './models/ModelWithNestedArrayEnumsDataFoo'; +export type { ModelWithNestedCompositionEnums } from './models/ModelWithNestedCompositionEnums'; +export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; +export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; +export type { ModelWithNullableObject } from './models/ModelWithNullableObject'; +export type { ModelWithNullableString } from './models/ModelWithNullableString'; +export type { ModelWithOneOfEnum } from './models/ModelWithOneOfEnum'; +export { FooEnum } from './models/ModelWithOneOfEnum'; +export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; +export type { ModelWithPattern } from './models/ModelWithPattern'; +export type { ModelWithProperties } from './models/ModelWithProperties'; +export type { ModelWithReadOnlyAndWriteOnly } from './models/ModelWithReadOnlyAndWriteOnly'; +export type { ModelWithReference } from './models/ModelWithReference'; +export type { ModelWithString } from './models/ModelWithString'; +export type { NestedAnyOfArraysNullable } from './models/NestedAnyOfArraysNullable'; +export type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from './models/NonAsciiStringæøåÆØÅöôêÊ字符串'; +export type { NullableObject } from './models/NullableObject'; +export type { Pageable } from './models/Pageable'; +export type { SimpleBoolean } from './models/SimpleBoolean'; +export type { SimpleFile } from './models/SimpleFile'; +export type { SimpleInteger } from './models/SimpleInteger'; +export type { SimpleParameter } from './models/SimpleParameter'; +export type { SimpleReference } from './models/SimpleReference'; +export type { SimpleString } from './models/SimpleString'; +export type { SimpleStringWithPattern } from './models/SimpleStringWithPattern'; + +export { $_default } from './schemas/$_default'; +export { $AnyOfAnyAndNull } from './schemas/$AnyOfAnyAndNull'; +export { $AnyOfArrays } from './schemas/$AnyOfArrays'; +export { $ArrayWithAnyOfProperties } from './schemas/$ArrayWithAnyOfProperties'; +export { $ArrayWithArray } from './schemas/$ArrayWithArray'; +export { $ArrayWithBooleans } from './schemas/$ArrayWithBooleans'; +export { $ArrayWithNumbers } from './schemas/$ArrayWithNumbers'; +export { $ArrayWithProperties } from './schemas/$ArrayWithProperties'; +export { $ArrayWithReferences } from './schemas/$ArrayWithReferences'; +export { $ArrayWithStrings } from './schemas/$ArrayWithStrings'; +export { $CommentWithBackticks } from './schemas/$CommentWithBackticks'; +export { $CommentWithBreaks } from './schemas/$CommentWithBreaks'; +export { $CommentWithExpressionPlaceholders } from './schemas/$CommentWithExpressionPlaceholders'; +export { $CommentWithQuotes } from './schemas/$CommentWithQuotes'; +export { $CommentWithReservedCharacters } from './schemas/$CommentWithReservedCharacters'; +export { $CommentWithSlashes } from './schemas/$CommentWithSlashes'; +export { $CompositionBaseModel } from './schemas/$CompositionBaseModel'; +export { $CompositionExtendedModel } from './schemas/$CompositionExtendedModel'; +export { $CompositionWithAllOfAndNullable } from './schemas/$CompositionWithAllOfAndNullable'; +export { $CompositionWithAnyOf } from './schemas/$CompositionWithAnyOf'; +export { $CompositionWithAnyOfAndNullable } from './schemas/$CompositionWithAnyOfAndNullable'; +export { $CompositionWithAnyOfAnonymous } from './schemas/$CompositionWithAnyOfAnonymous'; +export { $CompositionWithNestedAnyAndTypeNull } from './schemas/$CompositionWithNestedAnyAndTypeNull'; +export { $CompositionWithNestedAnyOfAndNull } from './schemas/$CompositionWithNestedAnyOfAndNull'; +export { $CompositionWithOneOf } from './schemas/$CompositionWithOneOf'; +export { $CompositionWithOneOfAndComplexArrayDictionary } from './schemas/$CompositionWithOneOfAndComplexArrayDictionary'; +export { $CompositionWithOneOfAndNullable } from './schemas/$CompositionWithOneOfAndNullable'; +export { $CompositionWithOneOfAndProperties } from './schemas/$CompositionWithOneOfAndProperties'; +export { $CompositionWithOneOfAndSimpleArrayDictionary } from './schemas/$CompositionWithOneOfAndSimpleArrayDictionary'; +export { $CompositionWithOneOfAndSimpleDictionary } from './schemas/$CompositionWithOneOfAndSimpleDictionary'; +export { $CompositionWithOneOfAnonymous } from './schemas/$CompositionWithOneOfAnonymous'; +export { $CompositionWithOneOfDiscriminator } from './schemas/$CompositionWithOneOfDiscriminator'; +export { $ConstValue } from './schemas/$ConstValue'; +export { $DeprecatedModel } from './schemas/$DeprecatedModel'; +export { $DictionaryWithArray } from './schemas/$DictionaryWithArray'; +export { $DictionaryWithDictionary } from './schemas/$DictionaryWithDictionary'; +export { $DictionaryWithProperties } from './schemas/$DictionaryWithProperties'; +export { $DictionaryWithReference } from './schemas/$DictionaryWithReference'; +export { $DictionaryWithString } from './schemas/$DictionaryWithString'; +export { $Enum1 } from './schemas/$Enum1'; +export { $EnumFromDescription } from './schemas/$EnumFromDescription'; +export { $EnumWithExtensions } from './schemas/$EnumWithExtensions'; +export { $EnumWithNumbers } from './schemas/$EnumWithNumbers'; +export { $EnumWithReplacedCharacters } from './schemas/$EnumWithReplacedCharacters'; +export { $EnumWithStrings } from './schemas/$EnumWithStrings'; +export { $File } from './schemas/$File'; +export { $FreeFormObjectWithAdditionalPropertiesEqEmptyObject } from './schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject'; +export { $FreeFormObjectWithAdditionalPropertiesEqTrue } from './schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue'; +export { $FreeFormObjectWithoutAdditionalProperties } from './schemas/$FreeFormObjectWithoutAdditionalProperties'; +export { $ModelCircle } from './schemas/$ModelCircle'; +export { $ModelSquare } from './schemas/$ModelSquare'; +export { $ModelThatExtends } from './schemas/$ModelThatExtends'; +export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends'; +export { $ModelWithAdditionalPropertiesEqTrue } from './schemas/$ModelWithAdditionalPropertiesEqTrue'; +export { $ModelWithArray } from './schemas/$ModelWithArray'; +export { $ModelWithArrayReadOnlyAndWriteOnly } from './schemas/$ModelWithArrayReadOnlyAndWriteOnly'; +export { $ModelWithBoolean } from './schemas/$ModelWithBoolean'; +export { $ModelWithCircularReference } from './schemas/$ModelWithCircularReference'; +export { $ModelWithConst } from './schemas/$ModelWithConst'; +export { $ModelWithDictionary } from './schemas/$ModelWithDictionary'; +export { $ModelWithDuplicateImports } from './schemas/$ModelWithDuplicateImports'; +export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProperties'; +export { $ModelWithEnum } from './schemas/$ModelWithEnum'; +export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription'; +export { $ModelWithEnumWithHyphen } from './schemas/$ModelWithEnumWithHyphen'; +export { $ModelWithInteger } from './schemas/$ModelWithInteger'; +export { $ModelWithNestedArrayEnums } from './schemas/$ModelWithNestedArrayEnums'; +export { $ModelWithNestedArrayEnumsData } from './schemas/$ModelWithNestedArrayEnumsData'; +export { $ModelWithNestedArrayEnumsDataBar } from './schemas/$ModelWithNestedArrayEnumsDataBar'; +export { $ModelWithNestedArrayEnumsDataFoo } from './schemas/$ModelWithNestedArrayEnumsDataFoo'; +export { $ModelWithNestedCompositionEnums } from './schemas/$ModelWithNestedCompositionEnums'; +export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums'; +export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties'; +export { $ModelWithNullableObject } from './schemas/$ModelWithNullableObject'; +export { $ModelWithNullableString } from './schemas/$ModelWithNullableString'; +export { $ModelWithOneOfEnum } from './schemas/$ModelWithOneOfEnum'; +export { $ModelWithOrderedProperties } from './schemas/$ModelWithOrderedProperties'; +export { $ModelWithPattern } from './schemas/$ModelWithPattern'; +export { $ModelWithProperties } from './schemas/$ModelWithProperties'; +export { $ModelWithReadOnlyAndWriteOnly } from './schemas/$ModelWithReadOnlyAndWriteOnly'; +export { $ModelWithReference } from './schemas/$ModelWithReference'; +export { $ModelWithString } from './schemas/$ModelWithString'; +export { $NestedAnyOfArraysNullable } from './schemas/$NestedAnyOfArraysNullable'; +export { $NonAsciiStringæøåÆØÅöôêÊ字符串 } from './schemas/$NonAsciiStringæøåÆØÅöôêÊ字符串'; +export { $NullableObject } from './schemas/$NullableObject'; +export { $Pageable } from './schemas/$Pageable'; +export { $SimpleBoolean } from './schemas/$SimpleBoolean'; +export { $SimpleFile } from './schemas/$SimpleFile'; +export { $SimpleInteger } from './schemas/$SimpleInteger'; +export { $SimpleParameter } from './schemas/$SimpleParameter'; +export { $SimpleReference } from './schemas/$SimpleReference'; +export { $SimpleString } from './schemas/$SimpleString'; +export { $SimpleStringWithPattern } from './schemas/$SimpleStringWithPattern'; + +export { CollectionFormatService } from './services/CollectionFormatService'; +export { ComplexService } from './services/ComplexService'; +export { DefaultService } from './services/DefaultService'; +export { DefaultsService } from './services/DefaultsService'; +export { DeprecatedService } from './services/DeprecatedService'; +export { DescriptionsService } from './services/DescriptionsService'; +export { DuplicateService } from './services/DuplicateService'; +export { ErrorService } from './services/ErrorService'; +export { FileResponseService } from './services/FileResponseService'; +export { FormDataService } from './services/FormDataService'; +export { HeaderService } from './services/HeaderService'; +export { MultipartService } from './services/MultipartService'; +export { MultipleTags1Service } from './services/MultipleTags1Service'; +export { MultipleTags2Service } from './services/MultipleTags2Service'; +export { MultipleTags3Service } from './services/MultipleTags3Service'; +export { NoContentService } from './services/NoContentService'; +export { NonAsciiÆøåÆøÅöôêÊService } from './services/NonAsciiÆøåÆøÅöôêÊService'; +export { ParametersService } from './services/ParametersService'; +export { RequestBodyService } from './services/RequestBodyService'; +export { ResponseService } from './services/ResponseService'; +export { SimpleService } from './services/SimpleService'; +export { TypesService } from './services/TypesService'; +export { UploadService } from './services/UploadService'; diff --git a/test/__snapshots__/v3/test/generated/v3/index.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/index.ts.ts.snap new file mode 100644 index 000000000..7bcc38a4b --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/index.ts.ts.snap @@ -0,0 +1,226 @@ +export { ApiError } from './core/ApiError'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI } from './core/OpenAPI'; +export type { OpenAPIConfig } from './core/OpenAPI'; + +export type { _default } from './models/_default'; +export type { AnyOfAnyAndNull } from './models/AnyOfAnyAndNull'; +export type { AnyOfArrays } from './models/AnyOfArrays'; +export type { ArrayWithAnyOfProperties } from './models/ArrayWithAnyOfProperties'; +export type { ArrayWithArray } from './models/ArrayWithArray'; +export type { ArrayWithBooleans } from './models/ArrayWithBooleans'; +export type { ArrayWithNumbers } from './models/ArrayWithNumbers'; +export type { ArrayWithProperties } from './models/ArrayWithProperties'; +export type { ArrayWithReferences } from './models/ArrayWithReferences'; +export type { ArrayWithStrings } from './models/ArrayWithStrings'; +export type { CommentWithBackticks } from './models/CommentWithBackticks'; +export type { CommentWithBreaks } from './models/CommentWithBreaks'; +export type { CommentWithExpressionPlaceholders } from './models/CommentWithExpressionPlaceholders'; +export type { CommentWithQuotes } from './models/CommentWithQuotes'; +export type { CommentWithReservedCharacters } from './models/CommentWithReservedCharacters'; +export type { CommentWithSlashes } from './models/CommentWithSlashes'; +export type { CompositionBaseModel } from './models/CompositionBaseModel'; +export type { CompositionExtendedModel } from './models/CompositionExtendedModel'; +export type { CompositionWithAllOfAndNullable } from './models/CompositionWithAllOfAndNullable'; +export type { CompositionWithAnyOf } from './models/CompositionWithAnyOf'; +export type { CompositionWithAnyOfAndNullable } from './models/CompositionWithAnyOfAndNullable'; +export type { CompositionWithAnyOfAnonymous } from './models/CompositionWithAnyOfAnonymous'; +export type { CompositionWithNestedAnyAndTypeNull } from './models/CompositionWithNestedAnyAndTypeNull'; +export type { CompositionWithNestedAnyOfAndNull } from './models/CompositionWithNestedAnyOfAndNull'; +export type { CompositionWithOneOf } from './models/CompositionWithOneOf'; +export type { CompositionWithOneOfAndComplexArrayDictionary } from './models/CompositionWithOneOfAndComplexArrayDictionary'; +export type { CompositionWithOneOfAndNullable } from './models/CompositionWithOneOfAndNullable'; +export type { CompositionWithOneOfAndProperties } from './models/CompositionWithOneOfAndProperties'; +export type { CompositionWithOneOfAndSimpleArrayDictionary } from './models/CompositionWithOneOfAndSimpleArrayDictionary'; +export type { CompositionWithOneOfAndSimpleDictionary } from './models/CompositionWithOneOfAndSimpleDictionary'; +export type { CompositionWithOneOfAnonymous } from './models/CompositionWithOneOfAnonymous'; +export type { CompositionWithOneOfDiscriminator } from './models/CompositionWithOneOfDiscriminator'; +export type { ConstValue } from './models/ConstValue'; +export type { DeprecatedModel } from './models/DeprecatedModel'; +export type { DictionaryWithArray } from './models/DictionaryWithArray'; +export type { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; +export type { DictionaryWithProperties } from './models/DictionaryWithProperties'; +export type { DictionaryWithReference } from './models/DictionaryWithReference'; +export type { DictionaryWithString } from './models/DictionaryWithString'; +export type { Enum1 } from './models/Enum1'; +export { Enum1Enum } from './models/Enum1'; +export type { EnumFromDescription } from './models/EnumFromDescription'; +export type { EnumWithExtensions } from './models/EnumWithExtensions'; +export { EnumWithExtensionsEnum } from './models/EnumWithExtensions'; +export type { EnumWithNumbers } from './models/EnumWithNumbers'; +export { EnumWithNumbersEnum } from './models/EnumWithNumbers'; +export type { EnumWithReplacedCharacters } from './models/EnumWithReplacedCharacters'; +export { EnumWithReplacedCharactersEnum } from './models/EnumWithReplacedCharacters'; +export type { EnumWithStrings } from './models/EnumWithStrings'; +export { EnumWithStringsEnum } from './models/EnumWithStrings'; +export type { File } from './models/File'; +export type { FreeFormObjectWithAdditionalPropertiesEqEmptyObject } from './models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject'; +export type { FreeFormObjectWithAdditionalPropertiesEqTrue } from './models/FreeFormObjectWithAdditionalPropertiesEqTrue'; +export type { FreeFormObjectWithoutAdditionalProperties } from './models/FreeFormObjectWithoutAdditionalProperties'; +export type { ModelCircle } from './models/ModelCircle'; +export type { ModelSquare } from './models/ModelSquare'; +export type { ModelThatExtends } from './models/ModelThatExtends'; +export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; +export type { ModelWithAdditionalPropertiesEqTrue } from './models/ModelWithAdditionalPropertiesEqTrue'; +export type { ModelWithArray } from './models/ModelWithArray'; +export type { ModelWithArrayReadOnlyAndWriteOnly } from './models/ModelWithArrayReadOnlyAndWriteOnly'; +export type { ModelWithBoolean } from './models/ModelWithBoolean'; +export type { ModelWithCircularReference } from './models/ModelWithCircularReference'; +export type { ModelWithConst } from './models/ModelWithConst'; +export type { ModelWithDictionary } from './models/ModelWithDictionary'; +export type { ModelWithDuplicateImports } from './models/ModelWithDuplicateImports'; +export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicateProperties'; +export type { ModelWithEnum } from './models/ModelWithEnum'; +export { TestEnum, StatusCodeEnum } from './models/ModelWithEnum'; +export type { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; +export type { ModelWithEnumWithHyphen } from './models/ModelWithEnumWithHyphen'; +export { FooBarBazQuxEnum } from './models/ModelWithEnumWithHyphen'; +export type { ModelWithInteger } from './models/ModelWithInteger'; +export type { ModelWithNestedArrayEnums } from './models/ModelWithNestedArrayEnums'; +export type { ModelWithNestedArrayEnumsData } from './models/ModelWithNestedArrayEnumsData'; +export type { ModelWithNestedArrayEnumsDataBar } from './models/ModelWithNestedArrayEnumsDataBar'; +export { ModelWithNestedArrayEnumsDataBarEnum } from './models/ModelWithNestedArrayEnumsDataBar'; +export type { ModelWithNestedArrayEnumsDataFoo } from './models/ModelWithNestedArrayEnumsDataFoo'; +export { ModelWithNestedArrayEnumsDataFooEnum } from './models/ModelWithNestedArrayEnumsDataFoo'; +export type { ModelWithNestedCompositionEnums } from './models/ModelWithNestedCompositionEnums'; +export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; +export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; +export type { ModelWithNullableObject } from './models/ModelWithNullableObject'; +export type { ModelWithNullableString } from './models/ModelWithNullableString'; +export type { ModelWithOneOfEnum } from './models/ModelWithOneOfEnum'; +export { FooEnum } from './models/ModelWithOneOfEnum'; +export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; +export type { ModelWithPattern } from './models/ModelWithPattern'; +export type { ModelWithProperties } from './models/ModelWithProperties'; +export type { ModelWithReadOnlyAndWriteOnly } from './models/ModelWithReadOnlyAndWriteOnly'; +export type { ModelWithReference } from './models/ModelWithReference'; +export type { ModelWithString } from './models/ModelWithString'; +export type { NestedAnyOfArraysNullable } from './models/NestedAnyOfArraysNullable'; +export type { NonAsciiStringæøåÆØÅöôêÊ字符串 } from './models/NonAsciiStringæøåÆØÅöôêÊ字符串'; +export type { NullableObject } from './models/NullableObject'; +export type { Pageable } from './models/Pageable'; +export type { SimpleBoolean } from './models/SimpleBoolean'; +export type { SimpleFile } from './models/SimpleFile'; +export type { SimpleInteger } from './models/SimpleInteger'; +export type { SimpleParameter } from './models/SimpleParameter'; +export type { SimpleReference } from './models/SimpleReference'; +export type { SimpleString } from './models/SimpleString'; +export type { SimpleStringWithPattern } from './models/SimpleStringWithPattern'; + +export { $_default } from './schemas/$_default'; +export { $AnyOfAnyAndNull } from './schemas/$AnyOfAnyAndNull'; +export { $AnyOfArrays } from './schemas/$AnyOfArrays'; +export { $ArrayWithAnyOfProperties } from './schemas/$ArrayWithAnyOfProperties'; +export { $ArrayWithArray } from './schemas/$ArrayWithArray'; +export { $ArrayWithBooleans } from './schemas/$ArrayWithBooleans'; +export { $ArrayWithNumbers } from './schemas/$ArrayWithNumbers'; +export { $ArrayWithProperties } from './schemas/$ArrayWithProperties'; +export { $ArrayWithReferences } from './schemas/$ArrayWithReferences'; +export { $ArrayWithStrings } from './schemas/$ArrayWithStrings'; +export { $CommentWithBackticks } from './schemas/$CommentWithBackticks'; +export { $CommentWithBreaks } from './schemas/$CommentWithBreaks'; +export { $CommentWithExpressionPlaceholders } from './schemas/$CommentWithExpressionPlaceholders'; +export { $CommentWithQuotes } from './schemas/$CommentWithQuotes'; +export { $CommentWithReservedCharacters } from './schemas/$CommentWithReservedCharacters'; +export { $CommentWithSlashes } from './schemas/$CommentWithSlashes'; +export { $CompositionBaseModel } from './schemas/$CompositionBaseModel'; +export { $CompositionExtendedModel } from './schemas/$CompositionExtendedModel'; +export { $CompositionWithAllOfAndNullable } from './schemas/$CompositionWithAllOfAndNullable'; +export { $CompositionWithAnyOf } from './schemas/$CompositionWithAnyOf'; +export { $CompositionWithAnyOfAndNullable } from './schemas/$CompositionWithAnyOfAndNullable'; +export { $CompositionWithAnyOfAnonymous } from './schemas/$CompositionWithAnyOfAnonymous'; +export { $CompositionWithNestedAnyAndTypeNull } from './schemas/$CompositionWithNestedAnyAndTypeNull'; +export { $CompositionWithNestedAnyOfAndNull } from './schemas/$CompositionWithNestedAnyOfAndNull'; +export { $CompositionWithOneOf } from './schemas/$CompositionWithOneOf'; +export { $CompositionWithOneOfAndComplexArrayDictionary } from './schemas/$CompositionWithOneOfAndComplexArrayDictionary'; +export { $CompositionWithOneOfAndNullable } from './schemas/$CompositionWithOneOfAndNullable'; +export { $CompositionWithOneOfAndProperties } from './schemas/$CompositionWithOneOfAndProperties'; +export { $CompositionWithOneOfAndSimpleArrayDictionary } from './schemas/$CompositionWithOneOfAndSimpleArrayDictionary'; +export { $CompositionWithOneOfAndSimpleDictionary } from './schemas/$CompositionWithOneOfAndSimpleDictionary'; +export { $CompositionWithOneOfAnonymous } from './schemas/$CompositionWithOneOfAnonymous'; +export { $CompositionWithOneOfDiscriminator } from './schemas/$CompositionWithOneOfDiscriminator'; +export { $ConstValue } from './schemas/$ConstValue'; +export { $DeprecatedModel } from './schemas/$DeprecatedModel'; +export { $DictionaryWithArray } from './schemas/$DictionaryWithArray'; +export { $DictionaryWithDictionary } from './schemas/$DictionaryWithDictionary'; +export { $DictionaryWithProperties } from './schemas/$DictionaryWithProperties'; +export { $DictionaryWithReference } from './schemas/$DictionaryWithReference'; +export { $DictionaryWithString } from './schemas/$DictionaryWithString'; +export { $Enum1 } from './schemas/$Enum1'; +export { $EnumFromDescription } from './schemas/$EnumFromDescription'; +export { $EnumWithExtensions } from './schemas/$EnumWithExtensions'; +export { $EnumWithNumbers } from './schemas/$EnumWithNumbers'; +export { $EnumWithReplacedCharacters } from './schemas/$EnumWithReplacedCharacters'; +export { $EnumWithStrings } from './schemas/$EnumWithStrings'; +export { $File } from './schemas/$File'; +export { $FreeFormObjectWithAdditionalPropertiesEqEmptyObject } from './schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject'; +export { $FreeFormObjectWithAdditionalPropertiesEqTrue } from './schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue'; +export { $FreeFormObjectWithoutAdditionalProperties } from './schemas/$FreeFormObjectWithoutAdditionalProperties'; +export { $ModelCircle } from './schemas/$ModelCircle'; +export { $ModelSquare } from './schemas/$ModelSquare'; +export { $ModelThatExtends } from './schemas/$ModelThatExtends'; +export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends'; +export { $ModelWithAdditionalPropertiesEqTrue } from './schemas/$ModelWithAdditionalPropertiesEqTrue'; +export { $ModelWithArray } from './schemas/$ModelWithArray'; +export { $ModelWithArrayReadOnlyAndWriteOnly } from './schemas/$ModelWithArrayReadOnlyAndWriteOnly'; +export { $ModelWithBoolean } from './schemas/$ModelWithBoolean'; +export { $ModelWithCircularReference } from './schemas/$ModelWithCircularReference'; +export { $ModelWithConst } from './schemas/$ModelWithConst'; +export { $ModelWithDictionary } from './schemas/$ModelWithDictionary'; +export { $ModelWithDuplicateImports } from './schemas/$ModelWithDuplicateImports'; +export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProperties'; +export { $ModelWithEnum } from './schemas/$ModelWithEnum'; +export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription'; +export { $ModelWithEnumWithHyphen } from './schemas/$ModelWithEnumWithHyphen'; +export { $ModelWithInteger } from './schemas/$ModelWithInteger'; +export { $ModelWithNestedArrayEnums } from './schemas/$ModelWithNestedArrayEnums'; +export { $ModelWithNestedArrayEnumsData } from './schemas/$ModelWithNestedArrayEnumsData'; +export { $ModelWithNestedArrayEnumsDataBar } from './schemas/$ModelWithNestedArrayEnumsDataBar'; +export { $ModelWithNestedArrayEnumsDataFoo } from './schemas/$ModelWithNestedArrayEnumsDataFoo'; +export { $ModelWithNestedCompositionEnums } from './schemas/$ModelWithNestedCompositionEnums'; +export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums'; +export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties'; +export { $ModelWithNullableObject } from './schemas/$ModelWithNullableObject'; +export { $ModelWithNullableString } from './schemas/$ModelWithNullableString'; +export { $ModelWithOneOfEnum } from './schemas/$ModelWithOneOfEnum'; +export { $ModelWithOrderedProperties } from './schemas/$ModelWithOrderedProperties'; +export { $ModelWithPattern } from './schemas/$ModelWithPattern'; +export { $ModelWithProperties } from './schemas/$ModelWithProperties'; +export { $ModelWithReadOnlyAndWriteOnly } from './schemas/$ModelWithReadOnlyAndWriteOnly'; +export { $ModelWithReference } from './schemas/$ModelWithReference'; +export { $ModelWithString } from './schemas/$ModelWithString'; +export { $NestedAnyOfArraysNullable } from './schemas/$NestedAnyOfArraysNullable'; +export { $NonAsciiStringæøåÆØÅöôêÊ字符串 } from './schemas/$NonAsciiStringæøåÆØÅöôêÊ字符串'; +export { $NullableObject } from './schemas/$NullableObject'; +export { $Pageable } from './schemas/$Pageable'; +export { $SimpleBoolean } from './schemas/$SimpleBoolean'; +export { $SimpleFile } from './schemas/$SimpleFile'; +export { $SimpleInteger } from './schemas/$SimpleInteger'; +export { $SimpleParameter } from './schemas/$SimpleParameter'; +export { $SimpleReference } from './schemas/$SimpleReference'; +export { $SimpleString } from './schemas/$SimpleString'; +export { $SimpleStringWithPattern } from './schemas/$SimpleStringWithPattern'; + +export { CollectionFormatService } from './services/CollectionFormatService'; +export { ComplexService } from './services/ComplexService'; +export { DefaultService } from './services/DefaultService'; +export { DefaultsService } from './services/DefaultsService'; +export { DeprecatedService } from './services/DeprecatedService'; +export { DescriptionsService } from './services/DescriptionsService'; +export { DuplicateService } from './services/DuplicateService'; +export { ErrorService } from './services/ErrorService'; +export { FileResponseService } from './services/FileResponseService'; +export { FormDataService } from './services/FormDataService'; +export { HeaderService } from './services/HeaderService'; +export { MultipartService } from './services/MultipartService'; +export { MultipleTags1Service } from './services/MultipleTags1Service'; +export { MultipleTags2Service } from './services/MultipleTags2Service'; +export { MultipleTags3Service } from './services/MultipleTags3Service'; +export { NoContentService } from './services/NoContentService'; +export { NonAsciiÆøåÆøÅöôêÊService } from './services/NonAsciiÆøåÆøÅöôêÊService'; +export { ParametersService } from './services/ParametersService'; +export { RequestBodyService } from './services/RequestBodyService'; +export { ResponseService } from './services/ResponseService'; +export { SimpleService } from './services/SimpleService'; +export { TypesService } from './services/TypesService'; +export { UploadService } from './services/UploadService'; diff --git a/test/__snapshots__/v3/test/generated/v3/models/AnyOfAnyAndNull.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/AnyOfAnyAndNull.ts.snap new file mode 100644 index 000000000..6ae8825f1 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/AnyOfAnyAndNull.ts.snap @@ -0,0 +1,3 @@ +export type AnyOfAnyAndNull = { + data?: unknown | null; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/AnyOfAnyAndNull.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/AnyOfAnyAndNull.ts.ts.snap new file mode 100644 index 000000000..6ae8825f1 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/AnyOfAnyAndNull.ts.ts.snap @@ -0,0 +1,3 @@ +export type AnyOfAnyAndNull = { + data?: unknown | null; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/AnyOfArrays.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/AnyOfArrays.ts.snap new file mode 100644 index 000000000..19603e432 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/AnyOfArrays.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/AnyOfArrays.ts.ts.snap new file mode 100644 index 000000000..19603e432 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/AnyOfArrays.ts.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/test/generated/v3/models/ArrayWithAnyOfProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithAnyOfProperties.ts.snap new file mode 100644 index 000000000..f1035ac52 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ArrayWithAnyOfProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithAnyOfProperties.ts.ts.snap new file mode 100644 index 000000000..f1035ac52 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithAnyOfProperties.ts.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/test/generated/v3/models/ArrayWithArray.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithArray.ts.snap new file mode 100644 index 000000000..e22d6a4be --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ArrayWithArray.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithArray.ts.ts.snap new file mode 100644 index 000000000..e22d6a4be --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithArray.ts.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/test/generated/v3/models/ArrayWithBooleans.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithBooleans.ts.snap new file mode 100644 index 000000000..47c9c25ad --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ArrayWithBooleans.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithBooleans.ts.ts.snap new file mode 100644 index 000000000..47c9c25ad --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithBooleans.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with booleans + */ +export type ArrayWithBooleans = Array; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ArrayWithNumbers.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithNumbers.ts.snap new file mode 100644 index 000000000..e19d5c773 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ArrayWithNumbers.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithNumbers.ts.ts.snap new file mode 100644 index 000000000..e19d5c773 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithNumbers.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with numbers + */ +export type ArrayWithNumbers = Array; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ArrayWithProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithProperties.ts.snap new file mode 100644 index 000000000..2cb636892 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ArrayWithProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithProperties.ts.ts.snap new file mode 100644 index 000000000..2cb636892 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithProperties.ts.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/test/generated/v3/models/ArrayWithReferences.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithReferences.ts.snap new file mode 100644 index 000000000..cce8ccacb --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ArrayWithReferences.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithReferences.ts.ts.snap new file mode 100644 index 000000000..cce8ccacb --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithReferences.ts.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/test/generated/v3/models/ArrayWithStrings.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithStrings.ts.snap new file mode 100644 index 000000000..df2b24751 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ArrayWithStrings.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithStrings.ts.ts.snap new file mode 100644 index 000000000..df2b24751 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ArrayWithStrings.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple array with strings + */ +export type ArrayWithStrings = Array; diff --git a/test/__snapshots__/v3/test/generated/v3/models/CommentWithBackticks.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithBackticks.ts.snap new file mode 100644 index 000000000..8821bb20e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CommentWithBackticks.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithBackticks.ts.ts.snap new file mode 100644 index 000000000..8821bb20e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CommentWithBackticks.ts.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/test/generated/v3/models/CommentWithBreaks.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithBreaks.ts.snap new file mode 100644 index 000000000..1901bb6c3 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CommentWithBreaks.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithBreaks.ts.ts.snap new file mode 100644 index 000000000..1901bb6c3 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CommentWithBreaks.ts.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/test/generated/v3/models/CommentWithExpressionPlaceholders.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithExpressionPlaceholders.ts.snap new file mode 100644 index 000000000..5fc8b7e03 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CommentWithExpressionPlaceholders.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithExpressionPlaceholders.ts.ts.snap new file mode 100644 index 000000000..5fc8b7e03 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CommentWithExpressionPlaceholders.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * Testing expression placeholders in string: ${expression} should work + */ +export type CommentWithExpressionPlaceholders = number; diff --git a/test/__snapshots__/v3/test/generated/v3/models/CommentWithQuotes.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithQuotes.ts.snap new file mode 100644 index 000000000..f5abb3c73 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CommentWithQuotes.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithQuotes.ts.ts.snap new file mode 100644 index 000000000..f5abb3c73 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CommentWithQuotes.ts.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/test/generated/v3/models/CommentWithReservedCharacters.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithReservedCharacters.ts.snap new file mode 100644 index 000000000..0a8ee6de3 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CommentWithReservedCharacters.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithReservedCharacters.ts.ts.snap new file mode 100644 index 000000000..0a8ee6de3 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CommentWithReservedCharacters.ts.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/test/generated/v3/models/CommentWithSlashes.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithSlashes.ts.snap new file mode 100644 index 000000000..ec9d9f26d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CommentWithSlashes.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CommentWithSlashes.ts.ts.snap new file mode 100644 index 000000000..ec9d9f26d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CommentWithSlashes.ts.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/test/generated/v3/models/CompositionBaseModel.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionBaseModel.ts.snap new file mode 100644 index 000000000..4a6997e24 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionBaseModel.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionBaseModel.ts.ts.snap new file mode 100644 index 000000000..4a6997e24 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionBaseModel.ts.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/test/generated/v3/models/CompositionExtendedModel.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionExtendedModel.ts.snap new file mode 100644 index 000000000..5d5598c88 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionExtendedModel.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionExtendedModel.ts.ts.snap new file mode 100644 index 000000000..5d5598c88 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionExtendedModel.ts.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/test/generated/v3/models/CompositionWithAllOfAndNullable.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAllOfAndNullable.ts.snap new file mode 100644 index 000000000..5c22a114c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithAllOfAndNullable.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAllOfAndNullable.ts.ts.snap new file mode 100644 index 000000000..5c22a114c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAllOfAndNullable.ts.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/test/generated/v3/models/CompositionWithAnyOf.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOf.ts.snap new file mode 100644 index 000000000..b4f77afd8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithAnyOf.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOf.ts.ts.snap new file mode 100644 index 000000000..b4f77afd8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOf.ts.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/test/generated/v3/models/CompositionWithAnyOfAndNullable.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOfAndNullable.ts.snap new file mode 100644 index 000000000..e03daa1fa --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithAnyOfAndNullable.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOfAndNullable.ts.ts.snap new file mode 100644 index 000000000..e03daa1fa --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOfAndNullable.ts.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/test/generated/v3/models/CompositionWithAnyOfAnonymous.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOfAnonymous.ts.snap new file mode 100644 index 000000000..b5abf3bc7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithAnyOfAnonymous.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOfAnonymous.ts.ts.snap new file mode 100644 index 000000000..b5abf3bc7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithAnyOfAnonymous.ts.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/test/generated/v3/models/CompositionWithNestedAnyAndTypeNull.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithNestedAnyAndTypeNull.ts.snap new file mode 100644 index 000000000..198a0920f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithNestedAnyAndTypeNull.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithNestedAnyAndTypeNull.ts.ts.snap new file mode 100644 index 000000000..198a0920f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithNestedAnyAndTypeNull.ts.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/test/generated/v3/models/CompositionWithNestedAnyOfAndNull.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithNestedAnyOfAndNull.ts.snap new file mode 100644 index 000000000..f598fed05 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithNestedAnyOfAndNull.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithNestedAnyOfAndNull.ts.ts.snap new file mode 100644 index 000000000..f598fed05 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithNestedAnyOfAndNull.ts.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/test/generated/v3/models/CompositionWithOneOf.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOf.ts.snap new file mode 100644 index 000000000..6faf1d73a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithOneOf.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOf.ts.ts.snap new file mode 100644 index 000000000..6faf1d73a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOf.ts.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/test/generated/v3/models/CompositionWithOneOfAndComplexArrayDictionary.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndComplexArrayDictionary.ts.snap new file mode 100644 index 000000000..f98100a06 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithOneOfAndComplexArrayDictionary.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndComplexArrayDictionary.ts.ts.snap new file mode 100644 index 000000000..f98100a06 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndComplexArrayDictionary.ts.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/test/generated/v3/models/CompositionWithOneOfAndNullable.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndNullable.ts.snap new file mode 100644 index 000000000..c71253b8e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithOneOfAndNullable.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndNullable.ts.ts.snap new file mode 100644 index 000000000..c71253b8e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndNullable.ts.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/test/generated/v3/models/CompositionWithOneOfAndProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndProperties.ts.snap new file mode 100644 index 000000000..b62f3159d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithOneOfAndProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndProperties.ts.ts.snap new file mode 100644 index 000000000..b62f3159d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndProperties.ts.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/test/generated/v3/models/CompositionWithOneOfAndSimpleArrayDictionary.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndSimpleArrayDictionary.ts.snap new file mode 100644 index 000000000..7d89d086e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithOneOfAndSimpleArrayDictionary.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndSimpleArrayDictionary.ts.ts.snap new file mode 100644 index 000000000..7d89d086e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndSimpleArrayDictionary.ts.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/test/generated/v3/models/CompositionWithOneOfAndSimpleDictionary.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndSimpleDictionary.ts.snap new file mode 100644 index 000000000..df2b73b59 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithOneOfAndSimpleDictionary.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndSimpleDictionary.ts.ts.snap new file mode 100644 index 000000000..df2b73b59 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAndSimpleDictionary.ts.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/test/generated/v3/models/CompositionWithOneOfAnonymous.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAnonymous.ts.snap new file mode 100644 index 000000000..befe9779a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithOneOfAnonymous.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAnonymous.ts.ts.snap new file mode 100644 index 000000000..befe9779a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfAnonymous.ts.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/test/generated/v3/models/CompositionWithOneOfDiscriminator.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfDiscriminator.ts.snap new file mode 100644 index 000000000..a2f9acd00 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/CompositionWithOneOfDiscriminator.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfDiscriminator.ts.ts.snap new file mode 100644 index 000000000..a2f9acd00 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/CompositionWithOneOfDiscriminator.ts.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/test/generated/v3/models/ConstValue.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ConstValue.ts.snap new file mode 100644 index 000000000..2ae94c345 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ConstValue.ts.snap @@ -0,0 +1 @@ +export type ConstValue = 'ConstValue'; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ConstValue.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ConstValue.ts.ts.snap new file mode 100644 index 000000000..2ae94c345 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ConstValue.ts.ts.snap @@ -0,0 +1 @@ +export type ConstValue = 'ConstValue'; diff --git a/test/__snapshots__/v3/test/generated/v3/models/DeprecatedModel.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DeprecatedModel.ts.snap new file mode 100644 index 000000000..d42fc4724 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/DeprecatedModel.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DeprecatedModel.ts.ts.snap new file mode 100644 index 000000000..d42fc4724 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/DeprecatedModel.ts.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/test/generated/v3/models/DictionaryWithArray.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithArray.ts.snap new file mode 100644 index 000000000..1f607589c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/DictionaryWithArray.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithArray.ts.ts.snap new file mode 100644 index 000000000..1f607589c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithArray.ts.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/test/generated/v3/models/DictionaryWithDictionary.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithDictionary.ts.snap new file mode 100644 index 000000000..8de230522 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithDictionary.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = Record>; diff --git a/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithDictionary.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithDictionary.ts.ts.snap new file mode 100644 index 000000000..8de230522 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithDictionary.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a string dictionary + */ +export type DictionaryWithDictionary = Record>; diff --git a/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithProperties.ts.snap new file mode 100644 index 000000000..4997b3540 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/DictionaryWithProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithProperties.ts.ts.snap new file mode 100644 index 000000000..4997b3540 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithProperties.ts.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/test/generated/v3/models/DictionaryWithReference.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithReference.ts.snap new file mode 100644 index 000000000..9c6984d91 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/DictionaryWithReference.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithReference.ts.ts.snap new file mode 100644 index 000000000..9c6984d91 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithReference.ts.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/test/generated/v3/models/DictionaryWithString.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithString.ts.snap new file mode 100644 index 000000000..8cdba767c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithString.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a string dictionary + */ +export type DictionaryWithString = Record; diff --git a/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithString.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithString.ts.ts.snap new file mode 100644 index 000000000..8cdba767c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/DictionaryWithString.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a string dictionary + */ +export type DictionaryWithString = Record; diff --git a/test/__snapshots__/v3/test/generated/v3/models/Enum1.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/Enum1.ts.snap new file mode 100644 index 000000000..0421d9cc6 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/Enum1.ts.snap @@ -0,0 +1,6 @@ +export type Enum1 = 'Bird' | 'Dog'; + +export const Enum1Enum = { + BIRD: 'Bird', + DOG: 'Dog', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/Enum1.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/Enum1.ts.ts.snap new file mode 100644 index 000000000..0421d9cc6 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/Enum1.ts.ts.snap @@ -0,0 +1,6 @@ +export type Enum1 = 'Bird' | 'Dog'; + +export const Enum1Enum = { + BIRD: 'Bird', + DOG: 'Dog', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/EnumFromDescription.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/EnumFromDescription.ts.snap new file mode 100644 index 000000000..c399deac4 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/EnumFromDescription.ts.snap @@ -0,0 +1,4 @@ +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; diff --git a/test/__snapshots__/v3/test/generated/v3/models/EnumFromDescription.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/EnumFromDescription.ts.ts.snap new file mode 100644 index 000000000..c399deac4 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/EnumFromDescription.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * Success=1,Warning=2,Error=3 + */ +export type EnumFromDescription = number; diff --git a/test/__snapshots__/v3/test/generated/v3/models/EnumWithExtensions.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/EnumWithExtensions.ts.snap new file mode 100644 index 000000000..d5ca1e898 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/EnumWithExtensions.ts.snap @@ -0,0 +1,19 @@ +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export const EnumWithExtensionsEnum = { + /** + * 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, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/EnumWithExtensions.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/EnumWithExtensions.ts.ts.snap new file mode 100644 index 000000000..d5ca1e898 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/EnumWithExtensions.ts.ts.snap @@ -0,0 +1,19 @@ +/** + * This is a simple enum with numbers + */ +export type EnumWithExtensions = 200 | 400 | 500; + +export const EnumWithExtensionsEnum = { + /** + * 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, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/EnumWithNumbers.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/EnumWithNumbers.ts.snap new file mode 100644 index 000000000..b2f85dc12 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/EnumWithNumbers.ts.snap @@ -0,0 +1,22 @@ +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +export const EnumWithNumbersEnum = { + _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, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/EnumWithNumbers.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/EnumWithNumbers.ts.ts.snap new file mode 100644 index 000000000..b2f85dc12 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/EnumWithNumbers.ts.ts.snap @@ -0,0 +1,22 @@ +/** + * This is a simple enum with numbers + */ +export type EnumWithNumbers = 1 | 2 | 3 | 1.1 | 1.2 | 1.3 | 100 | 200 | 300 | -100 | -200 | -300 | -1.1 | -1.2 | -1.3; + +export const EnumWithNumbersEnum = { + _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, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/EnumWithReplacedCharacters.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/EnumWithReplacedCharacters.ts.snap new file mode 100644 index 000000000..9813f93c4 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/EnumWithReplacedCharacters.ts.snap @@ -0,0 +1,9 @@ +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +export const EnumWithReplacedCharactersEnum = { + _SINGLE_QUOTE_: "'Single Quote'", + _DOUBLE_QUOTES_: '"Double Quotes"', + ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + '_3.1': 3.1, + EMPTY_STRING: '', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/EnumWithReplacedCharacters.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/EnumWithReplacedCharacters.ts.ts.snap new file mode 100644 index 000000000..9813f93c4 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/EnumWithReplacedCharacters.ts.ts.snap @@ -0,0 +1,9 @@ +export type EnumWithReplacedCharacters = "'Single Quote'" | '"Double Quotes"' | 'øæåôöØÆÅÔÖ字符串' | 3.1 | ''; + +export const EnumWithReplacedCharactersEnum = { + _SINGLE_QUOTE_: "'Single Quote'", + _DOUBLE_QUOTES_: '"Double Quotes"', + ØÆÅÔÖ_ØÆÅÔÖ字符串: 'øæåôöØÆÅÔÖ字符串', + '_3.1': 3.1, + EMPTY_STRING: '', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/EnumWithStrings.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/EnumWithStrings.ts.snap new file mode 100644 index 000000000..126afe0c1 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/EnumWithStrings.ts.snap @@ -0,0 +1,19 @@ +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = + | 'Success' + | 'Warning' + | 'Error' + | "'Single Quote'" + | '"Double Quotes"' + | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export const EnumWithStringsEnum = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + _SINGLE_QUOTE_: "'Single Quote'", + _DOUBLE_QUOTES_: '"Double Quotes"', + NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/EnumWithStrings.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/EnumWithStrings.ts.ts.snap new file mode 100644 index 000000000..126afe0c1 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/EnumWithStrings.ts.ts.snap @@ -0,0 +1,19 @@ +/** + * This is a simple enum with strings + */ +export type EnumWithStrings = + | 'Success' + | 'Warning' + | 'Error' + | "'Single Quote'" + | '"Double Quotes"' + | 'Non-ascii: øæåôöØÆÅÔÖ字符串'; + +export const EnumWithStringsEnum = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + _SINGLE_QUOTE_: "'Single Quote'", + _DOUBLE_QUOTES_: '"Double Quotes"', + NON_ASCII__ØÆÅÔÖ_ØÆÅÔÖ字符串: 'Non-ascii: øæåôöØÆÅÔÖ字符串', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/File.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/File.ts.snap new file mode 100644 index 000000000..e206fad7f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/File.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/File.ts.ts.snap new file mode 100644 index 000000000..e206fad7f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/File.ts.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/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap new file mode 100644 index 000000000..0fb4a7517 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.ts.snap new file mode 100644 index 000000000..0fb4a7517 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a free-form object with additionalProperties: {}. + */ +export type FreeFormObjectWithAdditionalPropertiesEqEmptyObject = Record; diff --git a/test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap new file mode 100644 index 000000000..16961a031 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts.ts.snap new file mode 100644 index 000000000..16961a031 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithAdditionalPropertiesEqTrue.ts.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/test/generated/v3/models/FreeFormObjectWithoutAdditionalProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithoutAdditionalProperties.ts.snap new file mode 100644 index 000000000..9ab1d8d24 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/FreeFormObjectWithoutAdditionalProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithoutAdditionalProperties.ts.ts.snap new file mode 100644 index 000000000..9ab1d8d24 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/FreeFormObjectWithoutAdditionalProperties.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a free-form object without additionalProperties. + */ +export type FreeFormObjectWithoutAdditionalProperties = Record; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelCircle.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelCircle.ts.snap new file mode 100644 index 000000000..ad93f2e41 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelCircle.ts.snap @@ -0,0 +1,7 @@ +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelCircle.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelCircle.ts.ts.snap new file mode 100644 index 000000000..ad93f2e41 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelCircle.ts.ts.snap @@ -0,0 +1,7 @@ +/** + * Circle + */ +export type ModelCircle = { + kind: 'circle'; + radius?: number; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelSquare.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelSquare.ts.snap new file mode 100644 index 000000000..f1911fe03 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelSquare.ts.snap @@ -0,0 +1,7 @@ +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelSquare.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelSquare.ts.ts.snap new file mode 100644 index 000000000..f1911fe03 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelSquare.ts.ts.snap @@ -0,0 +1,7 @@ +/** + * Square + */ +export type ModelSquare = { + kind: 'square'; + sideLength?: number; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelThatExtends.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelThatExtends.ts.snap new file mode 100644 index 000000000..4ae9a1b85 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelThatExtends.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelThatExtends.ts.ts.snap new file mode 100644 index 000000000..4ae9a1b85 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelThatExtends.ts.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/test/generated/v3/models/ModelThatExtendsExtends.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelThatExtendsExtends.ts.snap new file mode 100644 index 000000000..8207bd040 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelThatExtendsExtends.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelThatExtendsExtends.ts.ts.snap new file mode 100644 index 000000000..8207bd040 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelThatExtendsExtends.ts.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/test/generated/v3/models/ModelWithAdditionalPropertiesEqTrue.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithAdditionalPropertiesEqTrue.ts.snap new file mode 100644 index 000000000..4d5a422ec --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithAdditionalPropertiesEqTrue.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithAdditionalPropertiesEqTrue.ts.ts.snap new file mode 100644 index 000000000..4d5a422ec --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithAdditionalPropertiesEqTrue.ts.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/test/generated/v3/models/ModelWithArray.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithArray.ts.snap new file mode 100644 index 000000000..b3caea287 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithArray.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithArray.ts.ts.snap new file mode 100644 index 000000000..b3caea287 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithArray.ts.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/test/generated/v3/models/ModelWithArrayReadOnlyAndWriteOnly.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithArrayReadOnlyAndWriteOnly.ts.snap new file mode 100644 index 000000000..a0679628f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithArrayReadOnlyAndWriteOnly.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithArrayReadOnlyAndWriteOnly.ts.ts.snap new file mode 100644 index 000000000..a0679628f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithArrayReadOnlyAndWriteOnly.ts.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/test/generated/v3/models/ModelWithBoolean.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithBoolean.ts.snap new file mode 100644 index 000000000..3fb0b51c4 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithBoolean.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithBoolean.ts.ts.snap new file mode 100644 index 000000000..3fb0b51c4 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithBoolean.ts.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/test/generated/v3/models/ModelWithCircularReference.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithCircularReference.ts.snap new file mode 100644 index 000000000..02560acd2 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithCircularReference.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithCircularReference.ts.ts.snap new file mode 100644 index 000000000..02560acd2 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithCircularReference.ts.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/test/generated/v3/models/ModelWithConst.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithConst.ts.snap new file mode 100644 index 000000000..174ff6348 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithConst.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithConst.ts.ts.snap new file mode 100644 index 000000000..174ff6348 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithConst.ts.ts.snap @@ -0,0 +1,6 @@ +export type ModelWithConst = { + String?: 'String'; + number?: 0; + null?: null; + withType?: 'Some string'; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithDictionary.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithDictionary.ts.snap new file mode 100644 index 000000000..34e8b2904 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithDictionary.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithDictionary.ts.ts.snap new file mode 100644 index 000000000..34e8b2904 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithDictionary.ts.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/test/generated/v3/models/ModelWithDuplicateImports.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithDuplicateImports.ts.snap new file mode 100644 index 000000000..55a879e42 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithDuplicateImports.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithDuplicateImports.ts.ts.snap new file mode 100644 index 000000000..55a879e42 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithDuplicateImports.ts.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/test/generated/v3/models/ModelWithDuplicateProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithDuplicateProperties.ts.snap new file mode 100644 index 000000000..865db789c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithDuplicateProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithDuplicateProperties.ts.ts.snap new file mode 100644 index 000000000..865db789c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithDuplicateProperties.ts.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/test/generated/v3/models/ModelWithEnum.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnum.ts.snap new file mode 100644 index 000000000..848b2f336 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnum.ts.snap @@ -0,0 +1,33 @@ +/** + * 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; +}; + +export const TestEnum = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + ØÆÅ字符串: 'ØÆÅ字符串', +} as const; + +export const StatusCodeEnum = { + _100: '100', + _200_FOO: '200 FOO', + _300_FOO_BAR: '300 FOO_BAR', + _400_FOO_BAR: '400 foo-bar', + _500_FOO_BAR: '500 foo.bar', + _600_FOO_BAR: '600 foo&bar', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnum.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnum.ts.ts.snap new file mode 100644 index 000000000..848b2f336 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnum.ts.ts.snap @@ -0,0 +1,33 @@ +/** + * 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; +}; + +export const TestEnum = { + SUCCESS: 'Success', + WARNING: 'Warning', + ERROR: 'Error', + ØÆÅ字符串: 'ØÆÅ字符串', +} as const; + +export const StatusCodeEnum = { + _100: '100', + _200_FOO: '200 FOO', + _300_FOO_BAR: '300 FOO_BAR', + _400_FOO_BAR: '400 foo-bar', + _500_FOO_BAR: '500 foo.bar', + _600_FOO_BAR: '600 foo&bar', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumFromDescription.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumFromDescription.ts.snap new file mode 100644 index 000000000..d34988f55 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithEnumFromDescription.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumFromDescription.ts.ts.snap new file mode 100644 index 000000000..d34988f55 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumFromDescription.ts.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/test/generated/v3/models/ModelWithEnumWithHyphen.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumWithHyphen.ts.snap new file mode 100644 index 000000000..1f1b43b9f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumWithHyphen.ts.snap @@ -0,0 +1,10 @@ +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export const FooBarBazQuxEnum = { + _3_0: '3.0', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumWithHyphen.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumWithHyphen.ts.ts.snap new file mode 100644 index 000000000..1f1b43b9f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithEnumWithHyphen.ts.ts.snap @@ -0,0 +1,10 @@ +/** + * This is a model with one enum with escaped name + */ +export type ModelWithEnumWithHyphen = { + 'foo-bar-baz-qux'?: '3.0'; +}; + +export const FooBarBazQuxEnum = { + _3_0: '3.0', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithInteger.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithInteger.ts.snap new file mode 100644 index 000000000..fcf3ed1d6 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithInteger.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithInteger.ts.ts.snap new file mode 100644 index 000000000..fcf3ed1d6 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithInteger.ts.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/test/generated/v3/models/ModelWithNestedArrayEnums.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnums.ts.snap new file mode 100644 index 000000000..3abc00ee6 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithNestedArrayEnums.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnums.ts.ts.snap new file mode 100644 index 000000000..3abc00ee6 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnums.ts.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/test/generated/v3/models/ModelWithNestedArrayEnumsData.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsData.ts.snap new file mode 100644 index 000000000..b675991c0 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithNestedArrayEnumsData.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsData.ts.ts.snap new file mode 100644 index 000000000..b675991c0 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsData.ts.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/test/generated/v3/models/ModelWithNestedArrayEnumsDataBar.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataBar.ts.snap new file mode 100644 index 000000000..fd53127ed --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataBar.ts.snap @@ -0,0 +1,6 @@ +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export const ModelWithNestedArrayEnumsDataBarEnum = { + BAZ: 'baz', + QUX: 'qux', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataBar.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataBar.ts.ts.snap new file mode 100644 index 000000000..fd53127ed --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataBar.ts.ts.snap @@ -0,0 +1,6 @@ +export type ModelWithNestedArrayEnumsDataBar = 'baz' | 'qux'; + +export const ModelWithNestedArrayEnumsDataBarEnum = { + BAZ: 'baz', + QUX: 'qux', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataFoo.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataFoo.ts.snap new file mode 100644 index 000000000..9ea608074 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataFoo.ts.snap @@ -0,0 +1,6 @@ +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export const ModelWithNestedArrayEnumsDataFooEnum = { + FOO: 'foo', + BAR: 'bar', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataFoo.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataFoo.ts.ts.snap new file mode 100644 index 000000000..9ea608074 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedArrayEnumsDataFoo.ts.ts.snap @@ -0,0 +1,6 @@ +export type ModelWithNestedArrayEnumsDataFoo = 'foo' | 'bar'; + +export const ModelWithNestedArrayEnumsDataFooEnum = { + FOO: 'foo', + BAR: 'bar', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedCompositionEnums.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedCompositionEnums.ts.snap new file mode 100644 index 000000000..ae1ec5fd5 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedCompositionEnums.ts.snap @@ -0,0 +1,5 @@ +import type { ModelWithNestedArrayEnumsDataFoo } from './ModelWithNestedArrayEnumsDataFoo'; + +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedCompositionEnums.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedCompositionEnums.ts.ts.snap new file mode 100644 index 000000000..ae1ec5fd5 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedCompositionEnums.ts.ts.snap @@ -0,0 +1,5 @@ +import type { ModelWithNestedArrayEnumsDataFoo } from './ModelWithNestedArrayEnumsDataFoo'; + +export type ModelWithNestedCompositionEnums = { + foo?: ModelWithNestedArrayEnumsDataFoo; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedEnums.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedEnums.ts.snap new file mode 100644 index 000000000..8e1ed1cd8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithNestedEnums.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedEnums.ts.ts.snap new file mode 100644 index 000000000..8e1ed1cd8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedEnums.ts.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/test/generated/v3/models/ModelWithNestedProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedProperties.ts.snap new file mode 100644 index 000000000..1c9d61d63 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithNestedProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedProperties.ts.ts.snap new file mode 100644 index 000000000..1c9d61d63 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNestedProperties.ts.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/test/generated/v3/models/ModelWithNullableObject.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableObject.ts.snap new file mode 100644 index 000000000..14a3288e3 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableObject.ts.snap @@ -0,0 +1,5 @@ +import type { NullableObject } from './NullableObject'; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableObject.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableObject.ts.ts.snap new file mode 100644 index 000000000..14a3288e3 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableObject.ts.ts.snap @@ -0,0 +1,5 @@ +import type { NullableObject } from './NullableObject'; + +export type ModelWithNullableObject = { + data?: NullableObject; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableString.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableString.ts.snap new file mode 100644 index 000000000..da7b07f72 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithNullableString.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableString.ts.ts.snap new file mode 100644 index 000000000..da7b07f72 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithNullableString.ts.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/test/generated/v3/models/ModelWithOneOfEnum.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithOneOfEnum.ts.snap new file mode 100644 index 000000000..65cae7a0a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithOneOfEnum.ts.snap @@ -0,0 +1,22 @@ +export type ModelWithOneOfEnum = + | { + foo: 'Bar'; + } + | { + foo: 'Baz'; + } + | { + foo: 'Qux'; + } + | { + content: string; + foo: 'Quux'; + } + | { + content: [string, string]; + foo: 'Corge'; + }; + +export const FooEnum = { + BAR: 'Bar', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithOneOfEnum.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithOneOfEnum.ts.ts.snap new file mode 100644 index 000000000..65cae7a0a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithOneOfEnum.ts.ts.snap @@ -0,0 +1,22 @@ +export type ModelWithOneOfEnum = + | { + foo: 'Bar'; + } + | { + foo: 'Baz'; + } + | { + foo: 'Qux'; + } + | { + content: string; + foo: 'Quux'; + } + | { + content: [string, string]; + foo: 'Corge'; + }; + +export const FooEnum = { + BAR: 'Bar', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithOrderedProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithOrderedProperties.ts.snap new file mode 100644 index 000000000..d9e532738 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithOrderedProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithOrderedProperties.ts.ts.snap new file mode 100644 index 000000000..d9e532738 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithOrderedProperties.ts.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/test/generated/v3/models/ModelWithPattern.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithPattern.ts.snap new file mode 100644 index 000000000..ca88e528c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithPattern.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithPattern.ts.ts.snap new file mode 100644 index 000000000..ca88e528c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithPattern.ts.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/test/generated/v3/models/ModelWithProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithProperties.ts.snap new file mode 100644 index 000000000..34d1f8bf8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithProperties.ts.ts.snap new file mode 100644 index 000000000..34d1f8bf8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithProperties.ts.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/test/generated/v3/models/ModelWithReadOnlyAndWriteOnly.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithReadOnlyAndWriteOnly.ts.snap new file mode 100644 index 000000000..558101f98 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithReadOnlyAndWriteOnly.ts.snap @@ -0,0 +1,5 @@ +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithReadOnlyAndWriteOnly.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithReadOnlyAndWriteOnly.ts.ts.snap new file mode 100644 index 000000000..558101f98 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithReadOnlyAndWriteOnly.ts.ts.snap @@ -0,0 +1,5 @@ +export type ModelWithReadOnlyAndWriteOnly = { + foo: string; + readonly bar: string; + baz: string; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/ModelWithReference.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithReference.ts.snap new file mode 100644 index 000000000..80dbd078b --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithReference.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithReference.ts.ts.snap new file mode 100644 index 000000000..80dbd078b --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithReference.ts.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/test/generated/v3/models/ModelWithString.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithString.ts.snap new file mode 100644 index 000000000..7e0e7b336 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/ModelWithString.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/ModelWithString.ts.ts.snap new file mode 100644 index 000000000..7e0e7b336 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/ModelWithString.ts.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/test/generated/v3/models/NestedAnyOfArraysNullable.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/NestedAnyOfArraysNullable.ts.snap new file mode 100644 index 000000000..241963542 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/NestedAnyOfArraysNullable.ts.snap @@ -0,0 +1,3 @@ +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/NestedAnyOfArraysNullable.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/NestedAnyOfArraysNullable.ts.ts.snap new file mode 100644 index 000000000..241963542 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/NestedAnyOfArraysNullable.ts.ts.snap @@ -0,0 +1,3 @@ +export type NestedAnyOfArraysNullable = { + nullableArray?: Array | null; +}; diff --git "a/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/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/test/generated/v3/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/test/generated/v3/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.ts.snap" "b/test/__snapshots__/v3/test/generated/v3/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.ts.snap" new file mode 100644 index 000000000..72359bbde --- /dev/null +++ "b/test/__snapshots__/v3/test/generated/v3/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.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/test/generated/v3/models/NullableObject.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/NullableObject.ts.snap new file mode 100644 index 000000000..c2f64ece7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/NullableObject.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/NullableObject.ts.ts.snap new file mode 100644 index 000000000..c2f64ece7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/NullableObject.ts.ts.snap @@ -0,0 +1,6 @@ +/** + * An object that can be null + */ +export type NullableObject = { + foo?: string; +} | null; diff --git a/test/__snapshots__/v3/test/generated/v3/models/Pageable.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/Pageable.ts.snap new file mode 100644 index 000000000..659cc4bc2 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/Pageable.ts.snap @@ -0,0 +1,5 @@ +export type Pageable = { + page?: number; + size?: number; + sort?: Array; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/Pageable.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/Pageable.ts.ts.snap new file mode 100644 index 000000000..659cc4bc2 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/Pageable.ts.ts.snap @@ -0,0 +1,5 @@ +export type Pageable = { + page?: number; + size?: number; + sort?: Array; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleBoolean.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleBoolean.ts.snap new file mode 100644 index 000000000..99b020679 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleBoolean.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleBoolean.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleBoolean.ts.ts.snap new file mode 100644 index 000000000..99b020679 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleBoolean.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple boolean + */ +export type SimpleBoolean = boolean; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleFile.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleFile.ts.snap new file mode 100644 index 000000000..b206fcf96 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleFile.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple file + */ +export type SimpleFile = Blob; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleFile.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleFile.ts.ts.snap new file mode 100644 index 000000000..b206fcf96 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleFile.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple file + */ +export type SimpleFile = Blob; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleInteger.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleInteger.ts.snap new file mode 100644 index 000000000..7a547a495 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleInteger.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple number + */ +export type SimpleInteger = number; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleInteger.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleInteger.ts.ts.snap new file mode 100644 index 000000000..7a547a495 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleInteger.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple number + */ +export type SimpleInteger = number; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleParameter.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleParameter.ts.snap new file mode 100644 index 000000000..8d9bcc2be --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleParameter.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a reusable parameter + */ +export type SimpleParameter = string; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleParameter.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleParameter.ts.ts.snap new file mode 100644 index 000000000..8d9bcc2be --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleParameter.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a reusable parameter + */ +export type SimpleParameter = string; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleReference.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleReference.ts.snap new file mode 100644 index 000000000..d4ddda16f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/models/SimpleReference.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleReference.ts.ts.snap new file mode 100644 index 000000000..d4ddda16f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleReference.ts.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/test/generated/v3/models/SimpleString.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleString.ts.snap new file mode 100644 index 000000000..ce4410ecf --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleString.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple string + */ +export type SimpleString = string; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleString.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleString.ts.ts.snap new file mode 100644 index 000000000..ce4410ecf --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleString.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple string + */ +export type SimpleString = string; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleStringWithPattern.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleStringWithPattern.ts.snap new file mode 100644 index 000000000..4765083c8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleStringWithPattern.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple string + */ +export type SimpleStringWithPattern = string | null; diff --git a/test/__snapshots__/v3/test/generated/v3/models/SimpleStringWithPattern.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/SimpleStringWithPattern.ts.ts.snap new file mode 100644 index 000000000..4765083c8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/SimpleStringWithPattern.ts.ts.snap @@ -0,0 +1,4 @@ +/** + * This is a simple string + */ +export type SimpleStringWithPattern = string | null; diff --git a/test/__snapshots__/v3/test/generated/v3/models/_default.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/_default.ts.snap new file mode 100644 index 000000000..0867799ba --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/_default.ts.snap @@ -0,0 +1,3 @@ +export type _default = { + name?: string; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/models/_default.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/models/_default.ts.ts.snap new file mode 100644 index 000000000..0867799ba --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/models/_default.ts.ts.snap @@ -0,0 +1,3 @@ +export type _default = { + name?: string; +}; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$AnyOfAnyAndNull.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$AnyOfAnyAndNull.ts.snap new file mode 100644 index 000000000..6788aaf9c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$AnyOfAnyAndNull.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$AnyOfAnyAndNull.ts.ts.snap new file mode 100644 index 000000000..6788aaf9c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$AnyOfAnyAndNull.ts.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/test/generated/v3/schemas/$AnyOfArrays.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$AnyOfArrays.ts.snap new file mode 100644 index 000000000..631101a73 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$AnyOfArrays.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$AnyOfArrays.ts.ts.snap new file mode 100644 index 000000000..631101a73 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$AnyOfArrays.ts.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/test/generated/v3/schemas/$ArrayWithAnyOfProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithAnyOfProperties.ts.snap new file mode 100644 index 000000000..e9dbc5758 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ArrayWithAnyOfProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithAnyOfProperties.ts.ts.snap new file mode 100644 index 000000000..e9dbc5758 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithAnyOfProperties.ts.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/test/generated/v3/schemas/$ArrayWithArray.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithArray.ts.snap new file mode 100644 index 000000000..ff5558c55 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ArrayWithArray.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithArray.ts.ts.snap new file mode 100644 index 000000000..ff5558c55 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithArray.ts.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/test/generated/v3/schemas/$ArrayWithBooleans.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithBooleans.ts.snap new file mode 100644 index 000000000..74eee001b --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithBooleans.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithBooleans = { + type: 'array', + contains: { + type: 'boolean', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithBooleans.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithBooleans.ts.ts.snap new file mode 100644 index 000000000..74eee001b --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithBooleans.ts.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithBooleans = { + type: 'array', + contains: { + type: 'boolean', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithNumbers.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithNumbers.ts.snap new file mode 100644 index 000000000..4aa83e3bc --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithNumbers.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithNumbers = { + type: 'array', + contains: { + type: 'number', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithNumbers.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithNumbers.ts.ts.snap new file mode 100644 index 000000000..4aa83e3bc --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithNumbers.ts.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithNumbers = { + type: 'array', + contains: { + type: 'number', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithProperties.ts.snap new file mode 100644 index 000000000..96a1feb9c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ArrayWithProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithProperties.ts.ts.snap new file mode 100644 index 000000000..96a1feb9c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithProperties.ts.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/test/generated/v3/schemas/$ArrayWithReferences.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithReferences.ts.snap new file mode 100644 index 000000000..8954542ce --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithReferences.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithReferences = { + type: 'array', + contains: { + type: 'ModelWithString', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithReferences.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithReferences.ts.ts.snap new file mode 100644 index 000000000..8954542ce --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithReferences.ts.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithReferences = { + type: 'array', + contains: { + type: 'ModelWithString', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithStrings.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithStrings.ts.snap new file mode 100644 index 000000000..6960a863c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithStrings.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithStrings = { + type: 'array', + contains: { + type: 'string', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithStrings.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithStrings.ts.ts.snap new file mode 100644 index 000000000..6960a863c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ArrayWithStrings.ts.ts.snap @@ -0,0 +1,6 @@ +export const $ArrayWithStrings = { + type: 'array', + contains: { + type: 'string', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithBackticks.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithBackticks.ts.snap new file mode 100644 index 000000000..80988c7ee --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CommentWithBackticks.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithBackticks.ts.ts.snap new file mode 100644 index 000000000..80988c7ee --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithBackticks.ts.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/test/generated/v3/schemas/$CommentWithBreaks.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithBreaks.ts.snap new file mode 100644 index 000000000..8f5c9d94d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CommentWithBreaks.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithBreaks.ts.ts.snap new file mode 100644 index 000000000..8f5c9d94d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithBreaks.ts.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/test/generated/v3/schemas/$CommentWithExpressionPlaceholders.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithExpressionPlaceholders.ts.snap new file mode 100644 index 000000000..dffe2676e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CommentWithExpressionPlaceholders.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithExpressionPlaceholders.ts.ts.snap new file mode 100644 index 000000000..dffe2676e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithExpressionPlaceholders.ts.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/test/generated/v3/schemas/$CommentWithQuotes.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithQuotes.ts.snap new file mode 100644 index 000000000..a71cb895a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CommentWithQuotes.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithQuotes.ts.ts.snap new file mode 100644 index 000000000..a71cb895a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithQuotes.ts.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/test/generated/v3/schemas/$CommentWithReservedCharacters.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithReservedCharacters.ts.snap new file mode 100644 index 000000000..1436feefa --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CommentWithReservedCharacters.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithReservedCharacters.ts.ts.snap new file mode 100644 index 000000000..1436feefa --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithReservedCharacters.ts.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/test/generated/v3/schemas/$CommentWithSlashes.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithSlashes.ts.snap new file mode 100644 index 000000000..6f72210de --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CommentWithSlashes.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithSlashes.ts.ts.snap new file mode 100644 index 000000000..6f72210de --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CommentWithSlashes.ts.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/test/generated/v3/schemas/$CompositionBaseModel.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionBaseModel.ts.snap new file mode 100644 index 000000000..7806eff05 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionBaseModel.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionBaseModel.ts.ts.snap new file mode 100644 index 000000000..7806eff05 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionBaseModel.ts.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/test/generated/v3/schemas/$CompositionExtendedModel.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionExtendedModel.ts.snap new file mode 100644 index 000000000..1dcc00354 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionExtendedModel.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionExtendedModel.ts.ts.snap new file mode 100644 index 000000000..1dcc00354 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionExtendedModel.ts.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/test/generated/v3/schemas/$CompositionWithAllOfAndNullable.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAllOfAndNullable.ts.snap new file mode 100644 index 000000000..e914c4b21 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithAllOfAndNullable.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAllOfAndNullable.ts.ts.snap new file mode 100644 index 000000000..e914c4b21 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAllOfAndNullable.ts.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/test/generated/v3/schemas/$CompositionWithAnyOf.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOf.ts.snap new file mode 100644 index 000000000..c0bfdc6b2 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithAnyOf.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOf.ts.ts.snap new file mode 100644 index 000000000..c0bfdc6b2 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOf.ts.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/test/generated/v3/schemas/$CompositionWithAnyOfAndNullable.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOfAndNullable.ts.snap new file mode 100644 index 000000000..d363cf5b5 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithAnyOfAndNullable.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOfAndNullable.ts.ts.snap new file mode 100644 index 000000000..d363cf5b5 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOfAndNullable.ts.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/test/generated/v3/schemas/$CompositionWithAnyOfAnonymous.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOfAnonymous.ts.snap new file mode 100644 index 000000000..77ef1edf1 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithAnyOfAnonymous.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOfAnonymous.ts.ts.snap new file mode 100644 index 000000000..77ef1edf1 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithAnyOfAnonymous.ts.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/test/generated/v3/schemas/$CompositionWithNestedAnyAndTypeNull.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithNestedAnyAndTypeNull.ts.snap new file mode 100644 index 000000000..7fa0460c7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithNestedAnyAndTypeNull.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithNestedAnyAndTypeNull.ts.ts.snap new file mode 100644 index 000000000..7fa0460c7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithNestedAnyAndTypeNull.ts.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/test/generated/v3/schemas/$CompositionWithNestedAnyOfAndNull.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithNestedAnyOfAndNull.ts.snap new file mode 100644 index 000000000..bc3b25dff --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithNestedAnyOfAndNull.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithNestedAnyOfAndNull.ts.ts.snap new file mode 100644 index 000000000..bc3b25dff --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithNestedAnyOfAndNull.ts.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/test/generated/v3/schemas/$CompositionWithOneOf.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOf.ts.snap new file mode 100644 index 000000000..6b58a4f80 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithOneOf.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOf.ts.ts.snap new file mode 100644 index 000000000..6b58a4f80 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOf.ts.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/test/generated/v3/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts.snap new file mode 100644 index 000000000..7d9f851cf --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts.ts.snap new file mode 100644 index 000000000..7d9f851cf --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndComplexArrayDictionary.ts.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/test/generated/v3/schemas/$CompositionWithOneOfAndNullable.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndNullable.ts.snap new file mode 100644 index 000000000..ac2abfb26 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithOneOfAndNullable.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndNullable.ts.ts.snap new file mode 100644 index 000000000..ac2abfb26 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndNullable.ts.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/test/generated/v3/schemas/$CompositionWithOneOfAndProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndProperties.ts.snap new file mode 100644 index 000000000..46624abfe --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithOneOfAndProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndProperties.ts.ts.snap new file mode 100644 index 000000000..46624abfe --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndProperties.ts.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/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts.snap new file mode 100644 index 000000000..6e76f722c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts.ts.snap new file mode 100644 index 000000000..6e76f722c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleArrayDictionary.ts.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/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleDictionary.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleDictionary.ts.snap new file mode 100644 index 000000000..8d36278c0 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleDictionary.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleDictionary.ts.ts.snap new file mode 100644 index 000000000..8d36278c0 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAndSimpleDictionary.ts.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/test/generated/v3/schemas/$CompositionWithOneOfAnonymous.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAnonymous.ts.snap new file mode 100644 index 000000000..99a971ea0 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithOneOfAnonymous.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAnonymous.ts.ts.snap new file mode 100644 index 000000000..99a971ea0 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfAnonymous.ts.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/test/generated/v3/schemas/$CompositionWithOneOfDiscriminator.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfDiscriminator.ts.snap new file mode 100644 index 000000000..0a92f9628 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$CompositionWithOneOfDiscriminator.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfDiscriminator.ts.ts.snap new file mode 100644 index 000000000..0a92f9628 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$CompositionWithOneOfDiscriminator.ts.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/test/generated/v3/schemas/$ConstValue.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ConstValue.ts.snap new file mode 100644 index 000000000..14d7e990d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ConstValue.ts.snap @@ -0,0 +1,3 @@ +export const $ConstValue = { + type: '"ConstValue"', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ConstValue.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ConstValue.ts.ts.snap new file mode 100644 index 000000000..14d7e990d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ConstValue.ts.ts.snap @@ -0,0 +1,3 @@ +export const $ConstValue = { + type: '"ConstValue"', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$DeprecatedModel.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DeprecatedModel.ts.snap new file mode 100644 index 000000000..10bf9084c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$DeprecatedModel.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DeprecatedModel.ts.ts.snap new file mode 100644 index 000000000..10bf9084c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$DeprecatedModel.ts.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/test/generated/v3/schemas/$DictionaryWithArray.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithArray.ts.snap new file mode 100644 index 000000000..265bcb6f8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$DictionaryWithArray.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithArray.ts.ts.snap new file mode 100644 index 000000000..265bcb6f8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithArray.ts.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/test/generated/v3/schemas/$DictionaryWithDictionary.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithDictionary.ts.snap new file mode 100644 index 000000000..9c65fceec --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$DictionaryWithDictionary.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithDictionary.ts.ts.snap new file mode 100644 index 000000000..9c65fceec --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithDictionary.ts.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/test/generated/v3/schemas/$DictionaryWithProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithProperties.ts.snap new file mode 100644 index 000000000..3c5686647 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$DictionaryWithProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithProperties.ts.ts.snap new file mode 100644 index 000000000..3c5686647 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithProperties.ts.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/test/generated/v3/schemas/$DictionaryWithReference.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithReference.ts.snap new file mode 100644 index 000000000..a17eceac4 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithReference.ts.snap @@ -0,0 +1,6 @@ +export const $DictionaryWithReference = { + type: 'dictionary', + contains: { + type: 'ModelWithString', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithReference.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithReference.ts.ts.snap new file mode 100644 index 000000000..a17eceac4 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithReference.ts.ts.snap @@ -0,0 +1,6 @@ +export const $DictionaryWithReference = { + type: 'dictionary', + contains: { + type: 'ModelWithString', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithString.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithString.ts.snap new file mode 100644 index 000000000..82e59b164 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithString.ts.snap @@ -0,0 +1,6 @@ +export const $DictionaryWithString = { + type: 'dictionary', + contains: { + type: 'string', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithString.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithString.ts.ts.snap new file mode 100644 index 000000000..82e59b164 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$DictionaryWithString.ts.ts.snap @@ -0,0 +1,6 @@ +export const $DictionaryWithString = { + type: 'dictionary', + contains: { + type: 'string', + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$Enum1.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$Enum1.ts.snap new file mode 100644 index 000000000..3a636f896 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$Enum1.ts.snap @@ -0,0 +1,3 @@ +export const $Enum1 = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$Enum1.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$Enum1.ts.ts.snap new file mode 100644 index 000000000..3a636f896 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$Enum1.ts.ts.snap @@ -0,0 +1,3 @@ +export const $Enum1 = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$EnumFromDescription.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumFromDescription.ts.snap new file mode 100644 index 000000000..55e07639d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$EnumFromDescription.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumFromDescription.ts.ts.snap new file mode 100644 index 000000000..55e07639d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumFromDescription.ts.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/test/generated/v3/schemas/$EnumWithExtensions.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithExtensions.ts.snap new file mode 100644 index 000000000..0dcfaa539 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithExtensions.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithExtensions = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithExtensions.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithExtensions.ts.ts.snap new file mode 100644 index 000000000..0dcfaa539 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithExtensions.ts.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithExtensions = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithNumbers.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithNumbers.ts.snap new file mode 100644 index 000000000..d571cd240 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithNumbers.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithNumbers = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithNumbers.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithNumbers.ts.ts.snap new file mode 100644 index 000000000..d571cd240 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithNumbers.ts.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithNumbers = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithReplacedCharacters.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithReplacedCharacters.ts.snap new file mode 100644 index 000000000..30b0e074e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithReplacedCharacters.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithReplacedCharacters = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithReplacedCharacters.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithReplacedCharacters.ts.ts.snap new file mode 100644 index 000000000..30b0e074e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithReplacedCharacters.ts.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithReplacedCharacters = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithStrings.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithStrings.ts.snap new file mode 100644 index 000000000..a44fadd2f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithStrings.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithStrings = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithStrings.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithStrings.ts.ts.snap new file mode 100644 index 000000000..a44fadd2f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$EnumWithStrings.ts.ts.snap @@ -0,0 +1,3 @@ +export const $EnumWithStrings = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$File.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$File.ts.snap new file mode 100644 index 000000000..619063773 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$File.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$File.ts.ts.snap new file mode 100644 index 000000000..619063773 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$File.ts.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/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap new file mode 100644 index 000000000..57069c83e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.snap @@ -0,0 +1,6 @@ +export const $FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + type: 'dictionary', + contains: { + properties: {}, + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.ts.snap new file mode 100644 index 000000000..57069c83e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqEmptyObject.ts.ts.snap @@ -0,0 +1,6 @@ +export const $FreeFormObjectWithAdditionalPropertiesEqEmptyObject = { + type: 'dictionary', + contains: { + properties: {}, + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap new file mode 100644 index 000000000..2f9c678a8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.snap @@ -0,0 +1,6 @@ +export const $FreeFormObjectWithAdditionalPropertiesEqTrue = { + type: 'dictionary', + contains: { + properties: {}, + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.ts.snap new file mode 100644 index 000000000..2f9c678a8 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithAdditionalPropertiesEqTrue.ts.ts.snap @@ -0,0 +1,6 @@ +export const $FreeFormObjectWithAdditionalPropertiesEqTrue = { + type: 'dictionary', + contains: { + properties: {}, + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.snap new file mode 100644 index 000000000..f04f2246d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.snap @@ -0,0 +1,6 @@ +export const $FreeFormObjectWithoutAdditionalProperties = { + type: 'dictionary', + contains: { + properties: {}, + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.ts.snap new file mode 100644 index 000000000..f04f2246d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$FreeFormObjectWithoutAdditionalProperties.ts.ts.snap @@ -0,0 +1,6 @@ +export const $FreeFormObjectWithoutAdditionalProperties = { + type: 'dictionary', + contains: { + properties: {}, + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ModelCircle.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelCircle.ts.snap new file mode 100644 index 000000000..bc94d07ad --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelCircle.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelCircle.ts.ts.snap new file mode 100644 index 000000000..bc94d07ad --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelCircle.ts.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/test/generated/v3/schemas/$ModelSquare.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelSquare.ts.snap new file mode 100644 index 000000000..36c6ed92f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelSquare.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelSquare.ts.ts.snap new file mode 100644 index 000000000..36c6ed92f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelSquare.ts.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/test/generated/v3/schemas/$ModelThatExtends.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelThatExtends.ts.snap new file mode 100644 index 000000000..c9b2fb64e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelThatExtends.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelThatExtends.ts.ts.snap new file mode 100644 index 000000000..c9b2fb64e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelThatExtends.ts.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/test/generated/v3/schemas/$ModelThatExtendsExtends.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelThatExtendsExtends.ts.snap new file mode 100644 index 000000000..ade58bc66 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelThatExtendsExtends.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelThatExtendsExtends.ts.ts.snap new file mode 100644 index 000000000..ade58bc66 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelThatExtendsExtends.ts.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/test/generated/v3/schemas/$ModelWithAdditionalPropertiesEqTrue.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithAdditionalPropertiesEqTrue.ts.snap new file mode 100644 index 000000000..8da1505af --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithAdditionalPropertiesEqTrue.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithAdditionalPropertiesEqTrue.ts.ts.snap new file mode 100644 index 000000000..8da1505af --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithAdditionalPropertiesEqTrue.ts.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/test/generated/v3/schemas/$ModelWithArray.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithArray.ts.snap new file mode 100644 index 000000000..a45c6dc1e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithArray.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithArray.ts.ts.snap new file mode 100644 index 000000000..a45c6dc1e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithArray.ts.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/test/generated/v3/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts.snap new file mode 100644 index 000000000..e7b7816cf --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts.ts.snap new file mode 100644 index 000000000..e7b7816cf --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithArrayReadOnlyAndWriteOnly.ts.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/test/generated/v3/schemas/$ModelWithBoolean.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithBoolean.ts.snap new file mode 100644 index 000000000..ddea6e065 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithBoolean.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithBoolean.ts.ts.snap new file mode 100644 index 000000000..ddea6e065 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithBoolean.ts.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/test/generated/v3/schemas/$ModelWithCircularReference.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithCircularReference.ts.snap new file mode 100644 index 000000000..6bdf72a9d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithCircularReference.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithCircularReference.ts.ts.snap new file mode 100644 index 000000000..6bdf72a9d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithCircularReference.ts.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/test/generated/v3/schemas/$ModelWithConst.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithConst.ts.snap new file mode 100644 index 000000000..622b63c83 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithConst.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithConst.ts.ts.snap new file mode 100644 index 000000000..622b63c83 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithConst.ts.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/test/generated/v3/schemas/$ModelWithDictionary.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDictionary.ts.snap new file mode 100644 index 000000000..1206c8664 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithDictionary.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDictionary.ts.ts.snap new file mode 100644 index 000000000..1206c8664 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDictionary.ts.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/test/generated/v3/schemas/$ModelWithDuplicateImports.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDuplicateImports.ts.snap new file mode 100644 index 000000000..43d77d2d9 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithDuplicateImports.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDuplicateImports.ts.ts.snap new file mode 100644 index 000000000..43d77d2d9 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDuplicateImports.ts.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/test/generated/v3/schemas/$ModelWithDuplicateProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDuplicateProperties.ts.snap new file mode 100644 index 000000000..e0b6a9210 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithDuplicateProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDuplicateProperties.ts.ts.snap new file mode 100644 index 000000000..e0b6a9210 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithDuplicateProperties.ts.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/test/generated/v3/schemas/$ModelWithEnum.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnum.ts.snap new file mode 100644 index 000000000..51a60c553 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithEnum.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnum.ts.ts.snap new file mode 100644 index 000000000..51a60c553 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnum.ts.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/test/generated/v3/schemas/$ModelWithEnumFromDescription.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnumFromDescription.ts.snap new file mode 100644 index 000000000..0e07bbbd0 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithEnumFromDescription.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnumFromDescription.ts.ts.snap new file mode 100644 index 000000000..0e07bbbd0 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnumFromDescription.ts.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/test/generated/v3/schemas/$ModelWithEnumWithHyphen.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnumWithHyphen.ts.snap new file mode 100644 index 000000000..d21d4069f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithEnumWithHyphen.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnumWithHyphen.ts.ts.snap new file mode 100644 index 000000000..d21d4069f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithEnumWithHyphen.ts.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/test/generated/v3/schemas/$ModelWithInteger.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithInteger.ts.snap new file mode 100644 index 000000000..99a8b75e6 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithInteger.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithInteger.ts.ts.snap new file mode 100644 index 000000000..99a8b75e6 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithInteger.ts.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/test/generated/v3/schemas/$ModelWithNestedArrayEnums.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnums.ts.snap new file mode 100644 index 000000000..808ac231a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithNestedArrayEnums.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnums.ts.ts.snap new file mode 100644 index 000000000..808ac231a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnums.ts.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/test/generated/v3/schemas/$ModelWithNestedArrayEnumsData.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsData.ts.snap new file mode 100644 index 000000000..5b17c30d7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithNestedArrayEnumsData.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsData.ts.ts.snap new file mode 100644 index 000000000..5b17c30d7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsData.ts.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/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataBar.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataBar.ts.snap new file mode 100644 index 000000000..452516d3c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataBar.ts.snap @@ -0,0 +1,3 @@ +export const $ModelWithNestedArrayEnumsDataBar = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataBar.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataBar.ts.ts.snap new file mode 100644 index 000000000..452516d3c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataBar.ts.ts.snap @@ -0,0 +1,3 @@ +export const $ModelWithNestedArrayEnumsDataBar = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.snap new file mode 100644 index 000000000..8ca79794a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.snap @@ -0,0 +1,3 @@ +export const $ModelWithNestedArrayEnumsDataFoo = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.ts.snap new file mode 100644 index 000000000..8ca79794a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedArrayEnumsDataFoo.ts.ts.snap @@ -0,0 +1,3 @@ +export const $ModelWithNestedArrayEnumsDataFoo = { + type: 'Enum', +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedCompositionEnums.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedCompositionEnums.ts.snap new file mode 100644 index 000000000..7f123f5cd --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithNestedCompositionEnums.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedCompositionEnums.ts.ts.snap new file mode 100644 index 000000000..7f123f5cd --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedCompositionEnums.ts.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/test/generated/v3/schemas/$ModelWithNestedEnums.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedEnums.ts.snap new file mode 100644 index 000000000..646cd8612 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithNestedEnums.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedEnums.ts.ts.snap new file mode 100644 index 000000000..646cd8612 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedEnums.ts.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/test/generated/v3/schemas/$ModelWithNestedProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedProperties.ts.snap new file mode 100644 index 000000000..c251fdb49 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithNestedProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedProperties.ts.ts.snap new file mode 100644 index 000000000..c251fdb49 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNestedProperties.ts.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/test/generated/v3/schemas/$ModelWithNullableObject.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableObject.ts.snap new file mode 100644 index 000000000..98e906b03 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableObject.ts.snap @@ -0,0 +1,7 @@ +export const $ModelWithNullableObject = { + properties: { + data: { + type: 'NullableObject', + }, + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableObject.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableObject.ts.ts.snap new file mode 100644 index 000000000..98e906b03 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableObject.ts.ts.snap @@ -0,0 +1,7 @@ +export const $ModelWithNullableObject = { + properties: { + data: { + type: 'NullableObject', + }, + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableString.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableString.ts.snap new file mode 100644 index 000000000..9f7287b8b --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithNullableString.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableString.ts.ts.snap new file mode 100644 index 000000000..9f7287b8b --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithNullableString.ts.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/test/generated/v3/schemas/$ModelWithOneOfEnum.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithOneOfEnum.ts.snap new file mode 100644 index 000000000..401790d8d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithOneOfEnum.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithOneOfEnum.ts.ts.snap new file mode 100644 index 000000000..401790d8d --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithOneOfEnum.ts.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/test/generated/v3/schemas/$ModelWithOrderedProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithOrderedProperties.ts.snap new file mode 100644 index 000000000..b26c44366 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithOrderedProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithOrderedProperties.ts.ts.snap new file mode 100644 index 000000000..b26c44366 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithOrderedProperties.ts.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/test/generated/v3/schemas/$ModelWithPattern.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithPattern.ts.snap new file mode 100644 index 000000000..be54e210f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithPattern.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithPattern.ts.ts.snap new file mode 100644 index 000000000..be54e210f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithPattern.ts.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/test/generated/v3/schemas/$ModelWithProperties.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithProperties.ts.snap new file mode 100644 index 000000000..cb24e6591 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithProperties.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithProperties.ts.ts.snap new file mode 100644 index 000000000..cb24e6591 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithProperties.ts.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/test/generated/v3/schemas/$ModelWithReadOnlyAndWriteOnly.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithReadOnlyAndWriteOnly.ts.snap new file mode 100644 index 000000000..3e53de126 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithReadOnlyAndWriteOnly.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithReadOnlyAndWriteOnly.ts.ts.snap new file mode 100644 index 000000000..3e53de126 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithReadOnlyAndWriteOnly.ts.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/test/generated/v3/schemas/$ModelWithReference.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithReference.ts.snap new file mode 100644 index 000000000..92b55aa89 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithReference.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithReference.ts.ts.snap new file mode 100644 index 000000000..92b55aa89 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithReference.ts.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/test/generated/v3/schemas/$ModelWithString.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithString.ts.snap new file mode 100644 index 000000000..6fe3639a7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$ModelWithString.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithString.ts.ts.snap new file mode 100644 index 000000000..6fe3639a7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$ModelWithString.ts.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/test/generated/v3/schemas/$NestedAnyOfArraysNullable.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$NestedAnyOfArraysNullable.ts.snap new file mode 100644 index 000000000..d8788c457 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$NestedAnyOfArraysNullable.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$NestedAnyOfArraysNullable.ts.ts.snap new file mode 100644 index 000000000..d8788c457 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$NestedAnyOfArraysNullable.ts.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/test/generated/v3/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/test/generated/v3/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/test/generated/v3/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/test/generated/v3/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.ts.snap" "b/test/__snapshots__/v3/test/generated/v3/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.ts.snap" new file mode 100644 index 000000000..e13d8b667 --- /dev/null +++ "b/test/__snapshots__/v3/test/generated/v3/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.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/test/generated/v3/schemas/$NullableObject.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$NullableObject.ts.snap new file mode 100644 index 000000000..c2d19cd31 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$NullableObject.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$NullableObject.ts.ts.snap new file mode 100644 index 000000000..c2d19cd31 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$NullableObject.ts.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/test/generated/v3/schemas/$Pageable.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$Pageable.ts.snap new file mode 100644 index 000000000..e66f2a422 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$Pageable.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$Pageable.ts.ts.snap new file mode 100644 index 000000000..e66f2a422 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$Pageable.ts.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/test/generated/v3/schemas/$SimpleBoolean.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleBoolean.ts.snap new file mode 100644 index 000000000..2b76fbf1a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$SimpleBoolean.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleBoolean.ts.ts.snap new file mode 100644 index 000000000..2b76fbf1a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleBoolean.ts.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/test/generated/v3/schemas/$SimpleFile.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleFile.ts.snap new file mode 100644 index 000000000..2b54958e2 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$SimpleFile.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleFile.ts.ts.snap new file mode 100644 index 000000000..2b54958e2 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleFile.ts.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/test/generated/v3/schemas/$SimpleInteger.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleInteger.ts.snap new file mode 100644 index 000000000..c4607071c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$SimpleInteger.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleInteger.ts.ts.snap new file mode 100644 index 000000000..c4607071c --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleInteger.ts.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/test/generated/v3/schemas/$SimpleParameter.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleParameter.ts.snap new file mode 100644 index 000000000..530bdef01 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$SimpleParameter.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleParameter.ts.ts.snap new file mode 100644 index 000000000..530bdef01 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleParameter.ts.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/test/generated/v3/schemas/$SimpleReference.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleReference.ts.snap new file mode 100644 index 000000000..02091af33 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$SimpleReference.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleReference.ts.ts.snap new file mode 100644 index 000000000..02091af33 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleReference.ts.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/test/generated/v3/schemas/$SimpleString.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleString.ts.snap new file mode 100644 index 000000000..ad4de9003 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$SimpleString.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleString.ts.ts.snap new file mode 100644 index 000000000..ad4de9003 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleString.ts.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/test/generated/v3/schemas/$SimpleStringWithPattern.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleStringWithPattern.ts.snap new file mode 100644 index 000000000..12ff1ff30 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/schemas/$SimpleStringWithPattern.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleStringWithPattern.ts.ts.snap new file mode 100644 index 000000000..12ff1ff30 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$SimpleStringWithPattern.ts.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/test/generated/v3/schemas/$_default.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$_default.ts.snap new file mode 100644 index 000000000..c8fa6c53e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$_default.ts.snap @@ -0,0 +1,7 @@ +export const $_default = { + properties: { + name: { + type: 'string', + }, + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/schemas/$_default.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/schemas/$_default.ts.ts.snap new file mode 100644 index 000000000..c8fa6c53e --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/schemas/$_default.ts.ts.snap @@ -0,0 +1,7 @@ +export const $_default = { + properties: { + name: { + type: 'string', + }, + }, +} as const; diff --git a/test/__snapshots__/v3/test/generated/v3/services/CollectionFormatService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/CollectionFormatService.ts.snap new file mode 100644 index 000000000..82db211fd --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/CollectionFormatService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/CollectionFormatService.ts.ts.snap new file mode 100644 index 000000000..82db211fd --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/CollectionFormatService.ts.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/test/generated/v3/services/ComplexService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/ComplexService.ts.snap new file mode 100644 index 000000000..bf860d12f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/ComplexService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/ComplexService.ts.ts.snap new file mode 100644 index 000000000..bf860d12f --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/ComplexService.ts.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/test/generated/v3/services/DefaultService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/DefaultService.ts.snap new file mode 100644 index 000000000..215cd809a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/DefaultService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/DefaultService.ts.ts.snap new file mode 100644 index 000000000..215cd809a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/DefaultService.ts.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/test/generated/v3/services/DefaultsService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/DefaultsService.ts.snap new file mode 100644 index 000000000..2113b1b5a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/DefaultsService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/DefaultsService.ts.ts.snap new file mode 100644 index 000000000..2113b1b5a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/DefaultsService.ts.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/test/generated/v3/services/DeprecatedService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/DeprecatedService.ts.snap new file mode 100644 index 000000000..a7d7c8fde --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/DeprecatedService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/DeprecatedService.ts.ts.snap new file mode 100644 index 000000000..a7d7c8fde --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/DeprecatedService.ts.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/test/generated/v3/services/DescriptionsService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/DescriptionsService.ts.snap new file mode 100644 index 000000000..4542a21a4 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/DescriptionsService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/DescriptionsService.ts.ts.snap new file mode 100644 index 000000000..4542a21a4 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/DescriptionsService.ts.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/test/generated/v3/services/DuplicateService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/DuplicateService.ts.snap new file mode 100644 index 000000000..7381aac77 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/DuplicateService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/DuplicateService.ts.ts.snap new file mode 100644 index 000000000..7381aac77 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/DuplicateService.ts.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/test/generated/v3/services/ErrorService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/ErrorService.ts.snap new file mode 100644 index 000000000..751c848e3 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/ErrorService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/ErrorService.ts.ts.snap new file mode 100644 index 000000000..751c848e3 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/ErrorService.ts.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/test/generated/v3/services/FileResponseService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/FileResponseService.ts.snap new file mode 100644 index 000000000..ca3412454 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/FileResponseService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/FileResponseService.ts.ts.snap new file mode 100644 index 000000000..ca3412454 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/FileResponseService.ts.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/test/generated/v3/services/FormDataService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/FormDataService.ts.snap new file mode 100644 index 000000000..eb022cee7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/FormDataService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/FormDataService.ts.ts.snap new file mode 100644 index 000000000..eb022cee7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/FormDataService.ts.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/test/generated/v3/services/HeaderService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/HeaderService.ts.snap new file mode 100644 index 000000000..e451c3035 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/HeaderService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/HeaderService.ts.ts.snap new file mode 100644 index 000000000..e451c3035 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/HeaderService.ts.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/test/generated/v3/services/MultipartService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/MultipartService.ts.snap new file mode 100644 index 000000000..e261c7d1b --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/MultipartService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/MultipartService.ts.ts.snap new file mode 100644 index 000000000..e261c7d1b --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/MultipartService.ts.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/test/generated/v3/services/MultipleTags1Service.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/MultipleTags1Service.ts.snap new file mode 100644 index 000000000..21cac6e19 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/MultipleTags1Service.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/MultipleTags1Service.ts.ts.snap new file mode 100644 index 000000000..21cac6e19 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/MultipleTags1Service.ts.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/test/generated/v3/services/MultipleTags2Service.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/MultipleTags2Service.ts.snap new file mode 100644 index 000000000..1c86961ad --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/MultipleTags2Service.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/MultipleTags2Service.ts.ts.snap new file mode 100644 index 000000000..1c86961ad --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/MultipleTags2Service.ts.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/test/generated/v3/services/MultipleTags3Service.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/MultipleTags3Service.ts.snap new file mode 100644 index 000000000..15fc09d44 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/MultipleTags3Service.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/MultipleTags3Service.ts.ts.snap new file mode 100644 index 000000000..15fc09d44 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/MultipleTags3Service.ts.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/test/generated/v3/services/NoContentService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/NoContentService.ts.snap new file mode 100644 index 000000000..4af0ece57 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/NoContentService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/NoContentService.ts.ts.snap new file mode 100644 index 000000000..4af0ece57 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/NoContentService.ts.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/test/generated/v3/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/test/generated/v3/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/test/generated/v3/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/test/generated/v3/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.ts.snap" "b/test/__snapshots__/v3/test/generated/v3/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.ts.snap" new file mode 100644 index 000000000..6f1531593 --- /dev/null +++ "b/test/__snapshots__/v3/test/generated/v3/services/NonAscii\303\206\303\270\303\245\303\206\303\270\303\205\303\266\303\264\303\252\303\212Service.ts.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/test/generated/v3/services/ParametersService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/ParametersService.ts.snap new file mode 100644 index 000000000..4c52894ac --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/ParametersService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/ParametersService.ts.ts.snap new file mode 100644 index 000000000..4c52894ac --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/ParametersService.ts.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/test/generated/v3/services/RequestBodyService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/RequestBodyService.ts.snap new file mode 100644 index 000000000..ebb601f3a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/RequestBodyService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/RequestBodyService.ts.ts.snap new file mode 100644 index 000000000..ebb601f3a --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/RequestBodyService.ts.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/test/generated/v3/services/ResponseService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/ResponseService.ts.snap new file mode 100644 index 000000000..438989ce7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/ResponseService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/ResponseService.ts.ts.snap new file mode 100644 index 000000000..438989ce7 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/ResponseService.ts.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/test/generated/v3/services/SimpleService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/SimpleService.ts.snap new file mode 100644 index 000000000..733ff7439 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/SimpleService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/SimpleService.ts.ts.snap new file mode 100644 index 000000000..733ff7439 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/SimpleService.ts.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/test/generated/v3/services/TypesService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/TypesService.ts.snap new file mode 100644 index 000000000..992dac546 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/TypesService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/TypesService.ts.ts.snap new file mode 100644 index 000000000..992dac546 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/TypesService.ts.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/test/generated/v3/services/UploadService.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/UploadService.ts.snap new file mode 100644 index 000000000..f6da46b23 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/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/test/generated/v3/services/UploadService.ts.ts.snap b/test/__snapshots__/v3/test/generated/v3/services/UploadService.ts.ts.snap new file mode 100644 index 000000000..f6da46b23 --- /dev/null +++ b/test/__snapshots__/v3/test/generated/v3/services/UploadService.ts.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/index.spec.ts b/test/index.spec.ts index 5ec17de1f..8e1c045d2 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -21,7 +21,7 @@ describe('v2', () => { sync('./test/generated/v2/**/*.ts').forEach(file => { const content = readFileSync(file, 'utf8').toString(); - expect(content).toMatchSnapshot(file); + expect(content).toMatchFileSnapshot(`./__snapshots__/v2/${file}.snap`); }); }); }); @@ -42,7 +42,7 @@ describe('v3', () => { sync('./test/generated/v3/**/*.ts').forEach(file => { const content = readFileSync(file, 'utf8').toString(); - expect(content).toMatchSnapshot(file); + expect(content).toMatchFileSnapshot(`./__snapshots__/v3/${file}.snap`); }); }); @@ -62,7 +62,7 @@ describe('v3', () => { sync('./test/generated/v3_date/**/*.ts').forEach(file => { const content = readFileSync(file, 'utf8').toString(); - expect(content).toMatchSnapshot(file); + expect(content).toMatchFileSnapshot(`./__snapshots__/v3-date/${file}.snap`); }); }); @@ -82,7 +82,7 @@ describe('v3', () => { sync('./test/generated/v3_options/**/*.ts').forEach(file => { const content = readFileSync(file, 'utf8').toString(); - expect(content).toMatchSnapshot(file); + expect(content).toMatchFileSnapshot(`./__snapshots__/v3-options/${file}.snap`); }); }); });