diff --git a/Sources/_OpenAPIGeneratorCore/FeatureFlags.swift b/Sources/_OpenAPIGeneratorCore/FeatureFlags.swift index af260da3..ca3d5682 100644 --- a/Sources/_OpenAPIGeneratorCore/FeatureFlags.swift +++ b/Sources/_OpenAPIGeneratorCore/FeatureFlags.swift @@ -28,11 +28,6 @@ public enum FeatureFlag: String, Hashable, Codable, CaseIterable, Sendable { // needs to be here for the enum to compile case empty - - /// Base64 encoding and decoding. - /// - /// Enable interpretation of `type: string, format: byte` as base64-encoded data. - case base64DataEncodingDecoding } /// A set of enabled feature flags. diff --git a/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeAssigner.swift b/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeAssigner.swift index 093caeaf..72e18f8a 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeAssigner.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeAssigner.swift @@ -45,9 +45,6 @@ struct TypeAssigner { /// safe to be used as a Swift identifier. var asSwiftSafeName: (String) -> String - ///Enable decoding and encoding of as base64-encoded data strings. - var enableBase64EncodingDecoding: Bool - /// Returns a type name for an OpenAPI-named component type. /// /// A component type is any type in `#/components` in the OpenAPI document. @@ -331,10 +328,7 @@ struct TypeAssigner { inParent parent: TypeName, subtype: SubtypeNamingMethod ) throws -> TypeUsage { - let typeMatcher = TypeMatcher( - asSwiftSafeName: asSwiftSafeName, - enableBase64EncodingDecoding: enableBase64EncodingDecoding - ) + let typeMatcher = TypeMatcher(asSwiftSafeName: asSwiftSafeName) // Check if this type can be simply referenced without // creating a new inline type. if let referenceableType = try typeMatcher.tryMatchReferenceableType(for: schema, components: components) { @@ -551,20 +545,10 @@ struct TypeAssigner { extension FileTranslator { /// A configured type assigner. - var typeAssigner: TypeAssigner { - TypeAssigner( - asSwiftSafeName: swiftSafeName, - enableBase64EncodingDecoding: config.featureFlags.contains(.base64DataEncodingDecoding) - ) - } + var typeAssigner: TypeAssigner { TypeAssigner(asSwiftSafeName: swiftSafeName) } /// A configured type matcher. - var typeMatcher: TypeMatcher { - TypeMatcher( - asSwiftSafeName: swiftSafeName, - enableBase64EncodingDecoding: config.featureFlags.contains(.base64DataEncodingDecoding) - ) - } + var typeMatcher: TypeMatcher { TypeMatcher(asSwiftSafeName: swiftSafeName) } } /// An error used during the parsing of JSON references specified in an diff --git a/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeMatcher.swift b/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeMatcher.swift index e4116293..00f88483 100644 --- a/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeMatcher.swift +++ b/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeMatcher.swift @@ -20,9 +20,6 @@ struct TypeMatcher { /// safe to be used as a Swift identifier. var asSwiftSafeName: (String) -> String - ///Enable decoding and encoding of as base64-encoded data strings. - var enableBase64EncodingDecoding: Bool - /// Returns the type name of a built-in type that matches the specified /// schema. /// @@ -72,11 +69,7 @@ struct TypeMatcher { test: { (schema) -> TypeUsage? in if let builtinType = Self._tryMatchBuiltinNonRecursive(for: schema) { return builtinType } guard case let .reference(ref, _) = schema else { return nil } - return try TypeAssigner( - asSwiftSafeName: asSwiftSafeName, - enableBase64EncodingDecoding: enableBase64EncodingDecoding - ) - .typeName(for: ref).asUsage + return try TypeAssigner(asSwiftSafeName: asSwiftSafeName).typeName(for: ref).asUsage }, matchedArrayHandler: { elementType in elementType.asArray }, genericArrayHandler: { TypeName.arrayContainer.asUsage } diff --git a/Tests/OpenAPIGeneratorReferenceTests/SnippetBasedReferenceTests.swift b/Tests/OpenAPIGeneratorReferenceTests/SnippetBasedReferenceTests.swift index 94f45a7a..f41ce52a 100644 --- a/Tests/OpenAPIGeneratorReferenceTests/SnippetBasedReferenceTests.swift +++ b/Tests/OpenAPIGeneratorReferenceTests/SnippetBasedReferenceTests.swift @@ -4671,7 +4671,6 @@ final class SnippetBasedReferenceTests: XCTestCase { func testResponseWithExampleWithOnlyValueByte() throws { try self.assertResponsesTranslation( - featureFlags: [.base64DataEncodingDecoding], """ responses: MyResponse: