From f950ac97e8b03b95bddd5e0447a73f1272c80e13 Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:40:58 +0100 Subject: [PATCH] [swift][client] make QueryStringEncodable return any Sendable (#21142) * [swift][client] make QueryStringEncodable return any Sendable * [swift][client] rename QueryStringEncodable to ParameterConvertible * [swift][client] update migration docs * Revert "[swift][client] update migration docs" This reverts commit 00a490536df393c4075e3e739b2e33446f614988. * [swift][client] rename QueryStringEncodable to ParameterConvertible --- docs/generators/swift6.md | 2 +- .../languages/Swift6ClientCodegen.java | 14 +-- .../main/resources/swift6/Extensions.mustache | 87 +++++++++---------- .../src/main/resources/swift6/Models.mustache | 4 +- .../swift6/OpenAPIDateWithoutTime.mustache | 4 +- .../src/main/resources/swift6/_param.mustache | 2 +- .../main/resources/swift6/modelEnum.mustache | 2 +- .../modelInlineEnumDeclaration.mustache | 2 +- .../resources/swift6/modelObject.mustache | 4 +- .../main/resources/swift6/modelOneOf.mustache | 2 +- .../Swift6ClientCodegenOptionsProvider.java | 4 +- .../Sources/PetstoreClient/APIs/FakeAPI.swift | 62 ++++++------- .../Sources/PetstoreClient/APIs/PetAPI.swift | 18 ++-- .../Sources/PetstoreClient/APIs/UserAPI.swift | 4 +- .../Infrastructure/Extensions.swift | 87 +++++++++---------- .../Infrastructure/Models.swift | 4 +- .../OpenAPIDateWithoutTime.swift | 4 +- .../Models/AdditionalPropertiesClass.swift | 2 +- .../PetstoreClient/Models/Animal.swift | 2 +- .../PetstoreClient/Models/ApiResponse.swift | 2 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 2 +- .../Models/ArrayOfNumberOnly.swift | 2 +- .../PetstoreClient/Models/ArrayTest.swift | 2 +- .../Models/Capitalization.swift | 2 +- .../Sources/PetstoreClient/Models/Cat.swift | 2 +- .../PetstoreClient/Models/Category.swift | 2 +- .../PetstoreClient/Models/ClassModel.swift | 2 +- .../PetstoreClient/Models/Client.swift | 2 +- .../Sources/PetstoreClient/Models/Dog.swift | 2 +- .../PetstoreClient/Models/EnumArrays.swift | 2 +- .../PetstoreClient/Models/EnumTest.swift | 2 +- .../Sources/PetstoreClient/Models/File.swift | 2 +- .../Models/FileSchemaTestClass.swift | 2 +- .../PetstoreClient/Models/FormatTest.swift | 2 +- .../Models/HasOnlyReadOnly.swift | 2 +- .../Sources/PetstoreClient/Models/List.swift | 2 +- .../PetstoreClient/Models/MapTest.swift | 2 +- ...opertiesAndAdditionalPropertiesClass.swift | 2 +- .../Models/Model200Response.swift | 2 +- .../Sources/PetstoreClient/Models/Name.swift | 2 +- .../PetstoreClient/Models/NumberOnly.swift | 2 +- .../Sources/PetstoreClient/Models/Order.swift | 2 +- .../Models/OuterComposite.swift | 2 +- .../Sources/PetstoreClient/Models/Pet.swift | 2 +- .../PetstoreClient/Models/ReadOnlyFirst.swift | 2 +- .../PetstoreClient/Models/Return.swift | 2 +- .../Models/SpecialModelName.swift | 2 +- .../Models/StringBooleanMap.swift | 2 +- .../Sources/PetstoreClient/Models/Tag.swift | 2 +- .../Models/TypeHolderDefault.swift | 2 +- .../Models/TypeHolderExample.swift | 2 +- .../Sources/PetstoreClient/Models/User.swift | 2 +- .../SwaggerClientTests/DateFormatTests.swift | 8 +- .../Sources/PetstoreClient/APIs/FakeAPI.swift | 62 ++++++------- .../Sources/PetstoreClient/APIs/PetAPI.swift | 18 ++-- .../Sources/PetstoreClient/APIs/UserAPI.swift | 4 +- .../Infrastructure/Extensions.swift | 87 +++++++++---------- .../Infrastructure/Models.swift | 4 +- .../Models/AdditionalPropertiesClass.swift | 2 +- .../PetstoreClient/Models/Animal.swift | 2 +- .../PetstoreClient/Models/ApiResponse.swift | 2 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 2 +- .../Models/ArrayOfNumberOnly.swift | 2 +- .../PetstoreClient/Models/ArrayTest.swift | 2 +- .../Models/Capitalization.swift | 2 +- .../Sources/PetstoreClient/Models/Cat.swift | 2 +- .../PetstoreClient/Models/Category.swift | 2 +- .../PetstoreClient/Models/ClassModel.swift | 2 +- .../PetstoreClient/Models/Client.swift | 2 +- .../Sources/PetstoreClient/Models/Dog.swift | 2 +- .../PetstoreClient/Models/EnumArrays.swift | 2 +- .../PetstoreClient/Models/EnumTest.swift | 2 +- .../Sources/PetstoreClient/Models/File.swift | 2 +- .../Models/FileSchemaTestClass.swift | 2 +- .../PetstoreClient/Models/FormatTest.swift | 2 +- .../Models/HasOnlyReadOnly.swift | 2 +- .../Sources/PetstoreClient/Models/List.swift | 2 +- .../PetstoreClient/Models/MapTest.swift | 2 +- ...opertiesAndAdditionalPropertiesClass.swift | 2 +- .../Models/Model200Response.swift | 2 +- .../Sources/PetstoreClient/Models/Name.swift | 2 +- .../PetstoreClient/Models/NumberOnly.swift | 2 +- .../Sources/PetstoreClient/Models/Order.swift | 2 +- .../Models/OuterComposite.swift | 2 +- .../Sources/PetstoreClient/Models/Pet.swift | 2 +- .../PetstoreClient/Models/ReadOnlyFirst.swift | 2 +- .../PetstoreClient/Models/Return.swift | 2 +- .../Models/SpecialModelName.swift | 2 +- .../Sources/PetstoreClient/Models/Tag.swift | 2 +- .../Models/TypeHolderDefault.swift | 2 +- .../Models/TypeHolderExample.swift | 2 +- .../Sources/PetstoreClient/Models/User.swift | 2 +- .../Sources/PetstoreClient/APIs/FakeAPI.swift | 62 ++++++------- .../Sources/PetstoreClient/APIs/PetAPI.swift | 18 ++-- .../Sources/PetstoreClient/APIs/UserAPI.swift | 4 +- .../Infrastructure/Extensions.swift | 87 +++++++++---------- .../Infrastructure/Models.swift | 4 +- .../Models/AdditionalPropertiesClass.swift | 2 +- .../PetstoreClient/Models/Animal.swift | 2 +- .../PetstoreClient/Models/ApiResponse.swift | 2 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 2 +- .../Models/ArrayOfNumberOnly.swift | 2 +- .../PetstoreClient/Models/ArrayTest.swift | 2 +- .../Models/Capitalization.swift | 2 +- .../Sources/PetstoreClient/Models/Cat.swift | 2 +- .../PetstoreClient/Models/Category.swift | 2 +- .../PetstoreClient/Models/ClassModel.swift | 2 +- .../PetstoreClient/Models/Client.swift | 2 +- .../Sources/PetstoreClient/Models/Dog.swift | 2 +- .../PetstoreClient/Models/EnumArrays.swift | 2 +- .../PetstoreClient/Models/EnumTest.swift | 2 +- .../Sources/PetstoreClient/Models/File.swift | 2 +- .../Models/FileSchemaTestClass.swift | 2 +- .../PetstoreClient/Models/FormatTest.swift | 2 +- .../Models/HasOnlyReadOnly.swift | 2 +- .../Sources/PetstoreClient/Models/List.swift | 2 +- .../PetstoreClient/Models/MapTest.swift | 2 +- ...opertiesAndAdditionalPropertiesClass.swift | 2 +- .../Models/Model200Response.swift | 2 +- .../Sources/PetstoreClient/Models/Name.swift | 2 +- .../PetstoreClient/Models/NumberOnly.swift | 2 +- .../Sources/PetstoreClient/Models/Order.swift | 2 +- .../Models/OuterComposite.swift | 2 +- .../Sources/PetstoreClient/Models/Pet.swift | 2 +- .../PetstoreClient/Models/ReadOnlyFirst.swift | 2 +- .../PetstoreClient/Models/Return.swift | 2 +- .../Models/SpecialModelName.swift | 2 +- .../Models/StringBooleanMap.swift | 2 +- .../Sources/PetstoreClient/Models/Tag.swift | 2 +- .../Models/TypeHolderDefault.swift | 2 +- .../Models/TypeHolderExample.swift | 2 +- .../Sources/PetstoreClient/Models/User.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 62 ++++++------- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 ++-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 4 +- .../OpenAPIs/Infrastructure/Extensions.swift | 87 +++++++++---------- .../OpenAPIs/Infrastructure/Models.swift | 4 +- .../Models/AdditionalPropertiesClass.swift | 2 +- .../Classes/OpenAPIs/Models/Animal.swift | 2 +- .../Classes/OpenAPIs/Models/ApiResponse.swift | 2 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 2 +- .../OpenAPIs/Models/ArrayOfNumberOnly.swift | 2 +- .../Classes/OpenAPIs/Models/ArrayTest.swift | 2 +- .../OpenAPIs/Models/Capitalization.swift | 2 +- .../Classes/OpenAPIs/Models/Cat.swift | 2 +- .../Classes/OpenAPIs/Models/Category.swift | 2 +- .../Classes/OpenAPIs/Models/ClassModel.swift | 2 +- .../Classes/OpenAPIs/Models/Client.swift | 2 +- .../Classes/OpenAPIs/Models/Dog.swift | 2 +- .../Classes/OpenAPIs/Models/EnumArrays.swift | 2 +- .../Classes/OpenAPIs/Models/EnumTest.swift | 2 +- .../Classes/OpenAPIs/Models/File.swift | 2 +- .../OpenAPIs/Models/FileSchemaTestClass.swift | 2 +- .../Classes/OpenAPIs/Models/FormatTest.swift | 2 +- .../OpenAPIs/Models/HasOnlyReadOnly.swift | 2 +- .../Classes/OpenAPIs/Models/List.swift | 2 +- .../Classes/OpenAPIs/Models/MapTest.swift | 2 +- ...opertiesAndAdditionalPropertiesClass.swift | 2 +- .../OpenAPIs/Models/Model200Response.swift | 2 +- .../Classes/OpenAPIs/Models/Name.swift | 2 +- .../Classes/OpenAPIs/Models/NumberOnly.swift | 2 +- .../Classes/OpenAPIs/Models/Order.swift | 2 +- .../OpenAPIs/Models/OuterComposite.swift | 2 +- .../Classes/OpenAPIs/Models/Pet.swift | 2 +- .../OpenAPIs/Models/ReadOnlyFirst.swift | 2 +- .../Classes/OpenAPIs/Models/Return.swift | 2 +- .../OpenAPIs/Models/SpecialModelName.swift | 2 +- .../OpenAPIs/Models/StringBooleanMap.swift | 2 +- .../Classes/OpenAPIs/Models/Tag.swift | 2 +- .../OpenAPIs/Models/TypeHolderDefault.swift | 2 +- .../OpenAPIs/Models/TypeHolderExample.swift | 2 +- .../Classes/OpenAPIs/Models/User.swift | 2 +- .../Sources/CombineLibrary/APIs/FakeAPI.swift | 62 ++++++------- .../Sources/CombineLibrary/APIs/PetAPI.swift | 18 ++-- .../Sources/CombineLibrary/APIs/UserAPI.swift | 4 +- .../Infrastructure/Extensions.swift | 87 +++++++++---------- .../Infrastructure/Models.swift | 4 +- .../Models/AdditionalPropertiesClass.swift | 2 +- .../CombineLibrary/Models/Animal.swift | 2 +- .../CombineLibrary/Models/ApiResponse.swift | 2 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 2 +- .../Models/ArrayOfNumberOnly.swift | 2 +- .../CombineLibrary/Models/ArrayTest.swift | 2 +- .../Models/Capitalization.swift | 2 +- .../Sources/CombineLibrary/Models/Cat.swift | 2 +- .../CombineLibrary/Models/Category.swift | 2 +- .../CombineLibrary/Models/ClassModel.swift | 2 +- .../CombineLibrary/Models/Client.swift | 2 +- .../Sources/CombineLibrary/Models/Dog.swift | 2 +- .../CombineLibrary/Models/EnumArrays.swift | 2 +- .../CombineLibrary/Models/EnumTest.swift | 2 +- .../Sources/CombineLibrary/Models/File.swift | 2 +- .../Models/FileSchemaTestClass.swift | 2 +- .../CombineLibrary/Models/FormatTest.swift | 2 +- .../Models/HasOnlyReadOnly.swift | 2 +- .../Sources/CombineLibrary/Models/List.swift | 2 +- .../CombineLibrary/Models/MapTest.swift | 2 +- ...opertiesAndAdditionalPropertiesClass.swift | 2 +- .../Models/Model200Response.swift | 2 +- .../Sources/CombineLibrary/Models/Name.swift | 2 +- .../CombineLibrary/Models/NumberOnly.swift | 2 +- .../Sources/CombineLibrary/Models/Order.swift | 2 +- .../Models/OuterComposite.swift | 2 +- .../Sources/CombineLibrary/Models/Pet.swift | 2 +- .../CombineLibrary/Models/ReadOnlyFirst.swift | 2 +- .../CombineLibrary/Models/Return.swift | 2 +- .../Models/SpecialModelName.swift | 2 +- .../Models/StringBooleanMap.swift | 2 +- .../Sources/CombineLibrary/Models/Tag.swift | 2 +- .../Models/TypeHolderDefault.swift | 2 +- .../Models/TypeHolderExample.swift | 2 +- .../Sources/CombineLibrary/Models/User.swift | 2 +- .../PetstoreClient/APIs/AnotherFakeAPI.swift | 2 +- .../Sources/PetstoreClient/APIs/FakeAPI.swift | 72 +++++++-------- .../Sources/PetstoreClient/APIs/PetAPI.swift | 18 ++-- .../Sources/PetstoreClient/APIs/UserAPI.swift | 4 +- .../Infrastructure/Extensions.swift | 87 +++++++++---------- .../Infrastructure/Models.swift | 4 +- .../Models/AdditionalPropertiesAnyType.swift | 2 +- .../Models/AdditionalPropertiesArray.swift | 2 +- .../Models/AdditionalPropertiesBoolean.swift | 2 +- .../Models/AdditionalPropertiesClass.swift | 2 +- .../Models/AdditionalPropertiesInteger.swift | 2 +- .../Models/AdditionalPropertiesNumber.swift | 2 +- .../Models/AdditionalPropertiesObject.swift | 2 +- .../Models/AdditionalPropertiesString.swift | 2 +- .../PetstoreClient/Models/Animal.swift | 2 +- .../PetstoreClient/Models/ApiResponse.swift | 2 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 2 +- .../Models/ArrayOfNumberOnly.swift | 2 +- .../PetstoreClient/Models/ArrayTest.swift | 2 +- .../PetstoreClient/Models/BigCat.swift | 2 +- .../Models/Capitalization.swift | 2 +- .../Sources/PetstoreClient/Models/Cat.swift | 2 +- .../PetstoreClient/Models/Category.swift | 2 +- .../PetstoreClient/Models/ClassModel.swift | 2 +- .../PetstoreClient/Models/Client.swift | 2 +- .../Sources/PetstoreClient/Models/Dog.swift | 2 +- .../PetstoreClient/Models/EnumArrays.swift | 2 +- .../PetstoreClient/Models/EnumTest.swift | 2 +- .../Sources/PetstoreClient/Models/File.swift | 2 +- .../Models/FileSchemaTestClass.swift | 2 +- .../PetstoreClient/Models/FormatTest.swift | 2 +- .../Models/HasOnlyReadOnly.swift | 2 +- .../Sources/PetstoreClient/Models/List.swift | 2 +- .../PetstoreClient/Models/MapTest.swift | 2 +- ...opertiesAndAdditionalPropertiesClass.swift | 2 +- .../Models/Model200Response.swift | 2 +- .../Sources/PetstoreClient/Models/Name.swift | 2 +- .../PetstoreClient/Models/NumberOnly.swift | 2 +- .../Sources/PetstoreClient/Models/Order.swift | 2 +- .../Models/OuterComposite.swift | 2 +- .../Sources/PetstoreClient/Models/Pet.swift | 2 +- .../PetstoreClient/Models/ReadOnlyFirst.swift | 2 +- .../PetstoreClient/Models/Return.swift | 2 +- .../Models/SpecialModelName.swift | 2 +- .../Models/StringBooleanMap.swift | 2 +- .../Sources/PetstoreClient/Models/Tag.swift | 2 +- .../Models/TypeHolderDefault.swift | 2 +- .../Models/TypeHolderExample.swift | 2 +- .../Sources/PetstoreClient/Models/User.swift | 2 +- .../PetstoreClient/Models/XmlItem.swift | 2 +- .../SwaggerClientTests/DateFormatTests.swift | 8 +- .../Sources/PetstoreClient/APIs/FakeAPI.swift | 62 ++++++------- .../Sources/PetstoreClient/APIs/PetAPI.swift | 18 ++-- .../Sources/PetstoreClient/APIs/UserAPI.swift | 4 +- .../Infrastructure/Extensions.swift | 87 +++++++++---------- .../Infrastructure/Models.swift | 4 +- .../Models/AdditionalPropertiesClass.swift | 2 +- .../PetstoreClient/Models/Animal.swift | 2 +- .../PetstoreClient/Models/ApiResponse.swift | 2 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 2 +- .../Models/ArrayOfNumberOnly.swift | 2 +- .../PetstoreClient/Models/ArrayTest.swift | 2 +- .../Models/Capitalization.swift | 2 +- .../Sources/PetstoreClient/Models/Cat.swift | 2 +- .../PetstoreClient/Models/Category.swift | 2 +- .../PetstoreClient/Models/ClassModel.swift | 2 +- .../PetstoreClient/Models/Client.swift | 2 +- .../Sources/PetstoreClient/Models/Dog.swift | 2 +- .../PetstoreClient/Models/EnumArrays.swift | 2 +- .../PetstoreClient/Models/EnumTest.swift | 2 +- .../Sources/PetstoreClient/Models/File.swift | 2 +- .../Models/FileSchemaTestClass.swift | 2 +- .../PetstoreClient/Models/FormatTest.swift | 2 +- .../Models/HasOnlyReadOnly.swift | 2 +- .../Sources/PetstoreClient/Models/List.swift | 2 +- .../PetstoreClient/Models/MapTest.swift | 2 +- ...opertiesAndAdditionalPropertiesClass.swift | 2 +- .../Models/Model200Response.swift | 2 +- .../Sources/PetstoreClient/Models/Name.swift | 2 +- .../PetstoreClient/Models/NumberOnly.swift | 2 +- .../Sources/PetstoreClient/Models/Order.swift | 2 +- .../Models/OuterComposite.swift | 2 +- .../Sources/PetstoreClient/Models/Pet.swift | 2 +- .../PetstoreClient/Models/ReadOnlyFirst.swift | 2 +- .../PetstoreClient/Models/Return.swift | 2 +- .../Models/SpecialModelName.swift | 2 +- .../Models/StringBooleanMap.swift | 2 +- .../Sources/PetstoreClient/Models/Tag.swift | 2 +- .../Models/TypeHolderDefault.swift | 2 +- .../Models/TypeHolderExample.swift | 2 +- .../Sources/PetstoreClient/Models/User.swift | 2 +- .../OpenAPIs/Infrastructure/Extensions.swift | 87 +++++++++---------- .../OpenAPIs/Infrastructure/Models.swift | 4 +- .../Classes/OpenAPIs/Models/Apple.swift | 2 +- .../Classes/OpenAPIs/Models/Banana.swift | 2 +- .../Classes/OpenAPIs/Models/Fruit.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 62 ++++++------- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 ++-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 4 +- .../OpenAPIs/Infrastructure/Extensions.swift | 87 +++++++++---------- .../OpenAPIs/Infrastructure/Models.swift | 4 +- .../Models/AdditionalPropertiesClass.swift | 2 +- .../Classes/OpenAPIs/Models/Animal.swift | 2 +- .../Classes/OpenAPIs/Models/ApiResponse.swift | 2 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 2 +- .../OpenAPIs/Models/ArrayOfNumberOnly.swift | 2 +- .../Classes/OpenAPIs/Models/ArrayTest.swift | 2 +- .../OpenAPIs/Models/Capitalization.swift | 2 +- .../Classes/OpenAPIs/Models/Cat.swift | 2 +- .../Classes/OpenAPIs/Models/Category.swift | 2 +- .../Classes/OpenAPIs/Models/ClassModel.swift | 2 +- .../Classes/OpenAPIs/Models/Client.swift | 2 +- .../Classes/OpenAPIs/Models/Dog.swift | 2 +- .../Classes/OpenAPIs/Models/EnumArrays.swift | 2 +- .../Classes/OpenAPIs/Models/EnumTest.swift | 2 +- .../Classes/OpenAPIs/Models/File.swift | 2 +- .../OpenAPIs/Models/FileSchemaTestClass.swift | 2 +- .../Classes/OpenAPIs/Models/FormatTest.swift | 2 +- .../OpenAPIs/Models/HasOnlyReadOnly.swift | 2 +- .../Classes/OpenAPIs/Models/List.swift | 2 +- .../Classes/OpenAPIs/Models/MapTest.swift | 2 +- ...opertiesAndAdditionalPropertiesClass.swift | 2 +- .../OpenAPIs/Models/Model200Response.swift | 2 +- .../Classes/OpenAPIs/Models/Name.swift | 2 +- .../Classes/OpenAPIs/Models/NumberOnly.swift | 2 +- .../Classes/OpenAPIs/Models/Order.swift | 2 +- .../OpenAPIs/Models/OuterComposite.swift | 2 +- .../Classes/OpenAPIs/Models/Pet.swift | 2 +- .../OpenAPIs/Models/ReadOnlyFirst.swift | 2 +- .../Classes/OpenAPIs/Models/Return.swift | 2 +- .../OpenAPIs/Models/SpecialModelName.swift | 2 +- .../OpenAPIs/Models/StringBooleanMap.swift | 2 +- .../Classes/OpenAPIs/Models/Tag.swift | 2 +- .../OpenAPIs/Models/TypeHolderDefault.swift | 2 +- .../OpenAPIs/Models/TypeHolderExample.swift | 2 +- .../Classes/OpenAPIs/Models/User.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 62 ++++++------- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 ++-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 4 +- .../OpenAPIs/Infrastructure/Extensions.swift | 87 +++++++++---------- .../OpenAPIs/Infrastructure/Models.swift | 4 +- .../Models/AdditionalPropertiesClass.swift | 2 +- .../Classes/OpenAPIs/Models/Animal.swift | 2 +- .../Classes/OpenAPIs/Models/ApiResponse.swift | 2 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 2 +- .../OpenAPIs/Models/ArrayOfNumberOnly.swift | 2 +- .../Classes/OpenAPIs/Models/ArrayTest.swift | 2 +- .../OpenAPIs/Models/Capitalization.swift | 2 +- .../Classes/OpenAPIs/Models/Cat.swift | 2 +- .../Classes/OpenAPIs/Models/Category.swift | 2 +- .../Classes/OpenAPIs/Models/ClassModel.swift | 2 +- .../Classes/OpenAPIs/Models/Client.swift | 2 +- .../Classes/OpenAPIs/Models/Dog.swift | 2 +- .../Classes/OpenAPIs/Models/EnumArrays.swift | 2 +- .../Classes/OpenAPIs/Models/EnumTest.swift | 2 +- .../Classes/OpenAPIs/Models/File.swift | 2 +- .../OpenAPIs/Models/FileSchemaTestClass.swift | 2 +- .../Classes/OpenAPIs/Models/FormatTest.swift | 2 +- .../OpenAPIs/Models/HasOnlyReadOnly.swift | 2 +- .../Classes/OpenAPIs/Models/List.swift | 2 +- .../Classes/OpenAPIs/Models/MapTest.swift | 2 +- ...opertiesAndAdditionalPropertiesClass.swift | 2 +- .../OpenAPIs/Models/Model200Response.swift | 2 +- .../Classes/OpenAPIs/Models/Name.swift | 2 +- .../Classes/OpenAPIs/Models/NumberOnly.swift | 2 +- .../Classes/OpenAPIs/Models/Order.swift | 2 +- .../OpenAPIs/Models/OuterComposite.swift | 2 +- .../Classes/OpenAPIs/Models/Pet.swift | 2 +- .../OpenAPIs/Models/ReadOnlyFirst.swift | 2 +- .../Classes/OpenAPIs/Models/Return.swift | 2 +- .../OpenAPIs/Models/SpecialModelName.swift | 2 +- .../OpenAPIs/Models/StringBooleanMap.swift | 2 +- .../Classes/OpenAPIs/Models/Tag.swift | 2 +- .../OpenAPIs/Models/TypeHolderDefault.swift | 2 +- .../OpenAPIs/Models/TypeHolderExample.swift | 2 +- .../Classes/OpenAPIs/Models/User.swift | 2 +- .../Classes/OpenAPIs/APIs/FakeAPI.swift | 62 ++++++------- .../Classes/OpenAPIs/APIs/PetAPI.swift | 18 ++-- .../Classes/OpenAPIs/APIs/UserAPI.swift | 4 +- .../OpenAPIs/Infrastructure/Extensions.swift | 87 +++++++++---------- .../OpenAPIs/Infrastructure/Models.swift | 4 +- .../Models/AdditionalPropertiesClass.swift | 2 +- .../Classes/OpenAPIs/Models/Animal.swift | 2 +- .../Classes/OpenAPIs/Models/ApiResponse.swift | 2 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 2 +- .../OpenAPIs/Models/ArrayOfNumberOnly.swift | 2 +- .../Classes/OpenAPIs/Models/ArrayTest.swift | 2 +- .../OpenAPIs/Models/Capitalization.swift | 2 +- .../Classes/OpenAPIs/Models/Cat.swift | 2 +- .../Classes/OpenAPIs/Models/Category.swift | 2 +- .../Classes/OpenAPIs/Models/ClassModel.swift | 2 +- .../Classes/OpenAPIs/Models/Client.swift | 2 +- .../Classes/OpenAPIs/Models/Dog.swift | 2 +- .../Classes/OpenAPIs/Models/EnumArrays.swift | 2 +- .../Classes/OpenAPIs/Models/EnumTest.swift | 2 +- .../Classes/OpenAPIs/Models/File.swift | 2 +- .../OpenAPIs/Models/FileSchemaTestClass.swift | 2 +- .../Classes/OpenAPIs/Models/FormatTest.swift | 2 +- .../OpenAPIs/Models/HasOnlyReadOnly.swift | 2 +- .../Classes/OpenAPIs/Models/List.swift | 2 +- .../Classes/OpenAPIs/Models/MapTest.swift | 2 +- ...opertiesAndAdditionalPropertiesClass.swift | 2 +- .../OpenAPIs/Models/Model200Response.swift | 2 +- .../Classes/OpenAPIs/Models/Name.swift | 2 +- .../Classes/OpenAPIs/Models/NumberOnly.swift | 2 +- .../Classes/OpenAPIs/Models/Order.swift | 2 +- .../OpenAPIs/Models/OuterComposite.swift | 2 +- .../Classes/OpenAPIs/Models/Pet.swift | 2 +- .../OpenAPIs/Models/ReadOnlyFirst.swift | 2 +- .../Classes/OpenAPIs/Models/Return.swift | 2 +- .../OpenAPIs/Models/SpecialModelName.swift | 2 +- .../OpenAPIs/Models/StringBooleanMap.swift | 2 +- .../Classes/OpenAPIs/Models/Tag.swift | 2 +- .../OpenAPIs/Models/TypeHolderDefault.swift | 2 +- .../OpenAPIs/Models/TypeHolderExample.swift | 2 +- .../Classes/OpenAPIs/Models/User.swift | 2 +- .../Sources/PetstoreClient/APIs/FakeAPI.swift | 62 ++++++------- .../Sources/PetstoreClient/APIs/PetAPI.swift | 18 ++-- .../Sources/PetstoreClient/APIs/UserAPI.swift | 4 +- .../Infrastructure/Extensions.swift | 87 +++++++++---------- .../Infrastructure/Models.swift | 4 +- .../Models/AdditionalPropertiesClass.swift | 2 +- .../PetstoreClient/Models/Animal.swift | 2 +- .../PetstoreClient/Models/ApiResponse.swift | 2 +- .../Models/ArrayOfArrayOfNumberOnly.swift | 2 +- .../Models/ArrayOfNumberOnly.swift | 2 +- .../PetstoreClient/Models/ArrayTest.swift | 2 +- .../Models/Capitalization.swift | 2 +- .../Sources/PetstoreClient/Models/Cat.swift | 2 +- .../PetstoreClient/Models/Category.swift | 2 +- .../PetstoreClient/Models/ClassModel.swift | 2 +- .../PetstoreClient/Models/Client.swift | 2 +- .../Sources/PetstoreClient/Models/Dog.swift | 2 +- .../PetstoreClient/Models/EnumArrays.swift | 2 +- .../PetstoreClient/Models/EnumTest.swift | 2 +- .../Sources/PetstoreClient/Models/File.swift | 2 +- .../Models/FileSchemaTestClass.swift | 2 +- .../PetstoreClient/Models/FormatTest.swift | 2 +- .../Models/HasOnlyReadOnly.swift | 2 +- .../Sources/PetstoreClient/Models/List.swift | 2 +- .../PetstoreClient/Models/MapTest.swift | 2 +- ...opertiesAndAdditionalPropertiesClass.swift | 2 +- .../Models/Model200Response.swift | 2 +- .../Sources/PetstoreClient/Models/Name.swift | 2 +- .../PetstoreClient/Models/NumberOnly.swift | 2 +- .../Sources/PetstoreClient/Models/Order.swift | 2 +- .../Models/OuterComposite.swift | 2 +- .../Sources/PetstoreClient/Models/Pet.swift | 2 +- .../PetstoreClient/Models/ReadOnlyFirst.swift | 2 +- .../PetstoreClient/Models/Return.swift | 2 +- .../Models/SpecialModelName.swift | 2 +- .../Models/StringBooleanMap.swift | 2 +- .../Sources/PetstoreClient/Models/Tag.swift | 2 +- .../Models/TypeHolderDefault.swift | 2 +- .../Models/TypeHolderExample.swift | 2 +- .../Sources/PetstoreClient/Models/User.swift | 2 +- .../SwaggerClientTests/DateFormatTests.swift | 8 +- .../OpenAPIs/Infrastructure/Extensions.swift | 87 +++++++++---------- .../OpenAPIs/Infrastructure/Models.swift | 4 +- .../Classes/OpenAPIs/Models/Banana.swift | 2 +- 472 files changed, 1499 insertions(+), 1569 deletions(-) diff --git a/docs/generators/swift6.md b/docs/generators/swift6.md index a49865462eb..1959f300a7f 100644 --- a/docs/generators/swift6.md +++ b/docs/generators/swift6.md @@ -56,7 +56,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useBacktickEscapes|Escape reserved words using backticks (default: false)| |false| |useClasses|Use final classes for models instead of structs (default: false)| |false| |useCustomDateWithoutTime|Uses a custom type to decode and encode dates without time information to support OpenAPIs date format (default: false)| |false| -|useJsonEncodable|Make models conform to JSONEncodable protocol (default: true)| |true| +|useParameterConvertible|Make models conform to ParameterConvertible protocol (default: true)| |true| |useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: true).| |null| |validatable|Make validation rules and validator for model properties (default: true)| |true| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java index 82456526194..9fbddf8aeb2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java @@ -72,7 +72,7 @@ public class Swift6ClientCodegen extends DefaultCodegen implements CodegenConfig public static final String GENERATE_MODEL_ADDITIONAL_PROPERTIES = "generateModelAdditionalProperties"; public static final String HASHABLE_MODELS = "hashableModels"; public static final String IDENTIFIABLE_MODELS = "identifiableModels"; - public static final String USE_JSON_ENCODABLE = "useJsonEncodable"; + public static final String USE_PARAMETER_CONVERTIBLE = "useParameterConvertible"; public static final String MAP_FILE_BINARY_TO_DATA = "mapFileBinaryToData"; public static final String USE_CUSTOM_DATE_WITHOUT_TIME = "useCustomDateWithoutTime"; public static final String VALIDATABLE = "validatable"; @@ -115,7 +115,7 @@ public class Swift6ClientCodegen extends DefaultCodegen implements CodegenConfig @Setter protected boolean identifiableModels = true; @Setter - protected boolean useJsonEncodable = true; + protected boolean useParameterConvertible = true; @Getter @Setter protected boolean mapFileBinaryToData = false; @@ -335,8 +335,8 @@ public class Swift6ClientCodegen extends DefaultCodegen implements CodegenConfig "Make models conform to Identifiable when an id is present (default: true)") .defaultValue(Boolean.TRUE.toString())); - cliOptions.add(new CliOption(USE_JSON_ENCODABLE, - "Make models conform to JSONEncodable protocol (default: true)") + cliOptions.add(new CliOption(USE_PARAMETER_CONVERTIBLE, + "Make models conform to ParameterConvertible protocol (default: true)") .defaultValue(Boolean.TRUE.toString())); cliOptions.add(new CliOption(MAP_FILE_BINARY_TO_DATA, @@ -560,10 +560,10 @@ public class Swift6ClientCodegen extends DefaultCodegen implements CodegenConfig } additionalProperties.put(IDENTIFIABLE_MODELS, identifiableModels); - if (additionalProperties.containsKey(USE_JSON_ENCODABLE)) { - setUseJsonEncodable(convertPropertyToBooleanAndWriteBack(USE_JSON_ENCODABLE)); + if (additionalProperties.containsKey(USE_PARAMETER_CONVERTIBLE)) { + setUseParameterConvertible(convertPropertyToBooleanAndWriteBack(USE_PARAMETER_CONVERTIBLE)); } - additionalProperties.put(USE_JSON_ENCODABLE, useJsonEncodable); + additionalProperties.put(USE_PARAMETER_CONVERTIBLE, useParameterConvertible); if (additionalProperties.containsKey(MAP_FILE_BINARY_TO_DATA)) { setMapFileBinaryToData(convertPropertyToBooleanAndWriteBack(MAP_FILE_BINARY_TO_DATA)); diff --git a/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache b/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache index 78526b60ee8..0f661a170b3 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Extensions.mustache @@ -11,78 +11,73 @@ import FoundationNetworking @preconcurrency import PromiseKit{{/usePromiseKit}}{{#useVapor}} import Vapor{{/useVapor}}{{^useVapor}} -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -90,24 +85,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } }{{/useVapor}}{{#generateModelAdditionalProperties}} diff --git a/modules/openapi-generator/src/main/resources/swift6/Models.mustache b/modules/openapi-generator/src/main/resources/swift6/Models.mustache index 14b236ee221..c8a80a636fb 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Models.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Models.mustache @@ -10,8 +10,8 @@ import FoundationNetworking #endif{{#useAlamofire}} import Alamofire{{/useAlamofire}} -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/modules/openapi-generator/src/main/resources/swift6/OpenAPIDateWithoutTime.mustache b/modules/openapi-generator/src/main/resources/swift6/OpenAPIDateWithoutTime.mustache index aee5bf79010..2c98b8ed19c 100644 --- a/modules/openapi-generator/src/main/resources/swift6/OpenAPIDateWithoutTime.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/OpenAPIDateWithoutTime.mustache @@ -76,8 +76,8 @@ import Foundation } } -extension OpenAPIDateWithoutTime: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension OpenAPIDateWithoutTime: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate()) } } diff --git a/modules/openapi-generator/src/main/resources/swift6/_param.mustache b/modules/openapi-generator/src/main/resources/swift6/_param.mustache index bdadb82c623..24e2f36916f 100644 --- a/modules/openapi-generator/src/main/resources/swift6/_param.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/_param.mustache @@ -1 +1 @@ -"{{baseName}}": {{#isQueryParam}}(wrappedValue: {{/isQueryParam}}{{paramName}}{{^required}}?{{/required}}.encodeToQueryString(codableHelper: apiConfiguration.codableHelper){{#isQueryParam}}, isExplode: {{isExplode}}){{/isQueryParam}} \ No newline at end of file +"{{baseName}}": {{#isQueryParam}}(wrappedValue: {{/isQueryParam}}{{paramName}}{{^required}}?{{/required}}.asParameter(codableHelper: apiConfiguration.codableHelper){{#isQueryParam}}, isExplode: {{isExplode}}){{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/swift6/modelEnum.mustache b/modules/openapi-generator/src/main/resources/swift6/modelEnum.mustache index f50a704459b..1c844b6fa4b 100644 --- a/modules/openapi-generator/src/main/resources/swift6/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/modelEnum.mustache @@ -1,4 +1,4 @@ -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{dataType}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}{{#useJsonEncodable}}, QueryStringEncodable{{/useJsonEncodable}}{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{/enumUnknownDefaultCase}} { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{dataType}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}{{#useParameterConvertible}}, ParameterConvertible{{/useParameterConvertible}}{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{/enumUnknownDefaultCase}} { {{#allowableValues}} {{#enumVars}} case {{{name}}} = {{{value}}} diff --git a/modules/openapi-generator/src/main/resources/swift6/modelInlineEnumDeclaration.mustache b/modules/openapi-generator/src/main/resources/swift6/modelInlineEnumDeclaration.mustache index eb6999268cc..61ef017ce9a 100644 --- a/modules/openapi-generator/src/main/resources/swift6/modelInlineEnumDeclaration.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/modelInlineEnumDeclaration.mustache @@ -1,4 +1,4 @@ - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isContainer}}{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}{{#useJsonEncodable}}, QueryStringEncodable{{/useJsonEncodable}}{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/isContainer}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{#isContainer}}, CaseIterableDefaultsLast{{/isContainer}}{{/enumUnknownDefaultCase}} { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{enumName}}: {{^isContainer}}{{dataType}}{{/isContainer}}{{#isContainer}}String{{/isContainer}}, Sendable, {{#useVapor}}Content, Hashable{{/useVapor}}{{^useVapor}}Codable{{^isContainer}}{{^isString}}{{^isInteger}}{{^isFloat}}{{^isDouble}}{{#useParameterConvertible}}, ParameterConvertible{{/useParameterConvertible}}{{/isDouble}}{{/isFloat}}{{/isInteger}}{{/isString}}{{/isContainer}}{{/useVapor}}, CaseIterable{{#enumUnknownDefaultCase}}{{#isInteger}}, CaseIterableDefaultsLast{{/isInteger}}{{#isFloat}}, CaseIterableDefaultsLast{{/isFloat}}{{#isDouble}}, CaseIterableDefaultsLast{{/isDouble}}{{#isString}}, CaseIterableDefaultsLast{{/isString}}{{#isContainer}}, CaseIterableDefaultsLast{{/isContainer}}{{/enumUnknownDefaultCase}} { {{#allowableValues}} {{#enumVars}} case {{{name}}} = {{{value}}} diff --git a/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache b/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache index 52da0f11189..85e5a737230 100644 --- a/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache @@ -1,5 +1,5 @@ -{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{{classname}}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}@unchecked Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{#useJsonEncodable}}, QueryStringEncodable{{/useJsonEncodable}}{{/useVapor}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} { -{{/objcCompatible}}{{#objcCompatible}}@objcMembers {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable{{#useJsonEncodable}}, QueryStringEncodable{{/useJsonEncodable}} { +{{^objcCompatible}}{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} {{#useClasses}}final class{{/useClasses}}{{^useClasses}}struct{{/useClasses}} {{{classname}}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}@unchecked Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{#useParameterConvertible}}, ParameterConvertible{{/useParameterConvertible}}{{/useVapor}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}} { +{{/objcCompatible}}{{#objcCompatible}}@objcMembers {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} class {{classname}}: NSObject, Codable{{#useParameterConvertible}}, ParameterConvertible{{/useParameterConvertible}} { {{/objcCompatible}} {{#allVars}} diff --git a/modules/openapi-generator/src/main/resources/swift6/modelOneOf.mustache b/modules/openapi-generator/src/main/resources/swift6/modelOneOf.mustache index 8a3b7f158f5..06205f18249 100644 --- a/modules/openapi-generator/src/main/resources/swift6/modelOneOf.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/modelOneOf.mustache @@ -1,4 +1,4 @@ -{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{#useJsonEncodable}}, QueryStringEncodable{{/useJsonEncodable}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}}{{/useVapor}} { +{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum {{classname}}: {{^useClasses}}Sendable, {{/useClasses}}{{#useClasses}}{{#readonlyProperties}}Sendable, {{/readonlyProperties}}{{/useClasses}}{{#useVapor}}Content{{/useVapor}}{{^useVapor}}Codable{{#useParameterConvertible}}, ParameterConvertible{{/useParameterConvertible}}{{#vendorExtensions.x-swift-hashable}}, Hashable{{/vendorExtensions.x-swift-hashable}}{{/useVapor}} { {{#oneOf}} case type{{#transformArrayType}}{{.}}{{/transformArrayType}}({{.}}) {{/oneOf}} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift6ClientCodegenOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift6ClientCodegenOptionsProvider.java index cf951b0113e..c419d242c2a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift6ClientCodegenOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/Swift6ClientCodegenOptionsProvider.java @@ -48,7 +48,7 @@ public class Swift6ClientCodegenOptionsProvider implements OptionsProvider { public static final String GENERATE_MODEL_ADDITIONAL_PROPERTIES_VALUE = "true"; public static final String HASHABLE_MODELS_VALUE = "true"; public static final String IDENTIFIABLE_MODELS_VALUE = "true"; - public static final String USE_JSON_ENCODABLE_VALUE = "true"; + public static final String USE_PARAMETER_CONVERTIBLE_VALUE = "true"; public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; public static final String LIBRARY_VALUE = "alamofire"; @@ -99,7 +99,7 @@ public class Swift6ClientCodegenOptionsProvider implements OptionsProvider { GENERATE_MODEL_ADDITIONAL_PROPERTIES_VALUE) .put(Swift6ClientCodegen.HASHABLE_MODELS, HASHABLE_MODELS_VALUE) .put(Swift6ClientCodegen.IDENTIFIABLE_MODELS, IDENTIFIABLE_MODELS_VALUE) - .put(Swift6ClientCodegen.USE_JSON_ENCODABLE, USE_JSON_ENCODABLE_VALUE) + .put(Swift6ClientCodegen.USE_PARAMETER_CONVERTIBLE, USE_PARAMETER_CONVERTIBLE_VALUE) .put(Swift6ClientCodegen.MAP_FILE_BINARY_TO_DATA, "false") .put(Swift6ClientCodegen.USE_CUSTOM_DATE_WITHOUT_TIME, "false") .put(Swift6ClientCodegen.VALIDATABLE, "true") diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift index 4970cec8d0c..ed312f46a12 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -257,7 +257,7 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "query": (wrappedValue: query.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -376,20 +376,20 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "integer": integer?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.asParameter(codableHelper: apiConfiguration.codableHelper), + "number": number.asParameter(codableHelper: apiConfiguration.codableHelper), + "float": float?.asParameter(codableHelper: apiConfiguration.codableHelper), + "double": double.asParameter(codableHelper: apiConfiguration.codableHelper), + "string": string?.asParameter(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.asParameter(codableHelper: apiConfiguration.codableHelper), + "byte": byte.asParameter(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.asParameter(codableHelper: apiConfiguration.codableHelper), + "date": date?.asParameter(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.asParameter(codableHelper: apiConfiguration.codableHelper), + "password": password?.asParameter(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -520,8 +520,8 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_form_string_array": enumFormStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -529,16 +529,16 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -592,15 +592,15 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "required_boolean_group": requiredBooleanGroup.asParameter(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -686,8 +686,8 @@ open class FakeAPI { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "param": param.asParameter(codableHelper: apiConfiguration.codableHelper), + "param2": param2.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index 32397a81b62..9db9ecc94dd 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -101,7 +101,7 @@ open class PetAPI { let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "api_key": apiKey?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -157,7 +157,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "status": (wrappedValue: status.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -210,7 +210,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -362,8 +362,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "name": name?.asParameter(codableHelper: apiConfiguration.codableHelper), + "status": status?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -422,8 +422,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "file": file?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -482,8 +482,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/UserAPI.swift index d9e47ad7fb4..9ea4cc0237f 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/UserAPI.swift @@ -273,8 +273,8 @@ open class UserAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "username": (wrappedValue: username.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift index 1120f928d7e..fc0b544a05c 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift @@ -9,78 +9,73 @@ import Foundation import FoundationNetworking #endif -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -88,24 +83,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift index 9414c8dfaeb..788f242d4be 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Models.swift @@ -10,8 +10,8 @@ import FoundationNetworking #endif import Alamofire -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/OpenAPIDateWithoutTime.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/OpenAPIDateWithoutTime.swift index 8b0af6a53ec..d3b58c87f10 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/OpenAPIDateWithoutTime.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/OpenAPIDateWithoutTime.swift @@ -76,8 +76,8 @@ public struct OpenAPIDateWithoutTime: Sendable, Codable, Hashable, Equatable { } } -extension OpenAPIDateWithoutTime: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension OpenAPIDateWithoutTime: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return OpenISO8601DateFormatter.withoutTime.string(from: self.normalizedWrappedDate()) } } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift index 9bd081f7d00..4bf7be0f249 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var mapString: [String: String]? public var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Animal.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Animal.swift index b20104e0503..e2e0e01546a 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Animal.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -public struct Animal: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Animal: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ApiResponse.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ApiResponse.swift index cea25ea52e2..3e6a6f952ee 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -public struct ApiResponse: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ApiResponse: Sendable, Codable, ParameterConvertible, Hashable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift index 679279d61cb..5e7b7650f85 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift index d71bd4e40b7..abe8c9ea856 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayTest.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayTest.swift index 839795229bb..1f24ed5e731 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayTest: Sendable, Codable, ParameterConvertible, Hashable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Capitalization.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Capitalization.swift index 56100523e84..090b3a75515 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -public struct Capitalization: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Capitalization: Sendable, Codable, ParameterConvertible, Hashable { public var smallCamel: String? public var capitalCamel: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Cat.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Cat.swift index cceeddd1bf9..36a552d208d 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Cat.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -public struct Cat: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Cat: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Category.swift index c04a9e673cf..66785088d3d 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -public struct Category: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Category: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? = "default-name" diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ClassModel.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ClassModel.swift index 4c1e9c1a990..4e9a2272ef7 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ClassModel: Sendable, Codable, ParameterConvertible, Hashable { public var _class: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Client.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Client.swift index b49ded4cc5c..71fe46ac1bd 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Client.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -public struct Client: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Client: Sendable, Codable, ParameterConvertible, Hashable { public var client: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Dog.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Dog.swift index 99231ca03f7..134cc4ad51f 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Dog.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -public struct Dog: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Dog: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/EnumArrays.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/EnumArrays.swift index 09bbcb9f280..4f7b547df68 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumArrays: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumArrays: Sendable, Codable, ParameterConvertible, Hashable { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/EnumTest.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/EnumTest.swift index d280112e88b..9472c599e8b 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumTest: Sendable, Codable, ParameterConvertible, Hashable { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/File.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/File.swift index c35e1b2d53a..2b1d20efb35 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/File.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Sendable, Codable, QueryStringEncodable, Hashable { +public struct File: Sendable, Codable, ParameterConvertible, Hashable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift index 6ca430a91ba..528709b3c7e 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct FileSchemaTestClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FileSchemaTestClass: Sendable, Codable, ParameterConvertible, Hashable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FormatTest.swift index c39b80d4145..b1d4962c090 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct FormatTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FormatTest: Sendable, Codable, ParameterConvertible, Hashable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift index e5db6255169..850da288bf0 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct HasOnlyReadOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct HasOnlyReadOnly: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/List.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/List.swift index 75c553df8fc..415ef215291 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/List.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -public struct List: Sendable, Codable, QueryStringEncodable, Hashable { +public struct List: Sendable, Codable, ParameterConvertible, Hashable { public var _123list: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/MapTest.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/MapTest.swift index 8cc06717f31..b373fbe8292 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/MapTest.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct MapTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MapTest: Sendable, Codable, ParameterConvertible, Hashable { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 2c7bd6d9c7c..0f667b7668a 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var uuid: UUID? public var dateTime: Date? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Model200Response.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Model200Response.swift index dfe19e3fdd9..0eadfe3042a 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Model200Response: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int? public var _class: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Name.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Name.swift index d0a98e0980b..82bba99bf66 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Name.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Name: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int public var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/NumberOnly.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/NumberOnly.swift index 47d2e318bb5..05bd45180b0 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct NumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct NumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var justNumber: Double? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Order.swift index 6a9ecc5540c..9f2556d6c0e 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -public struct Order: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Order: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/OuterComposite.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/OuterComposite.swift index 0a4d002a2dd..34a4ed7b12e 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -public struct OuterComposite: Sendable, Codable, QueryStringEncodable, Hashable { +public struct OuterComposite: Sendable, Codable, ParameterConvertible, Hashable { public var myNumber: Double? public var myString: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Pet.swift index 302a3052c6e..cd28268b345 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -public struct Pet: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Pet: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift index 5a06da436f6..5d6c8a6c9cf 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -public struct ReadOnlyFirst: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ReadOnlyFirst: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Return.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Return.swift index 53ca3f5ad7f..c2a1b7f73c8 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Return.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Return: Sendable, Codable, ParameterConvertible, Hashable { public var _return: Int? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift index 40ad8ff0a05..000b39a8a13 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -public struct SpecialModelName: Sendable, Codable, QueryStringEncodable, Hashable { +public struct SpecialModelName: Sendable, Codable, ParameterConvertible, Hashable { public var specialPropertyName: Int64? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift index 3bbade9feb7..0ec7c486208 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift @@ -7,7 +7,7 @@ import Foundation -public struct StringBooleanMap: Sendable, Codable, QueryStringEncodable, Hashable { +public struct StringBooleanMap: Sendable, Codable, ParameterConvertible, Hashable { public enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Tag.swift index 7c19767a11f..df5505fc4bc 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -public struct Tag: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Tag: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift index eaaab729500..459e3c03da4 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderDefault: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderDefault: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String = "what" public var numberItem: Double diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift index bac80c4fcd2..628ca869217 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderExample: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderExample: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String public var numberItem: Double diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/User.swift index e41975d4d66..33fa97c11eb 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -public struct User: Sendable, Codable, QueryStringEncodable, Hashable { +public struct User: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var username: String? diff --git a/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift b/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift index 50b21d3b717..d3cc7edaddc 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift @@ -27,7 +27,7 @@ class DateFormatTests: XCTestCase { super.tearDown() } - func testencodeToQueryStringAlwaysResultsInUTCEncodedDate() { + func testAsParameterAlwaysResultsInUTCEncodedDate() { var dateComponents = DateComponents() dateComponents.calendar = Calendar(identifier: .gregorian) dateComponents.year = 2018 @@ -47,7 +47,7 @@ class DateFormatTests: XCTestCase { return } - var encodedDate = utcDate.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String + var encodedDate = utcDate.asParameter(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a positive timzone offset from UTC @@ -59,7 +59,7 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate1.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String + encodedDate = nonUTCDate1.asParameter(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a negative timzone offset from UTC @@ -71,7 +71,7 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate2.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String + encodedDate = nonUTCDate2.asParameter(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift index 178aeff9671..d4ba0895159 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -847,7 +847,7 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "query": (wrappedValue: query.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -1233,20 +1233,20 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "integer": integer?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.asParameter(codableHelper: apiConfiguration.codableHelper), + "number": number.asParameter(codableHelper: apiConfiguration.codableHelper), + "float": float?.asParameter(codableHelper: apiConfiguration.codableHelper), + "double": double.asParameter(codableHelper: apiConfiguration.codableHelper), + "string": string?.asParameter(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.asParameter(codableHelper: apiConfiguration.codableHelper), + "byte": byte.asParameter(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.asParameter(codableHelper: apiConfiguration.codableHelper), + "date": date?.asParameter(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.asParameter(codableHelper: apiConfiguration.codableHelper), + "password": password?.asParameter(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -1513,8 +1513,8 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_form_string_array": enumFormStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -1522,16 +1522,16 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -1711,15 +1711,15 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "required_boolean_group": requiredBooleanGroup.asParameter(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -2012,8 +2012,8 @@ open class FakeAPI { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "param": param.asParameter(codableHelper: apiConfiguration.codableHelper), + "param2": param2.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift index 73a0ac9919a..fb4c4debdc9 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift @@ -317,7 +317,7 @@ open class PetAPI { let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "api_key": apiKey?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -474,7 +474,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "status": (wrappedValue: status.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -633,7 +633,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -1098,8 +1098,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "name": name?.asParameter(codableHelper: apiConfiguration.codableHelper), + "status": status?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -1269,8 +1269,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "file": file?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -1440,8 +1440,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/UserAPI.swift index ab4c065bcfb..eec7a463048 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/UserAPI.swift @@ -893,8 +893,8 @@ open class UserAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "username": (wrappedValue: username.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Extensions.swift index 74e95feeeed..6b6bf2d2b5a 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Extensions.swift @@ -10,78 +10,73 @@ import FoundationNetworking #endif @preconcurrency import PromiseKit -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -89,24 +84,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift index 9414c8dfaeb..788f242d4be 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Models.swift @@ -10,8 +10,8 @@ import FoundationNetworking #endif import Alamofire -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift index 9bd081f7d00..4bf7be0f249 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var mapString: [String: String]? public var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Animal.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Animal.swift index b20104e0503..e2e0e01546a 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Animal.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -public struct Animal: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Animal: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ApiResponse.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ApiResponse.swift index cea25ea52e2..3e6a6f952ee 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -public struct ApiResponse: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ApiResponse: Sendable, Codable, ParameterConvertible, Hashable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift index 679279d61cb..5e7b7650f85 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift index d71bd4e40b7..abe8c9ea856 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayTest.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayTest.swift index 839795229bb..1f24ed5e731 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayTest: Sendable, Codable, ParameterConvertible, Hashable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Capitalization.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Capitalization.swift index 56100523e84..090b3a75515 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -public struct Capitalization: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Capitalization: Sendable, Codable, ParameterConvertible, Hashable { public var smallCamel: String? public var capitalCamel: String? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Cat.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Cat.swift index cceeddd1bf9..36a552d208d 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Cat.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -public struct Cat: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Cat: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Category.swift index c04a9e673cf..66785088d3d 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -public struct Category: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Category: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? = "default-name" diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ClassModel.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ClassModel.swift index 4c1e9c1a990..4e9a2272ef7 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ClassModel: Sendable, Codable, ParameterConvertible, Hashable { public var _class: String? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Client.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Client.swift index b49ded4cc5c..71fe46ac1bd 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Client.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -public struct Client: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Client: Sendable, Codable, ParameterConvertible, Hashable { public var client: String? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Dog.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Dog.swift index 99231ca03f7..134cc4ad51f 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Dog.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -public struct Dog: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Dog: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/EnumArrays.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/EnumArrays.swift index 09bbcb9f280..4f7b547df68 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumArrays: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumArrays: Sendable, Codable, ParameterConvertible, Hashable { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/EnumTest.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/EnumTest.swift index d280112e88b..9472c599e8b 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumTest: Sendable, Codable, ParameterConvertible, Hashable { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/File.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/File.swift index c35e1b2d53a..2b1d20efb35 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/File.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Sendable, Codable, QueryStringEncodable, Hashable { +public struct File: Sendable, Codable, ParameterConvertible, Hashable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FileSchemaTestClass.swift index 6ca430a91ba..528709b3c7e 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct FileSchemaTestClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FileSchemaTestClass: Sendable, Codable, ParameterConvertible, Hashable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift index 010eddcabde..6f3611ffba4 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct FormatTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FormatTest: Sendable, Codable, ParameterConvertible, Hashable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift index e5db6255169..850da288bf0 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct HasOnlyReadOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct HasOnlyReadOnly: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/List.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/List.swift index 75c553df8fc..415ef215291 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/List.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -public struct List: Sendable, Codable, QueryStringEncodable, Hashable { +public struct List: Sendable, Codable, ParameterConvertible, Hashable { public var _123list: String? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/MapTest.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/MapTest.swift index b52d28b69a1..f0f065b798d 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/MapTest.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct MapTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MapTest: Sendable, Codable, ParameterConvertible, Hashable { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 2c7bd6d9c7c..0f667b7668a 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var uuid: UUID? public var dateTime: Date? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Model200Response.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Model200Response.swift index dfe19e3fdd9..0eadfe3042a 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Model200Response: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int? public var _class: String? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Name.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Name.swift index d0a98e0980b..82bba99bf66 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Name.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Name: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int public var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/NumberOnly.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/NumberOnly.swift index 47d2e318bb5..05bd45180b0 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct NumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct NumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var justNumber: Double? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Order.swift index 6a9ecc5540c..9f2556d6c0e 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -public struct Order: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Order: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/OuterComposite.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/OuterComposite.swift index 0a4d002a2dd..34a4ed7b12e 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -public struct OuterComposite: Sendable, Codable, QueryStringEncodable, Hashable { +public struct OuterComposite: Sendable, Codable, ParameterConvertible, Hashable { public var myNumber: Double? public var myString: String? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Pet.swift index 302a3052c6e..cd28268b345 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -public struct Pet: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Pet: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ReadOnlyFirst.swift index 5a06da436f6..5d6c8a6c9cf 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -public struct ReadOnlyFirst: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ReadOnlyFirst: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Return.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Return.swift index 53ca3f5ad7f..c2a1b7f73c8 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Return.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Return: Sendable, Codable, ParameterConvertible, Hashable { public var _return: Int? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/SpecialModelName.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/SpecialModelName.swift index 40ad8ff0a05..000b39a8a13 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -public struct SpecialModelName: Sendable, Codable, QueryStringEncodable, Hashable { +public struct SpecialModelName: Sendable, Codable, ParameterConvertible, Hashable { public var specialPropertyName: Int64? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Tag.swift index 7c19767a11f..df5505fc4bc 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -public struct Tag: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Tag: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/TypeHolderDefault.swift index eaaab729500..459e3c03da4 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderDefault: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderDefault: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String = "what" public var numberItem: Double diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/TypeHolderExample.swift index bac80c4fcd2..628ca869217 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderExample: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderExample: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String public var numberItem: Double diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/User.swift index e41975d4d66..33fa97c11eb 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -public struct User: Sendable, Codable, QueryStringEncodable, Hashable { +public struct User: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var username: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift index b388f5c5571..8c2a987f7c7 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -215,7 +215,7 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "query": (wrappedValue: query.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -320,20 +320,20 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "integer": integer?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.asParameter(codableHelper: apiConfiguration.codableHelper), + "number": number.asParameter(codableHelper: apiConfiguration.codableHelper), + "float": float?.asParameter(codableHelper: apiConfiguration.codableHelper), + "double": double.asParameter(codableHelper: apiConfiguration.codableHelper), + "string": string?.asParameter(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.asParameter(codableHelper: apiConfiguration.codableHelper), + "byte": byte.asParameter(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.asParameter(codableHelper: apiConfiguration.codableHelper), + "date": date?.asParameter(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.asParameter(codableHelper: apiConfiguration.codableHelper), + "password": password?.asParameter(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -457,8 +457,8 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_form_string_array": enumFormStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -466,16 +466,16 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -522,15 +522,15 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "required_boolean_group": requiredBooleanGroup.asParameter(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -602,8 +602,8 @@ open class FakeAPI { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "param": param.asParameter(codableHelper: apiConfiguration.codableHelper), + "param2": param2.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index d680aa5e425..e7e2b597031 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -87,7 +87,7 @@ open class PetAPI { let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "api_key": apiKey?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -136,7 +136,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "status": (wrappedValue: status.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -182,7 +182,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -313,8 +313,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "name": name?.asParameter(codableHelper: apiConfiguration.codableHelper), + "status": status?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -366,8 +366,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "file": file?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -419,8 +419,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/UserAPI.swift index 83974395c2c..bb05d9be0a5 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/UserAPI.swift @@ -231,8 +231,8 @@ open class UserAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "username": (wrappedValue: username.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift index 1120f928d7e..fc0b544a05c 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift @@ -9,78 +9,73 @@ import Foundation import FoundationNetworking #endif -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -88,24 +83,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift index 78a06110af5..6e7a6337deb 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Models.swift @@ -9,8 +9,8 @@ import Foundation import FoundationNetworking #endif -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift index 9bd081f7d00..4bf7be0f249 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var mapString: [String: String]? public var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Animal.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Animal.swift index b20104e0503..e2e0e01546a 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Animal.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -public struct Animal: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Animal: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ApiResponse.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ApiResponse.swift index cea25ea52e2..3e6a6f952ee 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -public struct ApiResponse: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ApiResponse: Sendable, Codable, ParameterConvertible, Hashable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift index 679279d61cb..5e7b7650f85 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift index d71bd4e40b7..abe8c9ea856 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayTest.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayTest.swift index 839795229bb..1f24ed5e731 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayTest: Sendable, Codable, ParameterConvertible, Hashable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Capitalization.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Capitalization.swift index 56100523e84..090b3a75515 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -public struct Capitalization: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Capitalization: Sendable, Codable, ParameterConvertible, Hashable { public var smallCamel: String? public var capitalCamel: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Cat.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Cat.swift index cceeddd1bf9..36a552d208d 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Cat.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -public struct Cat: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Cat: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Category.swift index c04a9e673cf..66785088d3d 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -public struct Category: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Category: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? = "default-name" diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ClassModel.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ClassModel.swift index 4c1e9c1a990..4e9a2272ef7 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ClassModel: Sendable, Codable, ParameterConvertible, Hashable { public var _class: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Client.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Client.swift index b49ded4cc5c..71fe46ac1bd 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Client.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -public struct Client: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Client: Sendable, Codable, ParameterConvertible, Hashable { public var client: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Dog.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Dog.swift index 99231ca03f7..134cc4ad51f 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Dog.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -public struct Dog: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Dog: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/EnumArrays.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/EnumArrays.swift index 09bbcb9f280..4f7b547df68 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumArrays: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumArrays: Sendable, Codable, ParameterConvertible, Hashable { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/EnumTest.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/EnumTest.swift index d280112e88b..9472c599e8b 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumTest: Sendable, Codable, ParameterConvertible, Hashable { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/File.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/File.swift index c35e1b2d53a..2b1d20efb35 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/File.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Sendable, Codable, QueryStringEncodable, Hashable { +public struct File: Sendable, Codable, ParameterConvertible, Hashable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift index 6ca430a91ba..528709b3c7e 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct FileSchemaTestClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FileSchemaTestClass: Sendable, Codable, ParameterConvertible, Hashable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FormatTest.swift index 427b85e7fd9..695d9a44358 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct FormatTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FormatTest: Sendable, Codable, ParameterConvertible, Hashable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift index e5db6255169..850da288bf0 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct HasOnlyReadOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct HasOnlyReadOnly: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/List.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/List.swift index 75c553df8fc..415ef215291 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/List.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -public struct List: Sendable, Codable, QueryStringEncodable, Hashable { +public struct List: Sendable, Codable, ParameterConvertible, Hashable { public var _123list: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/MapTest.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/MapTest.swift index 8cc06717f31..b373fbe8292 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/MapTest.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct MapTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MapTest: Sendable, Codable, ParameterConvertible, Hashable { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 2c7bd6d9c7c..0f667b7668a 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var uuid: UUID? public var dateTime: Date? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Model200Response.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Model200Response.swift index dfe19e3fdd9..0eadfe3042a 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Model200Response: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int? public var _class: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Name.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Name.swift index d0a98e0980b..82bba99bf66 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Name.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Name: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int public var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/NumberOnly.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/NumberOnly.swift index 47d2e318bb5..05bd45180b0 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct NumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct NumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var justNumber: Double? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Order.swift index 6a9ecc5540c..9f2556d6c0e 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -public struct Order: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Order: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/OuterComposite.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/OuterComposite.swift index 0a4d002a2dd..34a4ed7b12e 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -public struct OuterComposite: Sendable, Codable, QueryStringEncodable, Hashable { +public struct OuterComposite: Sendable, Codable, ParameterConvertible, Hashable { public var myNumber: Double? public var myString: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Pet.swift index 302a3052c6e..cd28268b345 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -public struct Pet: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Pet: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift index 5a06da436f6..5d6c8a6c9cf 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -public struct ReadOnlyFirst: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ReadOnlyFirst: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Return.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Return.swift index 53ca3f5ad7f..c2a1b7f73c8 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Return.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Return: Sendable, Codable, ParameterConvertible, Hashable { public var _return: Int? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift index 40ad8ff0a05..000b39a8a13 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -public struct SpecialModelName: Sendable, Codable, QueryStringEncodable, Hashable { +public struct SpecialModelName: Sendable, Codable, ParameterConvertible, Hashable { public var specialPropertyName: Int64? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift index 3bbade9feb7..0ec7c486208 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift @@ -7,7 +7,7 @@ import Foundation -public struct StringBooleanMap: Sendable, Codable, QueryStringEncodable, Hashable { +public struct StringBooleanMap: Sendable, Codable, ParameterConvertible, Hashable { public enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Tag.swift index 7c19767a11f..df5505fc4bc 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -public struct Tag: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Tag: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift index eaaab729500..459e3c03da4 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderDefault: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderDefault: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String = "what" public var numberItem: Double diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift index bac80c4fcd2..628ca869217 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderExample: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderExample: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String public var numberItem: Double diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/User.swift index e41975d4d66..33fa97c11eb 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -public struct User: Sendable, Codable, QueryStringEncodable, Hashable { +public struct User: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var username: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 66c40c7cfa1..554d10d64d9 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -338,7 +338,7 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "query": (wrappedValue: query.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -483,20 +483,20 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "integer": integer?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.asParameter(codableHelper: apiConfiguration.codableHelper), + "number": number.asParameter(codableHelper: apiConfiguration.codableHelper), + "float": float?.asParameter(codableHelper: apiConfiguration.codableHelper), + "double": double.asParameter(codableHelper: apiConfiguration.codableHelper), + "string": string?.asParameter(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.asParameter(codableHelper: apiConfiguration.codableHelper), + "byte": byte.asParameter(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.asParameter(codableHelper: apiConfiguration.codableHelper), + "date": date?.asParameter(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.asParameter(codableHelper: apiConfiguration.codableHelper), + "password": password?.asParameter(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -640,8 +640,8 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_form_string_array": enumFormStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -649,16 +649,16 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -725,15 +725,15 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "required_boolean_group": requiredBooleanGroup.asParameter(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -845,8 +845,8 @@ open class FakeAPI { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "param": param.asParameter(codableHelper: apiConfiguration.codableHelper), + "param2": param2.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 1e2128072dd..eed0d1d858b 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -130,7 +130,7 @@ open class PetAPI { let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "api_key": apiKey?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -199,7 +199,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "status": (wrappedValue: status.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -265,7 +265,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -456,8 +456,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "name": name?.asParameter(codableHelper: apiConfiguration.codableHelper), + "status": status?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -529,8 +529,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "file": file?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -602,8 +602,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 79b157a9842..a78a864eb0c 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -354,8 +354,8 @@ open class UserAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "username": (wrappedValue: username.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift index 1120f928d7e..fc0b544a05c 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift @@ -9,78 +9,73 @@ import Foundation import FoundationNetworking #endif -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -88,24 +83,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 78a06110af5..6e7a6337deb 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -9,8 +9,8 @@ import Foundation import FoundationNetworking #endif -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 9bd081f7d00..4bf7be0f249 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var mapString: [String: String]? public var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index b20104e0503..e2e0e01546a 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -public struct Animal: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Animal: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index cea25ea52e2..3e6a6f952ee 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -public struct ApiResponse: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ApiResponse: Sendable, Codable, ParameterConvertible, Hashable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 679279d61cb..5e7b7650f85 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index d71bd4e40b7..abe8c9ea856 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 839795229bb..1f24ed5e731 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayTest: Sendable, Codable, ParameterConvertible, Hashable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index 56100523e84..090b3a75515 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -public struct Capitalization: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Capitalization: Sendable, Codable, ParameterConvertible, Hashable { public var smallCamel: String? public var capitalCamel: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index cceeddd1bf9..36a552d208d 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -public struct Cat: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Cat: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index c04a9e673cf..66785088d3d 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -public struct Category: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Category: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? = "default-name" diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index 4c1e9c1a990..4e9a2272ef7 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ClassModel: Sendable, Codable, ParameterConvertible, Hashable { public var _class: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index b49ded4cc5c..71fe46ac1bd 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -public struct Client: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Client: Sendable, Codable, ParameterConvertible, Hashable { public var client: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 99231ca03f7..134cc4ad51f 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -public struct Dog: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Dog: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index 09bbcb9f280..4f7b547df68 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumArrays: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumArrays: Sendable, Codable, ParameterConvertible, Hashable { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index d280112e88b..9472c599e8b 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumTest: Sendable, Codable, ParameterConvertible, Hashable { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift index c35e1b2d53a..2b1d20efb35 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Sendable, Codable, QueryStringEncodable, Hashable { +public struct File: Sendable, Codable, ParameterConvertible, Hashable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 6ca430a91ba..528709b3c7e 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct FileSchemaTestClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FileSchemaTestClass: Sendable, Codable, ParameterConvertible, Hashable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 427b85e7fd9..695d9a44358 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct FormatTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FormatTest: Sendable, Codable, ParameterConvertible, Hashable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index e5db6255169..850da288bf0 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct HasOnlyReadOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct HasOnlyReadOnly: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 75c553df8fc..415ef215291 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -public struct List: Sendable, Codable, QueryStringEncodable, Hashable { +public struct List: Sendable, Codable, ParameterConvertible, Hashable { public var _123list: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index 8cc06717f31..b373fbe8292 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct MapTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MapTest: Sendable, Codable, ParameterConvertible, Hashable { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 2c7bd6d9c7c..0f667b7668a 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var uuid: UUID? public var dateTime: Date? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index dfe19e3fdd9..0eadfe3042a 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Model200Response: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int? public var _class: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index d0a98e0980b..82bba99bf66 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Name: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int public var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 47d2e318bb5..05bd45180b0 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct NumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct NumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var justNumber: Double? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 6a9ecc5540c..9f2556d6c0e 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -public struct Order: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Order: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 0a4d002a2dd..34a4ed7b12e 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -public struct OuterComposite: Sendable, Codable, QueryStringEncodable, Hashable { +public struct OuterComposite: Sendable, Codable, ParameterConvertible, Hashable { public var myNumber: Double? public var myString: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 302a3052c6e..cd28268b345 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -public struct Pet: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Pet: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index 5a06da436f6..5d6c8a6c9cf 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -public struct ReadOnlyFirst: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ReadOnlyFirst: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 53ca3f5ad7f..c2a1b7f73c8 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Return: Sendable, Codable, ParameterConvertible, Hashable { public var _return: Int? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index 40ad8ff0a05..000b39a8a13 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -public struct SpecialModelName: Sendable, Codable, QueryStringEncodable, Hashable { +public struct SpecialModelName: Sendable, Codable, ParameterConvertible, Hashable { public var specialPropertyName: Int64? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index 3bbade9feb7..0ec7c486208 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,7 +7,7 @@ import Foundation -public struct StringBooleanMap: Sendable, Codable, QueryStringEncodable, Hashable { +public struct StringBooleanMap: Sendable, Codable, ParameterConvertible, Hashable { public enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 7c19767a11f..df5505fc4bc 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -public struct Tag: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Tag: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index eaaab729500..459e3c03da4 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderDefault: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderDefault: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String = "what" public var numberItem: Double diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index bac80c4fcd2..628ca869217 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderExample: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderExample: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String public var numberItem: Double diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index e41975d4d66..33fa97c11eb 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -public struct User: Sendable, Codable, QueryStringEncodable, Hashable { +public struct User: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var username: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeAPI.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeAPI.swift index 106c10712e6..a1941d1ca55 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/FakeAPI.swift @@ -326,7 +326,7 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "query": (wrappedValue: query.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -467,20 +467,20 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "integer": integer?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.asParameter(codableHelper: apiConfiguration.codableHelper), + "number": number.asParameter(codableHelper: apiConfiguration.codableHelper), + "float": float?.asParameter(codableHelper: apiConfiguration.codableHelper), + "double": double.asParameter(codableHelper: apiConfiguration.codableHelper), + "string": string?.asParameter(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.asParameter(codableHelper: apiConfiguration.codableHelper), + "byte": byte.asParameter(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.asParameter(codableHelper: apiConfiguration.codableHelper), + "date": date?.asParameter(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.asParameter(codableHelper: apiConfiguration.codableHelper), + "password": password?.asParameter(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -622,8 +622,8 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_form_string_array": enumFormStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -631,16 +631,16 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -705,15 +705,15 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "required_boolean_group": requiredBooleanGroup.asParameter(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -821,8 +821,8 @@ open class FakeAPI { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "param": param.asParameter(codableHelper: apiConfiguration.codableHelper), + "param2": param2.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift index c31c5670bc0..903bf2abb82 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift @@ -126,7 +126,7 @@ open class PetAPI { let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "api_key": apiKey?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -193,7 +193,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "status": (wrappedValue: status.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -257,7 +257,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -442,8 +442,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "name": name?.asParameter(codableHelper: apiConfiguration.codableHelper), + "status": status?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -513,8 +513,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "file": file?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -584,8 +584,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/UserAPI.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/UserAPI.swift index f8f373e93a9..1603f7bcea3 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/UserAPI.swift @@ -342,8 +342,8 @@ open class UserAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "username": (wrappedValue: username.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Extensions.swift index 1120f928d7e..fc0b544a05c 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Extensions.swift @@ -9,78 +9,73 @@ import Foundation import FoundationNetworking #endif -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -88,24 +83,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift index 78a06110af5..6e7a6337deb 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Models.swift @@ -9,8 +9,8 @@ import Foundation import FoundationNetworking #endif -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/AdditionalPropertiesClass.swift index 9bd081f7d00..4bf7be0f249 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var mapString: [String: String]? public var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Animal.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Animal.swift index b20104e0503..e2e0e01546a 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Animal.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -public struct Animal: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Animal: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ApiResponse.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ApiResponse.swift index cea25ea52e2..3e6a6f952ee 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -public struct ApiResponse: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ApiResponse: Sendable, Codable, ParameterConvertible, Hashable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayOfArrayOfNumberOnly.swift index 679279d61cb..5e7b7650f85 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayOfNumberOnly.swift index d71bd4e40b7..abe8c9ea856 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayTest.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayTest.swift index 839795229bb..1f24ed5e731 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayTest: Sendable, Codable, ParameterConvertible, Hashable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Capitalization.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Capitalization.swift index 56100523e84..090b3a75515 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -public struct Capitalization: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Capitalization: Sendable, Codable, ParameterConvertible, Hashable { public var smallCamel: String? public var capitalCamel: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Cat.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Cat.swift index cceeddd1bf9..36a552d208d 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Cat.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -public struct Cat: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Cat: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Category.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Category.swift index c04a9e673cf..66785088d3d 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Category.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -public struct Category: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Category: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? = "default-name" diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ClassModel.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ClassModel.swift index 4c1e9c1a990..4e9a2272ef7 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ClassModel: Sendable, Codable, ParameterConvertible, Hashable { public var _class: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Client.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Client.swift index b49ded4cc5c..71fe46ac1bd 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Client.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -public struct Client: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Client: Sendable, Codable, ParameterConvertible, Hashable { public var client: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Dog.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Dog.swift index 99231ca03f7..134cc4ad51f 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Dog.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -public struct Dog: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Dog: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/EnumArrays.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/EnumArrays.swift index 09bbcb9f280..4f7b547df68 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumArrays: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumArrays: Sendable, Codable, ParameterConvertible, Hashable { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/EnumTest.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/EnumTest.swift index d280112e88b..9472c599e8b 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumTest: Sendable, Codable, ParameterConvertible, Hashable { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/File.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/File.swift index c35e1b2d53a..2b1d20efb35 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/File.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Sendable, Codable, QueryStringEncodable, Hashable { +public struct File: Sendable, Codable, ParameterConvertible, Hashable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FileSchemaTestClass.swift index 6ca430a91ba..528709b3c7e 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct FileSchemaTestClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FileSchemaTestClass: Sendable, Codable, ParameterConvertible, Hashable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FormatTest.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FormatTest.swift index 427b85e7fd9..695d9a44358 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct FormatTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FormatTest: Sendable, Codable, ParameterConvertible, Hashable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/HasOnlyReadOnly.swift index e5db6255169..850da288bf0 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct HasOnlyReadOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct HasOnlyReadOnly: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/List.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/List.swift index 75c553df8fc..415ef215291 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/List.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -public struct List: Sendable, Codable, QueryStringEncodable, Hashable { +public struct List: Sendable, Codable, ParameterConvertible, Hashable { public var _123list: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/MapTest.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/MapTest.swift index 8cc06717f31..b373fbe8292 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/MapTest.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct MapTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MapTest: Sendable, Codable, ParameterConvertible, Hashable { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 2c7bd6d9c7c..0f667b7668a 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var uuid: UUID? public var dateTime: Date? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Model200Response.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Model200Response.swift index dfe19e3fdd9..0eadfe3042a 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Model200Response: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int? public var _class: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Name.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Name.swift index d0a98e0980b..82bba99bf66 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Name.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Name: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int public var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/NumberOnly.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/NumberOnly.swift index 47d2e318bb5..05bd45180b0 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct NumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct NumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var justNumber: Double? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Order.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Order.swift index 6a9ecc5540c..9f2556d6c0e 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Order.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -public struct Order: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Order: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/OuterComposite.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/OuterComposite.swift index 0a4d002a2dd..34a4ed7b12e 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -public struct OuterComposite: Sendable, Codable, QueryStringEncodable, Hashable { +public struct OuterComposite: Sendable, Codable, ParameterConvertible, Hashable { public var myNumber: Double? public var myString: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Pet.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Pet.swift index 302a3052c6e..cd28268b345 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Pet.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -public struct Pet: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Pet: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ReadOnlyFirst.swift index 5a06da436f6..5d6c8a6c9cf 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -public struct ReadOnlyFirst: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ReadOnlyFirst: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Return.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Return.swift index 53ca3f5ad7f..c2a1b7f73c8 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Return.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Return: Sendable, Codable, ParameterConvertible, Hashable { public var _return: Int? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/SpecialModelName.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/SpecialModelName.swift index 40ad8ff0a05..000b39a8a13 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -public struct SpecialModelName: Sendable, Codable, QueryStringEncodable, Hashable { +public struct SpecialModelName: Sendable, Codable, ParameterConvertible, Hashable { public var specialPropertyName: Int64? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/StringBooleanMap.swift index 3bbade9feb7..0ec7c486208 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/StringBooleanMap.swift @@ -7,7 +7,7 @@ import Foundation -public struct StringBooleanMap: Sendable, Codable, QueryStringEncodable, Hashable { +public struct StringBooleanMap: Sendable, Codable, ParameterConvertible, Hashable { public enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Tag.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Tag.swift index 7c19767a11f..df5505fc4bc 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Tag.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -public struct Tag: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Tag: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/TypeHolderDefault.swift index eaaab729500..459e3c03da4 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderDefault: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderDefault: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String = "what" public var numberItem: Double diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/TypeHolderExample.swift index bac80c4fcd2..628ca869217 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderExample: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderExample: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String public var numberItem: Double diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/User.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/User.swift index e41975d4d66..33fa97c11eb 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/User.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -public struct User: Sendable, Codable, QueryStringEncodable, Hashable { +public struct User: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var username: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift index 5c1e5f69bf5..b4a5ba18dbb 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift @@ -40,7 +40,7 @@ open class AnotherFakeAPI { let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/json", - "uuid_test": uuidTest.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "uuid_test": uuidTest.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeAPI.swift index f48558e30ab..1a841ea0b02 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -253,7 +253,7 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "query": (wrappedValue: query.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -358,20 +358,20 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "integer": integer?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.asParameter(codableHelper: apiConfiguration.codableHelper), + "number": number.asParameter(codableHelper: apiConfiguration.codableHelper), + "float": float?.asParameter(codableHelper: apiConfiguration.codableHelper), + "double": double.asParameter(codableHelper: apiConfiguration.codableHelper), + "string": string?.asParameter(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.asParameter(codableHelper: apiConfiguration.codableHelper), + "byte": byte.asParameter(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.asParameter(codableHelper: apiConfiguration.codableHelper), + "date": date?.asParameter(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.asParameter(codableHelper: apiConfiguration.codableHelper), + "password": password?.asParameter(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -495,8 +495,8 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_form_string_array": enumFormStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -504,16 +504,16 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -560,15 +560,15 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "required_boolean_group": requiredBooleanGroup.asParameter(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -640,8 +640,8 @@ open class FakeAPI { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "param": param.asParameter(codableHelper: apiConfiguration.codableHelper), + "param2": param2.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -693,11 +693,11 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "pipe": (wrappedValue: pipe.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "ioutil": (wrappedValue: ioutil.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "http": (wrappedValue: http.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "url": (wrappedValue: url.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "context": (wrappedValue: context.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: true), + "pipe": (wrappedValue: pipe.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "ioutil": (wrappedValue: ioutil.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "http": (wrappedValue: http.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "url": (wrappedValue: url.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "context": (wrappedValue: context.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/PetAPI.swift index 04d43062920..7127e038bd3 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/PetAPI.swift @@ -84,7 +84,7 @@ open class PetAPI { let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "api_key": apiKey?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -133,7 +133,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "status": (wrappedValue: status.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -179,7 +179,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -310,8 +310,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "name": name?.asParameter(codableHelper: apiConfiguration.codableHelper), + "status": status?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -363,8 +363,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "file": file?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -416,8 +416,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/UserAPI.swift index 83974395c2c..bb05d9be0a5 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/APIs/UserAPI.swift @@ -231,8 +231,8 @@ open class UserAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "username": (wrappedValue: username.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Extensions.swift index 1120f928d7e..fc0b544a05c 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Extensions.swift @@ -9,78 +9,73 @@ import Foundation import FoundationNetworking #endif -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -88,24 +83,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift index 78a06110af5..6e7a6337deb 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Models.swift @@ -9,8 +9,8 @@ import Foundation import FoundationNetworking #endif -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift index b196dcd18bc..75d1d886622 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesAnyType.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesAnyType: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesAnyType: Sendable, Codable, ParameterConvertible, Hashable { public var name: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift index bf92db2adb8..5a41eccf3bb 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesArray.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesArray: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesArray: Sendable, Codable, ParameterConvertible, Hashable { public var name: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift index 844686f06ca..434dce35805 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesBoolean.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesBoolean: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesBoolean: Sendable, Codable, ParameterConvertible, Hashable { public var name: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift index 2cab8f05644..c1c971c78d8 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var mapString: [String: String]? public var mapNumber: [String: Double]? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift index 08efb93d204..8a3963260d6 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesInteger.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesInteger: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesInteger: Sendable, Codable, ParameterConvertible, Hashable { public var name: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift index ce1fd377f2a..d427a6fe0dd 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesNumber.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesNumber: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesNumber: Sendable, Codable, ParameterConvertible, Hashable { public var name: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift index d46086c877b..d5b428434f7 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesObject.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesObject: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesObject: Sendable, Codable, ParameterConvertible, Hashable { public var name: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift index 75d613e8086..ef5442bd361 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/AdditionalPropertiesString.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesString: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesString: Sendable, Codable, ParameterConvertible, Hashable { public var name: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Animal.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Animal.swift index b20104e0503..e2e0e01546a 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Animal.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -public struct Animal: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Animal: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ApiResponse.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ApiResponse.swift index cea25ea52e2..3e6a6f952ee 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -public struct ApiResponse: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ApiResponse: Sendable, Codable, ParameterConvertible, Hashable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift index 679279d61cb..5e7b7650f85 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift index d71bd4e40b7..abe8c9ea856 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayTest.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayTest.swift index 839795229bb..1f24ed5e731 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayTest: Sendable, Codable, ParameterConvertible, Hashable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/BigCat.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/BigCat.swift index 889e21b530b..7f415f6f699 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/BigCat.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/BigCat.swift @@ -7,7 +7,7 @@ import Foundation -public struct BigCat: Sendable, Codable, QueryStringEncodable, Hashable { +public struct BigCat: Sendable, Codable, ParameterConvertible, Hashable { public enum Kind: String, Sendable, Codable, CaseIterable { case lions = "lions" diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Capitalization.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Capitalization.swift index 56100523e84..090b3a75515 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -public struct Capitalization: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Capitalization: Sendable, Codable, ParameterConvertible, Hashable { public var smallCamel: String? public var capitalCamel: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Cat.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Cat.swift index cceeddd1bf9..36a552d208d 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Cat.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -public struct Cat: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Cat: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Category.swift index e83ecfd44a0..0bad4759665 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -public struct Category: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Category: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String = "default-name" diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ClassModel.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ClassModel.swift index 4c1e9c1a990..4e9a2272ef7 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ClassModel: Sendable, Codable, ParameterConvertible, Hashable { public var _class: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Client.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Client.swift index b49ded4cc5c..71fe46ac1bd 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Client.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -public struct Client: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Client: Sendable, Codable, ParameterConvertible, Hashable { public var client: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Dog.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Dog.swift index 99231ca03f7..134cc4ad51f 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Dog.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -public struct Dog: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Dog: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/EnumArrays.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/EnumArrays.swift index 09bbcb9f280..4f7b547df68 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumArrays: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumArrays: Sendable, Codable, ParameterConvertible, Hashable { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/EnumTest.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/EnumTest.swift index d280112e88b..9472c599e8b 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumTest: Sendable, Codable, ParameterConvertible, Hashable { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/File.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/File.swift index c35e1b2d53a..2b1d20efb35 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/File.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Sendable, Codable, QueryStringEncodable, Hashable { +public struct File: Sendable, Codable, ParameterConvertible, Hashable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FileSchemaTestClass.swift index 6ca430a91ba..528709b3c7e 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct FileSchemaTestClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FileSchemaTestClass: Sendable, Codable, ParameterConvertible, Hashable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FormatTest.swift index 61e17db120b..d6cbe3eb90a 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct FormatTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FormatTest: Sendable, Codable, ParameterConvertible, Hashable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift index e5db6255169..850da288bf0 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct HasOnlyReadOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct HasOnlyReadOnly: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/List.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/List.swift index 75c553df8fc..415ef215291 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/List.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -public struct List: Sendable, Codable, QueryStringEncodable, Hashable { +public struct List: Sendable, Codable, ParameterConvertible, Hashable { public var _123list: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/MapTest.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/MapTest.swift index 8cc06717f31..b373fbe8292 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/MapTest.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct MapTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MapTest: Sendable, Codable, ParameterConvertible, Hashable { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 2c7bd6d9c7c..0f667b7668a 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var uuid: UUID? public var dateTime: Date? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Model200Response.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Model200Response.swift index dfe19e3fdd9..0eadfe3042a 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Model200Response: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int? public var _class: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Name.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Name.swift index 74c87a00de3..83d0531d4a2 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Name.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Name: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int public var snakeCase: Int? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/NumberOnly.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/NumberOnly.swift index 47d2e318bb5..05bd45180b0 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct NumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct NumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var justNumber: Double? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Order.swift index 2e677b9763d..eee7fff6226 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -public struct Order: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Order: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/OuterComposite.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/OuterComposite.swift index 0a4d002a2dd..34a4ed7b12e 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -public struct OuterComposite: Sendable, Codable, QueryStringEncodable, Hashable { +public struct OuterComposite: Sendable, Codable, ParameterConvertible, Hashable { public var myNumber: Double? public var myString: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift index 15b7f089a74..90f765ada16 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -public struct Pet: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Pet: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ReadOnlyFirst.swift index 5a06da436f6..5d6c8a6c9cf 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -public struct ReadOnlyFirst: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ReadOnlyFirst: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Return.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Return.swift index 53ca3f5ad7f..c2a1b7f73c8 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Return.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Return: Sendable, Codable, ParameterConvertible, Hashable { public var _return: Int? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/SpecialModelName.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/SpecialModelName.swift index 40ad8ff0a05..000b39a8a13 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -public struct SpecialModelName: Sendable, Codable, QueryStringEncodable, Hashable { +public struct SpecialModelName: Sendable, Codable, ParameterConvertible, Hashable { public var specialPropertyName: Int64? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/StringBooleanMap.swift index 3bbade9feb7..0ec7c486208 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/StringBooleanMap.swift @@ -7,7 +7,7 @@ import Foundation -public struct StringBooleanMap: Sendable, Codable, QueryStringEncodable, Hashable { +public struct StringBooleanMap: Sendable, Codable, ParameterConvertible, Hashable { public enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Tag.swift index 7c19767a11f..df5505fc4bc 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -public struct Tag: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Tag: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/TypeHolderDefault.swift index eaaab729500..459e3c03da4 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderDefault: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderDefault: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String = "what" public var numberItem: Double diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/TypeHolderExample.swift index bc28c84984a..f0f7c697704 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderExample: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderExample: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String public var numberItem: Double diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/User.swift index e41975d4d66..33fa97c11eb 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -public struct User: Sendable, Codable, QueryStringEncodable, Hashable { +public struct User: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var username: String? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/XmlItem.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/XmlItem.swift index 2483cb03e27..d20d4957458 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/XmlItem.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/XmlItem.swift @@ -7,7 +7,7 @@ import Foundation -public struct XmlItem: Sendable, Codable, QueryStringEncodable, Hashable { +public struct XmlItem: Sendable, Codable, ParameterConvertible, Hashable { public var attributeString: String? public var attributeNumber: Double? diff --git a/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift b/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift index e62c0d14fe1..5bb46945abd 100644 --- a/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift +++ b/samples/client/petstore/swift6/default/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift @@ -27,7 +27,7 @@ class DateFormatTests: XCTestCase { super.tearDown() } - func testencodeToQueryStringAlwaysResultsInUTCEncodedDate() { + func testAsParameterAlwaysResultsInUTCEncodedDate() { var dateComponents = DateComponents() dateComponents.calendar = Calendar(identifier: .gregorian) dateComponents.year = 2018 @@ -47,7 +47,7 @@ class DateFormatTests: XCTestCase { return } - var encodedDate = utcDate.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String + var encodedDate = utcDate.asParameter(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a positive timzone offset from UTC @@ -59,7 +59,7 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate1.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String + encodedDate = nonUTCDate1.asParameter(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a negative timzone offset from UTC @@ -71,7 +71,7 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate2.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String + encodedDate = nonUTCDate2.asParameter(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeAPI.swift index 915a19c96a4..b2197abd737 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -257,7 +257,7 @@ import Foundation var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "query": (wrappedValue: query.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -376,20 +376,20 @@ import Foundation let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "integer": integer?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.asParameter(codableHelper: apiConfiguration.codableHelper), + "number": number.asParameter(codableHelper: apiConfiguration.codableHelper), + "float": float?.asParameter(codableHelper: apiConfiguration.codableHelper), + "double": double.asParameter(codableHelper: apiConfiguration.codableHelper), + "string": string?.asParameter(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.asParameter(codableHelper: apiConfiguration.codableHelper), + "byte": byte.asParameter(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.asParameter(codableHelper: apiConfiguration.codableHelper), + "date": date?.asParameter(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.asParameter(codableHelper: apiConfiguration.codableHelper), + "password": password?.asParameter(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -520,8 +520,8 @@ import Foundation let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_form_string_array": enumFormStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -529,16 +529,16 @@ import Foundation var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -592,15 +592,15 @@ import Foundation var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "required_boolean_group": requiredBooleanGroup.asParameter(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -686,8 +686,8 @@ import Foundation let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "param": param.asParameter(codableHelper: apiConfiguration.codableHelper), + "param2": param2.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift index ef7aa107f0a..7ab17f29933 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift @@ -101,7 +101,7 @@ import Foundation let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "api_key": apiKey?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -157,7 +157,7 @@ import Foundation var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "status": (wrappedValue: status.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -210,7 +210,7 @@ import Foundation var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -362,8 +362,8 @@ import Foundation localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "name": name?.asParameter(codableHelper: apiConfiguration.codableHelper), + "status": status?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -422,8 +422,8 @@ import Foundation localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "file": file?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -482,8 +482,8 @@ import Foundation localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/UserAPI.swift index e73cf4d9c60..807abb2ca4a 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/UserAPI.swift @@ -273,8 +273,8 @@ import Foundation var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "username": (wrappedValue: username.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Extensions.swift index 1120f928d7e..fc0b544a05c 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Extensions.swift @@ -9,78 +9,73 @@ import Foundation import FoundationNetworking #endif -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -88,24 +83,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift index 78a06110af5..6e7a6337deb 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Models.swift @@ -9,8 +9,8 @@ import Foundation import FoundationNetworking #endif -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift index ff43a426840..896d23b3a2d 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class AdditionalPropertiesClass: NSObject, Codable, QueryStringEncodable { +@objcMembers public class AdditionalPropertiesClass: NSObject, Codable, ParameterConvertible { public var mapString: [String: String]? public var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift index d7b9f602323..82e821c36f8 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Animal: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Animal: NSObject, Codable, ParameterConvertible { public var _className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift index 5e4e0c36d7c..a05ab02614e 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ApiResponse: NSObject, Codable, QueryStringEncodable { +@objcMembers public class ApiResponse: NSObject, Codable, ParameterConvertible { public var code: Int? public var codeNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift index 24f978b3acc..bdbc9cab647 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ArrayOfArrayOfNumberOnly: NSObject, Codable, QueryStringEncodable { +@objcMembers public class ArrayOfArrayOfNumberOnly: NSObject, Codable, ParameterConvertible { public var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift index 87976a6bc10..2df4df84fa0 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ArrayOfNumberOnly: NSObject, Codable, QueryStringEncodable { +@objcMembers public class ArrayOfNumberOnly: NSObject, Codable, ParameterConvertible { public var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift index 9df6854ecd3..7a813d8ce54 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ArrayTest: NSObject, Codable, QueryStringEncodable { +@objcMembers public class ArrayTest: NSObject, Codable, ParameterConvertible { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift index 2862c6d836e..81f60741bdc 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Capitalization: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Capitalization: NSObject, Codable, ParameterConvertible { public var smallCamel: String? public var capitalCamel: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift index 7d93c0dd084..55ce7c4438b 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Cat: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Cat: NSObject, Codable, ParameterConvertible { public var _className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift index 8801788d3b7..7a173007acd 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Category: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Category: NSObject, Codable, ParameterConvertible { public var _id: Int64? public var _idNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift index 42274044f19..ada6601da42 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -@objcMembers public class ClassModel: NSObject, Codable, QueryStringEncodable { +@objcMembers public class ClassModel: NSObject, Codable, ParameterConvertible { public var _class: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift index c6140e4e15e..64655ce1265 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Client: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Client: NSObject, Codable, ParameterConvertible { public var client: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift index 32f8957fe73..29db23798bc 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Dog: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Dog: NSObject, Codable, ParameterConvertible { public var _className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift index 53d96d689f6..fbcde5b6a57 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class EnumArrays: NSObject, Codable, QueryStringEncodable { +@objcMembers public class EnumArrays: NSObject, Codable, ParameterConvertible { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift index 42043815934..d8c630d29d3 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class EnumTest: NSObject, Codable, QueryStringEncodable { +@objcMembers public class EnumTest: NSObject, Codable, ParameterConvertible { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift index 16d025d2d12..2f5b7ca8c2f 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -@objcMembers public class File: NSObject, Codable, QueryStringEncodable { +@objcMembers public class File: NSObject, Codable, ParameterConvertible { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift index 0761749c34b..b998c3d1863 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class FileSchemaTestClass: NSObject, Codable, QueryStringEncodable { +@objcMembers public class FileSchemaTestClass: NSObject, Codable, ParameterConvertible { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift index c0e14f2e063..b7b2aa8305e 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class FormatTest: NSObject, Codable, QueryStringEncodable { +@objcMembers public class FormatTest: NSObject, Codable, ParameterConvertible { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift index fde651257f9..ba89f4a0aed 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class HasOnlyReadOnly: NSObject, Codable, QueryStringEncodable { +@objcMembers public class HasOnlyReadOnly: NSObject, Codable, ParameterConvertible { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift index ac9b2ddf867..4dcea67b6bf 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class List: NSObject, Codable, QueryStringEncodable { +@objcMembers public class List: NSObject, Codable, ParameterConvertible { public var _123list: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift index 1d9d0ad9324..3cf4206d3f9 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class MapTest: NSObject, Codable, QueryStringEncodable { +@objcMembers public class MapTest: NSObject, Codable, ParameterConvertible { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index f566d6af688..31a688b2990 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class MixedPropertiesAndAdditionalPropertiesClass: NSObject, Codable, QueryStringEncodable { +@objcMembers public class MixedPropertiesAndAdditionalPropertiesClass: NSObject, Codable, ParameterConvertible { public var uuid: UUID? public var dateTime: Date? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift index 37c35576bf1..6d887505ef5 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -@objcMembers public class Model200Response: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Model200Response: NSObject, Codable, ParameterConvertible { public var name: Int? public var nameNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift index 9c783ca1852..326d2c671ec 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -@objcMembers public class Name: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Name: NSObject, Codable, ParameterConvertible { public var name: Int public var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift index 4a019233c1a..39b81dc28e6 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class NumberOnly: NSObject, Codable, QueryStringEncodable { +@objcMembers public class NumberOnly: NSObject, Codable, ParameterConvertible { public var justNumber: Double? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift index 8b9ca0f6b3d..a0b91baaf92 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Order: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Order: NSObject, Codable, ParameterConvertible { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift index 8ef5bf31360..74fc46acdbd 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class OuterComposite: NSObject, Codable, QueryStringEncodable { +@objcMembers public class OuterComposite: NSObject, Codable, ParameterConvertible { public var myNumber: Double? public var myString: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift index fc85d0a3516..31c4330a7d5 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Pet: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Pet: NSObject, Codable, ParameterConvertible { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift index e80c59d3273..1ab05a9aebb 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class ReadOnlyFirst: NSObject, Codable, QueryStringEncodable { +@objcMembers public class ReadOnlyFirst: NSObject, Codable, ParameterConvertible { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift index 2fd051f925e..86442acc9e2 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -@objcMembers public class Return: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Return: NSObject, Codable, ParameterConvertible { public var _return: Int? public var _returnNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift index bce626c79e7..1defae54ac0 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class SpecialModelName: NSObject, Codable, QueryStringEncodable { +@objcMembers public class SpecialModelName: NSObject, Codable, ParameterConvertible { public var specialPropertyName: Int64? public var specialPropertyNameNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift index de0825caaee..dc4db21b3b3 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/StringBooleanMap.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class StringBooleanMap: NSObject, Codable, QueryStringEncodable { +@objcMembers public class StringBooleanMap: NSObject, Codable, ParameterConvertible { public enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift index f7670114e76..48903425059 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class Tag: NSObject, Codable, QueryStringEncodable { +@objcMembers public class Tag: NSObject, Codable, ParameterConvertible { public var _id: Int64? public var _idNum: NSNumber? { diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift index 093c4131d0c..f47928cb2ed 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class TypeHolderDefault: NSObject, Codable, QueryStringEncodable { +@objcMembers public class TypeHolderDefault: NSObject, Codable, ParameterConvertible { public var stringItem: String = "what" public var numberItem: Double diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift index 406aa05eba2..45c9eb19155 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class TypeHolderExample: NSObject, Codable, QueryStringEncodable { +@objcMembers public class TypeHolderExample: NSObject, Codable, ParameterConvertible { public var stringItem: String public var numberItem: Double diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift index 4ad13fce234..1c564a7f0b8 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -@objcMembers public class User: NSObject, Codable, QueryStringEncodable { +@objcMembers public class User: NSObject, Codable, ParameterConvertible { public var _id: Int64? public var _idNum: NSNumber? { diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift index 1120f928d7e..fc0b544a05c 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift @@ -9,78 +9,73 @@ import Foundation import FoundationNetworking #endif -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -88,24 +83,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 78a06110af5..6e7a6337deb 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -9,8 +9,8 @@ import Foundation import FoundationNetworking #endif -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Apple.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Apple.swift index b5f9dab002a..f4a1981f965 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Apple.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Apple.swift @@ -7,7 +7,7 @@ import Foundation -public struct Apple: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Apple: Sendable, Codable, ParameterConvertible, Hashable { public var kind: String? diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift index fa52f03497f..cc56410c7cf 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift @@ -7,7 +7,7 @@ import Foundation -public struct Banana: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Banana: Sendable, Codable, ParameterConvertible, Hashable { public var count: Double? diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Fruit.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Fruit.swift index bff766489aa..ab4723c3a06 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Fruit.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Models/Fruit.swift @@ -7,7 +7,7 @@ import Foundation -public enum Fruit: Sendable, Codable, QueryStringEncodable, Hashable { +public enum Fruit: Sendable, Codable, ParameterConvertible, Hashable { case typeApple(Apple) case typeBanana(Banana) diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 3b2dbbfd0cd..4807c976fc7 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -264,7 +264,7 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "query": (wrappedValue: query.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -385,20 +385,20 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "integer": integer?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.asParameter(codableHelper: apiConfiguration.codableHelper), + "number": number.asParameter(codableHelper: apiConfiguration.codableHelper), + "float": float?.asParameter(codableHelper: apiConfiguration.codableHelper), + "double": double.asParameter(codableHelper: apiConfiguration.codableHelper), + "string": string?.asParameter(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.asParameter(codableHelper: apiConfiguration.codableHelper), + "byte": byte.asParameter(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.asParameter(codableHelper: apiConfiguration.codableHelper), + "date": date?.asParameter(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.asParameter(codableHelper: apiConfiguration.codableHelper), + "password": password?.asParameter(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -530,8 +530,8 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_form_string_array": enumFormStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -539,16 +539,16 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -603,15 +603,15 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "required_boolean_group": requiredBooleanGroup.asParameter(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -699,8 +699,8 @@ open class FakeAPI { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "param": param.asParameter(codableHelper: apiConfiguration.codableHelper), + "param2": param2.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index f862792ac8f..a81fce6ea03 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -104,7 +104,7 @@ open class PetAPI { let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "api_key": apiKey?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -161,7 +161,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "status": (wrappedValue: status.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -215,7 +215,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -370,8 +370,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "name": name?.asParameter(codableHelper: apiConfiguration.codableHelper), + "status": status?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -431,8 +431,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "file": file?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -492,8 +492,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index be766b2c5e4..c29b09f2d47 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -280,8 +280,8 @@ open class UserAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "username": (wrappedValue: username.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift index 74e95feeeed..6b6bf2d2b5a 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift @@ -10,78 +10,73 @@ import FoundationNetworking #endif @preconcurrency import PromiseKit -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -89,24 +84,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 78a06110af5..6e7a6337deb 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -9,8 +9,8 @@ import Foundation import FoundationNetworking #endif -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 9bd081f7d00..4bf7be0f249 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var mapString: [String: String]? public var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index b20104e0503..e2e0e01546a 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -public struct Animal: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Animal: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index cea25ea52e2..3e6a6f952ee 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -public struct ApiResponse: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ApiResponse: Sendable, Codable, ParameterConvertible, Hashable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 679279d61cb..5e7b7650f85 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index d71bd4e40b7..abe8c9ea856 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 839795229bb..1f24ed5e731 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayTest: Sendable, Codable, ParameterConvertible, Hashable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index 56100523e84..090b3a75515 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -public struct Capitalization: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Capitalization: Sendable, Codable, ParameterConvertible, Hashable { public var smallCamel: String? public var capitalCamel: String? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index cceeddd1bf9..36a552d208d 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -public struct Cat: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Cat: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index c04a9e673cf..66785088d3d 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -public struct Category: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Category: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? = "default-name" diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index 4c1e9c1a990..4e9a2272ef7 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ClassModel: Sendable, Codable, ParameterConvertible, Hashable { public var _class: String? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index b49ded4cc5c..71fe46ac1bd 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -public struct Client: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Client: Sendable, Codable, ParameterConvertible, Hashable { public var client: String? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 99231ca03f7..134cc4ad51f 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -public struct Dog: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Dog: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index 09bbcb9f280..4f7b547df68 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumArrays: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumArrays: Sendable, Codable, ParameterConvertible, Hashable { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index d280112e88b..9472c599e8b 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumTest: Sendable, Codable, ParameterConvertible, Hashable { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift index c35e1b2d53a..2b1d20efb35 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Sendable, Codable, QueryStringEncodable, Hashable { +public struct File: Sendable, Codable, ParameterConvertible, Hashable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 6ca430a91ba..528709b3c7e 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct FileSchemaTestClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FileSchemaTestClass: Sendable, Codable, ParameterConvertible, Hashable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 427b85e7fd9..695d9a44358 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct FormatTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FormatTest: Sendable, Codable, ParameterConvertible, Hashable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index e5db6255169..850da288bf0 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct HasOnlyReadOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct HasOnlyReadOnly: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 75c553df8fc..415ef215291 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -public struct List: Sendable, Codable, QueryStringEncodable, Hashable { +public struct List: Sendable, Codable, ParameterConvertible, Hashable { public var _123list: String? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index 8cc06717f31..b373fbe8292 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct MapTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MapTest: Sendable, Codable, ParameterConvertible, Hashable { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 2c7bd6d9c7c..0f667b7668a 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var uuid: UUID? public var dateTime: Date? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index dfe19e3fdd9..0eadfe3042a 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Model200Response: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int? public var _class: String? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index d0a98e0980b..82bba99bf66 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Name: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int public var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 47d2e318bb5..05bd45180b0 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct NumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct NumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var justNumber: Double? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 6a9ecc5540c..9f2556d6c0e 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -public struct Order: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Order: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 0a4d002a2dd..34a4ed7b12e 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -public struct OuterComposite: Sendable, Codable, QueryStringEncodable, Hashable { +public struct OuterComposite: Sendable, Codable, ParameterConvertible, Hashable { public var myNumber: Double? public var myString: String? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 302a3052c6e..cd28268b345 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -public struct Pet: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Pet: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index 5a06da436f6..5d6c8a6c9cf 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -public struct ReadOnlyFirst: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ReadOnlyFirst: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 53ca3f5ad7f..c2a1b7f73c8 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Return: Sendable, Codable, ParameterConvertible, Hashable { public var _return: Int? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index 40ad8ff0a05..000b39a8a13 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -public struct SpecialModelName: Sendable, Codable, QueryStringEncodable, Hashable { +public struct SpecialModelName: Sendable, Codable, ParameterConvertible, Hashable { public var specialPropertyName: Int64? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index 3bbade9feb7..0ec7c486208 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,7 +7,7 @@ import Foundation -public struct StringBooleanMap: Sendable, Codable, QueryStringEncodable, Hashable { +public struct StringBooleanMap: Sendable, Codable, ParameterConvertible, Hashable { public enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 7c19767a11f..df5505fc4bc 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -public struct Tag: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Tag: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index eaaab729500..459e3c03da4 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderDefault: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderDefault: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String = "what" public var numberItem: Double diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index bac80c4fcd2..628ca869217 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderExample: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderExample: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String public var numberItem: Double diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index e41975d4d66..33fa97c11eb 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -public struct User: Sendable, Codable, QueryStringEncodable, Hashable { +public struct User: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var username: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index c531bf4a1f7..e1c145c8313 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -257,7 +257,7 @@ internal class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "query": (wrappedValue: query.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -376,20 +376,20 @@ internal class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "integer": integer?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.asParameter(codableHelper: apiConfiguration.codableHelper), + "number": number.asParameter(codableHelper: apiConfiguration.codableHelper), + "float": float?.asParameter(codableHelper: apiConfiguration.codableHelper), + "double": double.asParameter(codableHelper: apiConfiguration.codableHelper), + "string": string?.asParameter(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.asParameter(codableHelper: apiConfiguration.codableHelper), + "byte": byte.asParameter(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.asParameter(codableHelper: apiConfiguration.codableHelper), + "date": date?.asParameter(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.asParameter(codableHelper: apiConfiguration.codableHelper), + "password": password?.asParameter(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -520,8 +520,8 @@ internal class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_form_string_array": enumFormStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -529,16 +529,16 @@ internal class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -592,15 +592,15 @@ internal class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "required_boolean_group": requiredBooleanGroup.asParameter(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -686,8 +686,8 @@ internal class FakeAPI { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "param": param.asParameter(codableHelper: apiConfiguration.codableHelper), + "param2": param2.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 524b1f4b5ac..fba46c58184 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -101,7 +101,7 @@ internal class PetAPI { let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "api_key": apiKey?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -157,7 +157,7 @@ internal class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "status": (wrappedValue: status.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -210,7 +210,7 @@ internal class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -362,8 +362,8 @@ internal class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "name": name?.asParameter(codableHelper: apiConfiguration.codableHelper), + "status": status?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -422,8 +422,8 @@ internal class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "file": file?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -482,8 +482,8 @@ internal class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index 51ff300b334..2b567e28a96 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -273,8 +273,8 @@ internal class UserAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "username": (wrappedValue: username.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift index 725aac0bcdb..40c9dc15240 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift @@ -9,78 +9,73 @@ import Foundation import FoundationNetworking #endif -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -88,24 +83,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index f763f8d092a..0f7fca84583 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -9,8 +9,8 @@ import Foundation import FoundationNetworking #endif -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index cd94c1658ac..5fe1c0a0f45 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -internal struct AdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable { +internal struct AdditionalPropertiesClass: Sendable, Codable, ParameterConvertible { internal private(set) var mapString: [String: String]? internal private(set) var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index f299bddbadc..3ba560bd83d 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -internal struct Animal: Sendable, Codable, QueryStringEncodable { +internal struct Animal: Sendable, Codable, ParameterConvertible { internal private(set) var className: String internal private(set) var color: String? = "red" diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index eea24b50519..3fc6a400ad9 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -internal struct ApiResponse: Sendable, Codable, QueryStringEncodable { +internal struct ApiResponse: Sendable, Codable, ParameterConvertible { internal private(set) var code: Int? internal private(set) var type: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 2206e28fb94..2b0c435cc55 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -internal struct ArrayOfArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable { +internal struct ArrayOfArrayOfNumberOnly: Sendable, Codable, ParameterConvertible { internal private(set) var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 3f93ba4a0bb..972657e56a6 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -internal struct ArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable { +internal struct ArrayOfNumberOnly: Sendable, Codable, ParameterConvertible { internal private(set) var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index dbd72e91db2..9d2c5040710 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -internal struct ArrayTest: Sendable, Codable, QueryStringEncodable { +internal struct ArrayTest: Sendable, Codable, ParameterConvertible { internal private(set) var arrayOfString: [String]? internal private(set) var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index 981a4637676..412fbe83f63 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -internal struct Capitalization: Sendable, Codable, QueryStringEncodable { +internal struct Capitalization: Sendable, Codable, ParameterConvertible { internal private(set) var smallCamel: String? internal private(set) var capitalCamel: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index 2294c0d3e80..1bcf33e8117 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -internal struct Cat: Sendable, Codable, QueryStringEncodable { +internal struct Cat: Sendable, Codable, ParameterConvertible { internal private(set) var className: String internal private(set) var color: String? = "red" diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index f4c349f77cc..bc2243b3918 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -internal struct Category: Sendable, Codable, QueryStringEncodable, Hashable { +internal struct Category: Sendable, Codable, ParameterConvertible, Hashable { internal private(set) var id: Int64? internal private(set) var name: String? = "default-name" diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index d45977632ce..b161ee5361e 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -internal struct ClassModel: Sendable, Codable, QueryStringEncodable { +internal struct ClassModel: Sendable, Codable, ParameterConvertible { internal private(set) var _class: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index ae658e54f3f..ddf25d10d8b 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -internal struct Client: Sendable, Codable, QueryStringEncodable { +internal struct Client: Sendable, Codable, ParameterConvertible { internal private(set) var client: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 2c3e6c61391..7643447af78 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -internal struct Dog: Sendable, Codable, QueryStringEncodable { +internal struct Dog: Sendable, Codable, ParameterConvertible { internal private(set) var className: String internal private(set) var color: String? = "red" diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index 1174d2f1a3c..564b8321537 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -internal struct EnumArrays: Sendable, Codable, QueryStringEncodable { +internal struct EnumArrays: Sendable, Codable, ParameterConvertible { internal enum JustSymbol: String, Sendable, Codable, CaseIterable, CaseIterableDefaultsLast { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index 3dfc4d8208a..380f8a56187 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -internal struct EnumTest: Sendable, Codable, QueryStringEncodable { +internal struct EnumTest: Sendable, Codable, ParameterConvertible { internal enum EnumString: String, Sendable, Codable, CaseIterable, CaseIterableDefaultsLast { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift index 4d49a28ba51..ed8a14518ad 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -internal struct File: Sendable, Codable, QueryStringEncodable { +internal struct File: Sendable, Codable, ParameterConvertible { /** Test capitalization */ internal private(set) var sourceURI: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index dde036f6806..ee3ce88b2f2 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -internal struct FileSchemaTestClass: Sendable, Codable, QueryStringEncodable { +internal struct FileSchemaTestClass: Sendable, Codable, ParameterConvertible { internal private(set) var file: File? internal private(set) var files: [File]? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index eeb7c62f70a..e0ed0dd4601 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -internal struct FormatTest: Sendable, Codable, QueryStringEncodable { +internal struct FormatTest: Sendable, Codable, ParameterConvertible { internal static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) internal static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 90dff39f23f..da206ba7731 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -internal struct HasOnlyReadOnly: Sendable, Codable, QueryStringEncodable { +internal struct HasOnlyReadOnly: Sendable, Codable, ParameterConvertible { internal private(set) var bar: String? internal private(set) var foo: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 0f9fdf3b123..cfa8e12a3c2 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -internal struct List: Sendable, Codable, QueryStringEncodable { +internal struct List: Sendable, Codable, ParameterConvertible { internal private(set) var _123list: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index db519aeb1d2..1d038801700 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -internal struct MapTest: Sendable, Codable, QueryStringEncodable { +internal struct MapTest: Sendable, Codable, ParameterConvertible { internal enum MapOfEnumString: String, Sendable, Codable, CaseIterable, CaseIterableDefaultsLast { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 34b7bce4cce..d6b825a0167 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -internal struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable { +internal struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, ParameterConvertible { internal private(set) var uuid: UUID? internal private(set) var dateTime: Date? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 91f96443c27..27450bb544a 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -internal struct Model200Response: Sendable, Codable, QueryStringEncodable { +internal struct Model200Response: Sendable, Codable, ParameterConvertible { internal private(set) var name: Int? internal private(set) var _class: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index a21abc0e071..dc0260c62e7 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -internal struct Name: Sendable, Codable, QueryStringEncodable { +internal struct Name: Sendable, Codable, ParameterConvertible { internal private(set) var name: Int internal private(set) var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index c229a50c78a..2976cb930a2 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -internal struct NumberOnly: Sendable, Codable, QueryStringEncodable { +internal struct NumberOnly: Sendable, Codable, ParameterConvertible { internal private(set) var justNumber: Double? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 64841139f24..1fa0b8dda24 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -internal struct Order: Sendable, Codable, QueryStringEncodable { +internal struct Order: Sendable, Codable, ParameterConvertible { internal enum Status: String, Sendable, Codable, CaseIterable, CaseIterableDefaultsLast { case placed = "placed" diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index e85a44fa9d4..dae65172273 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -internal struct OuterComposite: Sendable, Codable, QueryStringEncodable { +internal struct OuterComposite: Sendable, Codable, ParameterConvertible { internal private(set) var myNumber: Double? internal private(set) var myString: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 91a8ef34143..f8a0b6f0e7f 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -internal struct Pet: Sendable, Codable, QueryStringEncodable, Hashable { +internal struct Pet: Sendable, Codable, ParameterConvertible, Hashable { internal enum Status: String, Sendable, Codable, CaseIterable, CaseIterableDefaultsLast { case available = "available" diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index 77b1973aa42..f6aefb3f4bc 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -internal struct ReadOnlyFirst: Sendable, Codable, QueryStringEncodable { +internal struct ReadOnlyFirst: Sendable, Codable, ParameterConvertible { internal private(set) var bar: String? internal private(set) var baz: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index e2efcf5c4ec..4dcfd532731 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -internal struct Return: Sendable, Codable, QueryStringEncodable { +internal struct Return: Sendable, Codable, ParameterConvertible { internal private(set) var _return: Int? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index 3254476d018..163fcde6024 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -internal struct SpecialModelName: Sendable, Codable, QueryStringEncodable { +internal struct SpecialModelName: Sendable, Codable, ParameterConvertible { internal private(set) var specialPropertyName: Int64? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index 6e900ea2933..b645db9803b 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,7 +7,7 @@ import Foundation -internal struct StringBooleanMap: Sendable, Codable, QueryStringEncodable { +internal struct StringBooleanMap: Sendable, Codable, ParameterConvertible { internal enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 1b2844889e1..490073c7dad 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -internal struct Tag: Sendable, Codable, QueryStringEncodable, Hashable { +internal struct Tag: Sendable, Codable, ParameterConvertible, Hashable { internal private(set) var id: Int64? internal private(set) var name: String? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index 565dffc3983..fea989da078 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -internal struct TypeHolderDefault: Sendable, Codable, QueryStringEncodable { +internal struct TypeHolderDefault: Sendable, Codable, ParameterConvertible { internal private(set) var stringItem: String = "what" internal private(set) var numberItem: Double diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index 95d17b53d07..ea42cc7a5ad 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -internal struct TypeHolderExample: Sendable, Codable, QueryStringEncodable { +internal struct TypeHolderExample: Sendable, Codable, ParameterConvertible { internal private(set) var stringItem: String internal private(set) var numberItem: Double diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index b5f6d6680fb..4f8f822838c 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -internal struct User: Sendable, Codable, QueryStringEncodable { +internal struct User: Sendable, Codable, ParameterConvertible { internal private(set) var id: Int64? internal private(set) var username: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index 214c215e113..aa0560d9f27 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -294,7 +294,7 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "query": (wrappedValue: query.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -425,20 +425,20 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "integer": integer?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.asParameter(codableHelper: apiConfiguration.codableHelper), + "number": number.asParameter(codableHelper: apiConfiguration.codableHelper), + "float": float?.asParameter(codableHelper: apiConfiguration.codableHelper), + "double": double.asParameter(codableHelper: apiConfiguration.codableHelper), + "string": string?.asParameter(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.asParameter(codableHelper: apiConfiguration.codableHelper), + "byte": byte.asParameter(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.asParameter(codableHelper: apiConfiguration.codableHelper), + "date": date?.asParameter(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.asParameter(codableHelper: apiConfiguration.codableHelper), + "password": password?.asParameter(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -575,8 +575,8 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_form_string_array": enumFormStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -584,16 +584,16 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -653,15 +653,15 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "required_boolean_group": requiredBooleanGroup.asParameter(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -759,8 +759,8 @@ open class FakeAPI { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "param": param.asParameter(codableHelper: apiConfiguration.codableHelper), + "param2": param2.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index f020cbb840a..4a60300c9e7 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -114,7 +114,7 @@ open class PetAPI { let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "api_key": apiKey?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -176,7 +176,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "status": (wrappedValue: status.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -235,7 +235,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -405,8 +405,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "name": name?.asParameter(codableHelper: apiConfiguration.codableHelper), + "status": status?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -471,8 +471,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "file": file?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -537,8 +537,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift index cd06a791142..5a5484aba13 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/UserAPI.swift @@ -310,8 +310,8 @@ open class UserAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "username": (wrappedValue: username.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift index c88df32836d..fff56a53eec 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift @@ -9,78 +9,73 @@ import Foundation import FoundationNetworking #endif -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -88,23 +83,23 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 78a06110af5..6e7a6337deb 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -9,8 +9,8 @@ import Foundation import FoundationNetworking #endif -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 9bd081f7d00..4bf7be0f249 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct AdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct AdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var mapString: [String: String]? public var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index b20104e0503..e2e0e01546a 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,7 +7,7 @@ import Foundation -public struct Animal: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Animal: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index cea25ea52e2..3e6a6f952ee 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,7 +7,7 @@ import Foundation -public struct ApiResponse: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ApiResponse: Sendable, Codable, ParameterConvertible, Hashable { public var code: Int? public var type: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 679279d61cb..5e7b7650f85 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index d71bd4e40b7..abe8c9ea856 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayOfNumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayOfNumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 839795229bb..1f24ed5e731 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct ArrayTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ArrayTest: Sendable, Codable, ParameterConvertible, Hashable { public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index 56100523e84..090b3a75515 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,7 +7,7 @@ import Foundation -public struct Capitalization: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Capitalization: Sendable, Codable, ParameterConvertible, Hashable { public var smallCamel: String? public var capitalCamel: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index cceeddd1bf9..36a552d208d 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,7 +7,7 @@ import Foundation -public struct Cat: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Cat: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index c04a9e673cf..66785088d3d 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,7 +7,7 @@ import Foundation -public struct Category: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Category: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? = "default-name" diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index 53147d21e44..4e4d4a202b7 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model with \"_class\" property */ -public struct ClassModel: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ClassModel: Sendable, Codable, ParameterConvertible, Hashable { public var `class`: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index b49ded4cc5c..71fe46ac1bd 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,7 +7,7 @@ import Foundation -public struct Client: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Client: Sendable, Codable, ParameterConvertible, Hashable { public var client: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 99231ca03f7..134cc4ad51f 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,7 +7,7 @@ import Foundation -public struct Dog: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Dog: Sendable, Codable, ParameterConvertible, Hashable { public var className: String public var color: String? = "red" diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index 09bbcb9f280..4f7b547df68 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumArrays: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumArrays: Sendable, Codable, ParameterConvertible, Hashable { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index d280112e88b..9472c599e8b 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct EnumTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct EnumTest: Sendable, Codable, ParameterConvertible, Hashable { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift index c35e1b2d53a..2b1d20efb35 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -8,7 +8,7 @@ import Foundation /** Must be named `File` for test. */ -public struct File: Sendable, Codable, QueryStringEncodable, Hashable { +public struct File: Sendable, Codable, ParameterConvertible, Hashable { /** Test capitalization */ public var sourceURI: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 6ca430a91ba..528709b3c7e 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct FileSchemaTestClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FileSchemaTestClass: Sendable, Codable, ParameterConvertible, Hashable { public var file: File? public var files: [File]? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 427b85e7fd9..695d9a44358 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct FormatTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct FormatTest: Sendable, Codable, ParameterConvertible, Hashable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index e5db6255169..850da288bf0 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct HasOnlyReadOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct HasOnlyReadOnly: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var foo: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 75c553df8fc..415ef215291 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,7 +7,7 @@ import Foundation -public struct List: Sendable, Codable, QueryStringEncodable, Hashable { +public struct List: Sendable, Codable, ParameterConvertible, Hashable { public var _123list: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index 8cc06717f31..b373fbe8292 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,7 +7,7 @@ import Foundation -public struct MapTest: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MapTest: Sendable, Codable, ParameterConvertible, Hashable { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 2c7bd6d9c7c..0f667b7668a 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,7 +7,7 @@ import Foundation -public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, QueryStringEncodable, Hashable { +public struct MixedPropertiesAndAdditionalPropertiesClass: Sendable, Codable, ParameterConvertible, Hashable { public var uuid: UUID? public var dateTime: Date? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index 8c5d8c7381c..121c8c7cde1 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name starting with number */ -public struct Model200Response: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Model200Response: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int? public var `class`: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index d0a98e0980b..82bba99bf66 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing model name same as property name */ -public struct Name: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Name: Sendable, Codable, ParameterConvertible, Hashable { public var name: Int public var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index 47d2e318bb5..05bd45180b0 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,7 +7,7 @@ import Foundation -public struct NumberOnly: Sendable, Codable, QueryStringEncodable, Hashable { +public struct NumberOnly: Sendable, Codable, ParameterConvertible, Hashable { public var justNumber: Double? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 6a9ecc5540c..9f2556d6c0e 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,7 +7,7 @@ import Foundation -public struct Order: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Order: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index 0a4d002a2dd..34a4ed7b12e 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,7 +7,7 @@ import Foundation -public struct OuterComposite: Sendable, Codable, QueryStringEncodable, Hashable { +public struct OuterComposite: Sendable, Codable, ParameterConvertible, Hashable { public var myNumber: Double? public var myString: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 302a3052c6e..cd28268b345 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,7 +7,7 @@ import Foundation -public struct Pet: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Pet: Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index 5a06da436f6..5d6c8a6c9cf 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,7 +7,7 @@ import Foundation -public struct ReadOnlyFirst: Sendable, Codable, QueryStringEncodable, Hashable { +public struct ReadOnlyFirst: Sendable, Codable, ParameterConvertible, Hashable { public var bar: String? public var baz: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index 119f1dd597f..c8342a75860 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -8,7 +8,7 @@ import Foundation /** Model for testing reserved words */ -public struct Return: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Return: Sendable, Codable, ParameterConvertible, Hashable { public var `return`: Int? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index 40ad8ff0a05..000b39a8a13 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,7 +7,7 @@ import Foundation -public struct SpecialModelName: Sendable, Codable, QueryStringEncodable, Hashable { +public struct SpecialModelName: Sendable, Codable, ParameterConvertible, Hashable { public var specialPropertyName: Int64? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index 8758ee8b93d..ab00378c228 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,7 +7,7 @@ import Foundation -public struct StringBooleanMap: Sendable, Codable, QueryStringEncodable, Hashable { +public struct StringBooleanMap: Sendable, Codable, ParameterConvertible, Hashable { public enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 7c19767a11f..df5505fc4bc 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,7 +7,7 @@ import Foundation -public struct Tag: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Tag: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var name: String? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift index eaaab729500..459e3c03da4 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderDefault.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderDefault: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderDefault: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String = "what" public var numberItem: Double diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift index bac80c4fcd2..628ca869217 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/TypeHolderExample.swift @@ -7,7 +7,7 @@ import Foundation -public struct TypeHolderExample: Sendable, Codable, QueryStringEncodable, Hashable { +public struct TypeHolderExample: Sendable, Codable, ParameterConvertible, Hashable { public var stringItem: String public var numberItem: Double diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift index e41975d4d66..33fa97c11eb 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,7 +7,7 @@ import Foundation -public struct User: Sendable, Codable, QueryStringEncodable, Hashable { +public struct User: Sendable, Codable, ParameterConvertible, Hashable { public var id: Int64? public var username: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift index 0bbc0a13f9a..157140d7c6d 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/FakeAPI.swift @@ -260,7 +260,7 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": (wrappedValue: query.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "query": (wrappedValue: query.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -379,20 +379,20 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "integer": integer?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int32": int32?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "int64": int64?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "number": number.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "float": float?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "double": double.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "string": string?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "pattern_without_delimiter": patternWithoutDelimiter.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "byte": byte.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "binary": binary?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "date": date?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "dateTime": dateTime?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "password": password?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "callback": callback?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "integer": integer?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int32": int32?.asParameter(codableHelper: apiConfiguration.codableHelper), + "int64": int64?.asParameter(codableHelper: apiConfiguration.codableHelper), + "number": number.asParameter(codableHelper: apiConfiguration.codableHelper), + "float": float?.asParameter(codableHelper: apiConfiguration.codableHelper), + "double": double.asParameter(codableHelper: apiConfiguration.codableHelper), + "string": string?.asParameter(codableHelper: apiConfiguration.codableHelper), + "pattern_without_delimiter": patternWithoutDelimiter.asParameter(codableHelper: apiConfiguration.codableHelper), + "byte": byte.asParameter(codableHelper: apiConfiguration.codableHelper), + "binary": binary?.asParameter(codableHelper: apiConfiguration.codableHelper), + "date": date?.asParameter(codableHelper: apiConfiguration.codableHelper), + "dateTime": dateTime?.asParameter(codableHelper: apiConfiguration.codableHelper), + "password": password?.asParameter(codableHelper: apiConfiguration.codableHelper), + "callback": callback?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -523,8 +523,8 @@ open class FakeAPI { let localVariablePath = "/fake" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "enum_form_string_array": enumFormStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_form_string": enumFormString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_form_string_array": enumFormStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_form_string": enumFormString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -532,16 +532,16 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "enum_query_string_array": (wrappedValue: enumQueryStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_string": (wrappedValue: enumQueryString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_integer": (wrappedValue: enumQueryInteger?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "enum_query_double": (wrappedValue: enumQueryDouble?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string_array": (wrappedValue: enumQueryStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_string": (wrappedValue: enumQueryString?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_integer": (wrappedValue: enumQueryInteger?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "enum_query_double": (wrappedValue: enumQueryDouble?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ "Content-Type": "application/x-www-form-urlencoded", - "enum_header_string_array": enumHeaderStringArray?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "enum_header_string": enumHeaderString?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "enum_header_string_array": enumHeaderStringArray?.asParameter(codableHelper: apiConfiguration.codableHelper), + "enum_header_string": enumHeaderString?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -595,15 +595,15 @@ open class FakeAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "required_string_group": (wrappedValue: requiredStringGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "required_int64_group": (wrappedValue: requiredInt64Group.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "string_group": (wrappedValue: stringGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "int64_group": (wrappedValue: int64Group?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_string_group": (wrappedValue: requiredStringGroup.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "required_int64_group": (wrappedValue: requiredInt64Group.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "string_group": (wrappedValue: stringGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "int64_group": (wrappedValue: int64Group?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "required_boolean_group": requiredBooleanGroup.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "boolean_group": booleanGroup?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "required_boolean_group": requiredBooleanGroup.asParameter(codableHelper: apiConfiguration.codableHelper), + "boolean_group": booleanGroup?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -689,8 +689,8 @@ open class FakeAPI { let localVariablePath = "/fake/jsonFormData" let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "param": param.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "param2": param2.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "param": param.asParameter(codableHelper: apiConfiguration.codableHelper), + "param2": param2.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index 563bd708bf5..ac1b663d3c4 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -104,7 +104,7 @@ open class PetAPI { let localVariableUrlComponents = URLComponents(string: localVariableURLString) let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "api_key": apiKey?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "api_key": apiKey?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) @@ -160,7 +160,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": (wrappedValue: status.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "status": (wrappedValue: status.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -213,7 +213,7 @@ open class PetAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": (wrappedValue: tags.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "tags": (wrappedValue: tags.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ @@ -365,8 +365,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "name": name?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "status": status?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "name": name?.asParameter(codableHelper: apiConfiguration.codableHelper), + "status": status?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -425,8 +425,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "file": file?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "file": file?.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) @@ -485,8 +485,8 @@ open class PetAPI { localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) let localVariableURLString = apiConfiguration.basePath + localVariablePath let localVariableFormParams: [String: (any Sendable)?] = [ - "additionalMetadata": additionalMetadata?.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), - "requiredFile": requiredFile.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), + "additionalMetadata": additionalMetadata?.asParameter(codableHelper: apiConfiguration.codableHelper), + "requiredFile": requiredFile.asParameter(codableHelper: apiConfiguration.codableHelper), ] let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams) diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift index 9cabb7e1ccc..ce2ceaf9254 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/UserAPI.swift @@ -276,8 +276,8 @@ open class UserAPI { var localVariableUrlComponents = URLComponents(string: localVariableURLString) localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": (wrappedValue: username.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), - "password": (wrappedValue: password.encodeToQueryString(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "username": (wrappedValue: username.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), + "password": (wrappedValue: password.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: false), ]) let localVariableNillableHeaders: [String: (any Sendable)?] = [ diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift index 1120f928d7e..fc0b544a05c 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Extensions.swift @@ -9,78 +9,73 @@ import Foundation import FoundationNetworking #endif -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -88,24 +83,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift index 78a06110af5..6e7a6337deb 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Models.swift @@ -9,8 +9,8 @@ import Foundation import FoundationNetworking #endif -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift index ea478acb7d2..aa50640ebd2 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/AdditionalPropertiesClass.swift @@ -12,7 +12,7 @@ public typealias AdditionalPropertiesClass = PetstoreClientAPI.AdditionalPropert extension PetstoreClientAPI { -public final class AdditionalPropertiesClass: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class AdditionalPropertiesClass: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var mapString: [String: String]? public private(set) var mapMapString: [String: [String: String]]? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Animal.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Animal.swift index 357a845d209..f04708b45ff 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Animal.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Animal.swift @@ -12,7 +12,7 @@ public typealias Animal = PetstoreClientAPI.Animal extension PetstoreClientAPI { -public final class Animal: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Animal: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var className: String public private(set) var color: String? = "red" diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ApiResponse.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ApiResponse.swift index 4462e1f2a78..80eaab77886 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ApiResponse.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ApiResponse.swift @@ -12,7 +12,7 @@ public typealias ApiResponse = PetstoreClientAPI.ApiResponse extension PetstoreClientAPI { -public final class ApiResponse: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class ApiResponse: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var code: Int? public private(set) var type: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift index 60b1d85948b..a38e5ab7ed9 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfArrayOfNumberOnly.swift @@ -12,7 +12,7 @@ public typealias ArrayOfArrayOfNumberOnly = PetstoreClientAPI.ArrayOfArrayOfNumb extension PetstoreClientAPI { -public final class ArrayOfArrayOfNumberOnly: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class ArrayOfArrayOfNumberOnly: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var arrayArrayNumber: [[Double]]? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift index 1274fde376f..b815969e002 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayOfNumberOnly.swift @@ -12,7 +12,7 @@ public typealias ArrayOfNumberOnly = PetstoreClientAPI.ArrayOfNumberOnly extension PetstoreClientAPI { -public final class ArrayOfNumberOnly: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class ArrayOfNumberOnly: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var arrayNumber: [Double]? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayTest.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayTest.swift index ff04ef4605c..170a26c5d83 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayTest.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ArrayTest.swift @@ -12,7 +12,7 @@ public typealias ArrayTest = PetstoreClientAPI.ArrayTest extension PetstoreClientAPI { -public final class ArrayTest: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class ArrayTest: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var arrayOfString: [String]? public private(set) var arrayArrayOfInteger: [[Int64]]? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Capitalization.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Capitalization.swift index 5dcd4d60b00..80127924da1 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Capitalization.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Capitalization.swift @@ -12,7 +12,7 @@ public typealias Capitalization = PetstoreClientAPI.Capitalization extension PetstoreClientAPI { -public final class Capitalization: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Capitalization: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var smallCamel: String? public private(set) var capitalCamel: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Cat.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Cat.swift index d45ec288b61..80e6dcf6eaa 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Cat.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Cat.swift @@ -12,7 +12,7 @@ public typealias Cat = PetstoreClientAPI.Cat extension PetstoreClientAPI { -public final class Cat: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Cat: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var className: String public private(set) var color: String? = "red" diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift index e8e40daf46d..c748ccee092 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Category.swift @@ -12,7 +12,7 @@ public typealias Category = PetstoreClientAPI.Category extension PetstoreClientAPI { -public final class Category: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Category: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var id: Int64? public private(set) var name: String? = "default-name" diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ClassModel.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ClassModel.swift index 82ae62fe2c1..b497879780f 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ClassModel.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ClassModel.swift @@ -13,7 +13,7 @@ public typealias ClassModel = PetstoreClientAPI.ClassModel extension PetstoreClientAPI { /** Model for testing model with \"_class\" property */ -public final class ClassModel: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class ClassModel: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var _class: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Client.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Client.swift index 4fa4270370a..e615fda4516 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Client.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Client.swift @@ -12,7 +12,7 @@ public typealias Client = PetstoreClientAPI.Client extension PetstoreClientAPI { -public final class Client: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Client: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var client: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Dog.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Dog.swift index ae9f7646664..765e53e85aa 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Dog.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Dog.swift @@ -12,7 +12,7 @@ public typealias Dog = PetstoreClientAPI.Dog extension PetstoreClientAPI { -public final class Dog: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Dog: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var className: String public private(set) var color: String? = "red" diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/EnumArrays.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/EnumArrays.swift index ed9fe33b381..7f4f501b6b9 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/EnumArrays.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/EnumArrays.swift @@ -12,7 +12,7 @@ public typealias EnumArrays = PetstoreClientAPI.EnumArrays extension PetstoreClientAPI { -public final class EnumArrays: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class EnumArrays: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public enum JustSymbol: String, Sendable, Codable, CaseIterable { case greaterThanOrEqualTo = ">=" diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/EnumTest.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/EnumTest.swift index 9eed072f206..375e78fcb7c 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/EnumTest.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/EnumTest.swift @@ -12,7 +12,7 @@ public typealias EnumTest = PetstoreClientAPI.EnumTest extension PetstoreClientAPI { -public final class EnumTest: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class EnumTest: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public enum EnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/File.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/File.swift index b2988872347..e40d2aeb24a 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/File.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/File.swift @@ -13,7 +13,7 @@ public typealias File = PetstoreClientAPI.File extension PetstoreClientAPI { /** Must be named `File` for test. */ -public final class File: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class File: @unchecked Sendable, Codable, ParameterConvertible, Hashable { /** Test capitalization */ public private(set) var sourceURI: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift index 92f30d1c7e7..7b9f6ba9215 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FileSchemaTestClass.swift @@ -12,7 +12,7 @@ public typealias FileSchemaTestClass = PetstoreClientAPI.FileSchemaTestClass extension PetstoreClientAPI { -public final class FileSchemaTestClass: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class FileSchemaTestClass: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var file: File? public private(set) var files: [File]? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift index 8e7646673a6..68152ec91ac 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -12,7 +12,7 @@ public typealias FormatTest = PetstoreClientAPI.FormatTest extension PetstoreClientAPI { -public final class FormatTest: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class FormatTest: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift index 1837d18b4b8..8ddded67ab4 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/HasOnlyReadOnly.swift @@ -12,7 +12,7 @@ public typealias HasOnlyReadOnly = PetstoreClientAPI.HasOnlyReadOnly extension PetstoreClientAPI { -public final class HasOnlyReadOnly: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class HasOnlyReadOnly: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var bar: String? public private(set) var foo: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/List.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/List.swift index a3c39e02da3..9a16b1c0df9 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/List.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/List.swift @@ -12,7 +12,7 @@ public typealias List = PetstoreClientAPI.List extension PetstoreClientAPI { -public final class List: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class List: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var _123list: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/MapTest.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/MapTest.swift index 7f96dfa358e..6a2ca2b24c7 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/MapTest.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/MapTest.swift @@ -12,7 +12,7 @@ public typealias MapTest = PetstoreClientAPI.MapTest extension PetstoreClientAPI { -public final class MapTest: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class MapTest: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public enum MapOfEnumString: String, Sendable, Codable, CaseIterable { case upper = "UPPER" diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index cc8d77a3afa..79a449a3fe7 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -12,7 +12,7 @@ public typealias MixedPropertiesAndAdditionalPropertiesClass = PetstoreClientAPI extension PetstoreClientAPI { -public final class MixedPropertiesAndAdditionalPropertiesClass: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class MixedPropertiesAndAdditionalPropertiesClass: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var uuid: UUID? public private(set) var dateTime: Date? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Model200Response.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Model200Response.swift index bd6a2b39c63..69d9c6a5704 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Model200Response.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Model200Response.swift @@ -13,7 +13,7 @@ public typealias Model200Response = PetstoreClientAPI.Model200Response extension PetstoreClientAPI { /** Model for testing model name starting with number */ -public final class Model200Response: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Model200Response: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var name: Int? public private(set) var _class: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Name.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Name.swift index b8a7a669253..b4ff9f07cfe 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Name.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Name.swift @@ -13,7 +13,7 @@ public typealias Name = PetstoreClientAPI.Name extension PetstoreClientAPI { /** Model for testing model name same as property name */ -public final class Name: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Name: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var name: Int public private(set) var snakeCase: NullEncodable = .encodeValue(11033) diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/NumberOnly.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/NumberOnly.swift index fa23845da2d..c06012fc352 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/NumberOnly.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/NumberOnly.swift @@ -12,7 +12,7 @@ public typealias NumberOnly = PetstoreClientAPI.NumberOnly extension PetstoreClientAPI { -public final class NumberOnly: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class NumberOnly: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var justNumber: Double? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift index e9bbd2fb12b..9da1fff0982 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Order.swift @@ -12,7 +12,7 @@ public typealias Order = PetstoreClientAPI.Order extension PetstoreClientAPI { -public final class Order: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Order: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case placed = "placed" diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/OuterComposite.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/OuterComposite.swift index eec104a999d..0ec0e340109 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/OuterComposite.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/OuterComposite.swift @@ -12,7 +12,7 @@ public typealias OuterComposite = PetstoreClientAPI.OuterComposite extension PetstoreClientAPI { -public final class OuterComposite: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class OuterComposite: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var myNumber: Double? public private(set) var myString: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift index 6a9383bde10..2753009d4d7 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Pet.swift @@ -12,7 +12,7 @@ public typealias Pet = PetstoreClientAPI.Pet extension PetstoreClientAPI { -public final class Pet: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Pet: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public enum Status: String, Sendable, Codable, CaseIterable { case available = "available" diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift index 647ebd82e19..c6758a39b58 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/ReadOnlyFirst.swift @@ -12,7 +12,7 @@ public typealias ReadOnlyFirst = PetstoreClientAPI.ReadOnlyFirst extension PetstoreClientAPI { -public final class ReadOnlyFirst: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class ReadOnlyFirst: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var bar: String? public private(set) var baz: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Return.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Return.swift index bf05589cea2..396aeb14045 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Return.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Return.swift @@ -13,7 +13,7 @@ public typealias Return = PetstoreClientAPI.Return extension PetstoreClientAPI { /** Model for testing reserved words */ -public final class Return: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Return: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var _return: Int? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift index aaedf5eb82c..1d827bb0a34 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/SpecialModelName.swift @@ -12,7 +12,7 @@ public typealias SpecialModelName = PetstoreClientAPI.SpecialModelName extension PetstoreClientAPI { -public final class SpecialModelName: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class SpecialModelName: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var specialPropertyName: Int64? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift index 18bda640e08..d55e9666847 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/StringBooleanMap.swift @@ -12,7 +12,7 @@ public typealias StringBooleanMap = PetstoreClientAPI.StringBooleanMap extension PetstoreClientAPI { -public final class StringBooleanMap: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class StringBooleanMap: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public enum CodingKeys: CodingKey, CaseIterable { diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift index fe977d0e10f..50c5568ee98 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/Tag.swift @@ -12,7 +12,7 @@ public typealias Tag = PetstoreClientAPI.Tag extension PetstoreClientAPI { -public final class Tag: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class Tag: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var id: Int64? public private(set) var name: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift index f8abdfee088..d7f0dd16ecd 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderDefault.swift @@ -12,7 +12,7 @@ public typealias TypeHolderDefault = PetstoreClientAPI.TypeHolderDefault extension PetstoreClientAPI { -public final class TypeHolderDefault: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class TypeHolderDefault: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var stringItem: String = "what" public private(set) var numberItem: Double diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift index 9020b77e43c..9d77c797537 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/TypeHolderExample.swift @@ -12,7 +12,7 @@ public typealias TypeHolderExample = PetstoreClientAPI.TypeHolderExample extension PetstoreClientAPI { -public final class TypeHolderExample: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class TypeHolderExample: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var stringItem: String public private(set) var numberItem: Double diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift index 7a29f785a4c..94dcce5e71c 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/User.swift @@ -12,7 +12,7 @@ public typealias User = PetstoreClientAPI.User extension PetstoreClientAPI { -public final class User: @unchecked Sendable, Codable, QueryStringEncodable, Hashable { +public final class User: @unchecked Sendable, Codable, ParameterConvertible, Hashable { public private(set) var id: Int64? public private(set) var username: String? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift index e62c0d14fe1..5bb46945abd 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/SwaggerClientTests/SwaggerClientTests/DateFormatTests.swift @@ -27,7 +27,7 @@ class DateFormatTests: XCTestCase { super.tearDown() } - func testencodeToQueryStringAlwaysResultsInUTCEncodedDate() { + func testAsParameterAlwaysResultsInUTCEncodedDate() { var dateComponents = DateComponents() dateComponents.calendar = Calendar(identifier: .gregorian) dateComponents.year = 2018 @@ -47,7 +47,7 @@ class DateFormatTests: XCTestCase { return } - var encodedDate = utcDate.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String + var encodedDate = utcDate.asParameter(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a positive timzone offset from UTC @@ -59,7 +59,7 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate1.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String + encodedDate = nonUTCDate1.asParameter(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) // test with a negative timzone offset from UTC @@ -71,7 +71,7 @@ class DateFormatTests: XCTestCase { return } - encodedDate = nonUTCDate2.encodeToQueryString(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String + encodedDate = nonUTCDate2.asParameter(codableHelper: PetstoreClientAPIConfiguration.shared.codableHelper) as! String XCTAssert(encodedDate.hasSuffix("Z")) } diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift index 1120f928d7e..fc0b544a05c 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Extensions.swift @@ -9,78 +9,73 @@ import Foundation import FoundationNetworking #endif -extension QueryStringEncodable { - @_disfavoredOverload - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Bool: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Bool: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Float: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Float: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int32: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int32: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Int64: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Int64: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Double: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Double: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension Decimal: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension Decimal: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension String: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension String: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension URL: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension URL: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension UUID: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { self } } -extension UUID: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: self) } +extension RawRepresentable where RawValue: ParameterConvertible, RawValue: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.rawValue } } -extension RawRepresentable where RawValue: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { String(describing: rawValue) } -} - -private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> String { - if let encodableObject = object as? QueryStringEncodable { - return encodableObject.encodeToQueryString(codableHelper: codableHelper) +private func encodeIfPossible(_ object: T, codableHelper: CodableHelper) -> any Sendable { + if let encodableObject = object as? ParameterConvertible { + return encodableObject.asParameter(codableHelper: codableHelper) } else { - return String(describing: object) + return object } } -extension Array { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { +extension Array where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.map { encodeIfPossible($0, codableHelper: codableHelper) } } } -extension Set { - func encodeToQueryString(codableHelper: CodableHelper) -> [String] { - return Array(self).encodeToQueryString(codableHelper: codableHelper) +extension Set where Element: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + return Array(self).asParameter(codableHelper: codableHelper) } } -extension Dictionary { - func encodeToQueryString(codableHelper: CodableHelper) -> [Key: String] { - var dictionary = [Key: String]() +extension Dictionary where Key: Sendable, Value: Sendable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { + var dictionary = [Key: any Sendable]() for (key, value) in self { dictionary[key] = encodeIfPossible(value, codableHelper: codableHelper) } @@ -88,24 +83,24 @@ extension Dictionary { } } -extension Data: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Data: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return self.base64EncodedString(options: Data.Base64EncodingOptions()) } } -extension Date: QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension Date: ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable { return codableHelper.dateFormatter.string(from: self) } } -extension QueryStringEncodable where Self: Encodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String { +extension ParameterConvertible where Self: Encodable { + func asParameter(codableHelper: CodableHelper) -> any Sendable { guard let data = try? codableHelper.jsonEncoder.encode(self) else { fatalError("Could not encode to json: \(self)") } - return data.encodeToQueryString(codableHelper: codableHelper) + return data.asParameter(codableHelper: codableHelper) } } diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift index 78a06110af5..6e7a6337deb 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Models.swift @@ -9,8 +9,8 @@ import Foundation import FoundationNetworking #endif -protocol QueryStringEncodable { - func encodeToQueryString(codableHelper: CodableHelper) -> String +protocol ParameterConvertible { + func asParameter(codableHelper: CodableHelper) -> any Sendable } /// An enum where the last case value can be used as a default catch-all. diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift index 81ddce1c41e..b381f6ed1a3 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift @@ -7,7 +7,7 @@ import Foundation -public struct Banana: Sendable, Codable, QueryStringEncodable, Hashable { +public struct Banana: Sendable, Codable, ParameterConvertible, Hashable { public static let countRule = NumericRule(minimum: 10, exclusiveMinimum: true, maximum: 100, exclusiveMaximum: true, multipleOf: 5) public static let idsRule = ArrayRule(minItems: 1, maxItems: 10, uniqueItems: false)