From c03cf178c908209cdfac55be03146206f1b7494c Mon Sep 17 00:00:00 2001 From: Bruno Coelho <4brunu@users.noreply.github.com> Date: Sat, 23 Jul 2022 01:39:34 +0100 Subject: [PATCH] [swift][client] reduce unnecessary public api (#12975) * [swift][client] reduce unnecessary public api * [swift][client] reduce unnecessary public api --- .../openapi-generator/src/main/resources/swift5/Models.mustache | 2 +- .../nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift5/Models.mustache b/modules/openapi-generator/src/main/resources/swift5/Models.mustache index dc69d0c0b45..989103d11f7 100644 --- a/modules/openapi-generator/src/main/resources/swift5/Models.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/Models.mustache @@ -19,7 +19,7 @@ extension CaseIterableDefaultsLast { /// Initializes an enum such that if a known raw value is found, then it is decoded. /// Otherwise the last case is used. /// - Parameter decoder: A decoder. - public init(from decoder: Decoder) throws { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(from decoder: Decoder) throws { if let value = try Self(rawValue: decoder.singleValueContainer().decode(RawValue.self)) { self = value } else if let lastValue = Self.allCases.last { diff --git a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift index 356d9c7454e..e7032122ba7 100644 --- a/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift5/nonPublicApi/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -18,7 +18,7 @@ extension CaseIterableDefaultsLast { /// Initializes an enum such that if a known raw value is found, then it is decoded. /// Otherwise the last case is used. /// - Parameter decoder: A decoder. - public init(from decoder: Decoder) throws { + internal init(from decoder: Decoder) throws { if let value = try Self(rawValue: decoder.singleValueContainer().decode(RawValue.self)) { self = value } else if let lastValue = Self.allCases.last {