forked from loafle/openapi-generator-original
[swift5][client] fix non public visibility modifier for NullEncodable (#11903)
* [swift5][client] fix non public visibility modifier for NullEncodable * [swift5][client] fix non public visibility modifier for NullEncodable
This commit is contained in:
parent
3b7ea5ca53
commit
8e68ff71c4
@ -35,14 +35,14 @@ extension CaseIterableDefaultsLast {
|
|||||||
|
|
||||||
/// A flexible type that can be encoded (`.encodeNull` or `.encodeValue`)
|
/// A flexible type that can be encoded (`.encodeNull` or `.encodeValue`)
|
||||||
/// or not encoded (`.encodeNothing`). Intended for request payloads.
|
/// or not encoded (`.encodeNothing`). Intended for request payloads.
|
||||||
public enum NullEncodable<Wrapped: Hashable>: Hashable {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} enum NullEncodable<Wrapped: Hashable>: Hashable {
|
||||||
case encodeNothing
|
case encodeNothing
|
||||||
case encodeNull
|
case encodeNull
|
||||||
case encodeValue(Wrapped)
|
case encodeValue(Wrapped)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension NullEncodable: Codable where Wrapped: Codable {
|
extension NullEncodable: Codable where Wrapped: Codable {
|
||||||
public init(from decoder: Decoder) throws {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.singleValueContainer()
|
let container = try decoder.singleValueContainer()
|
||||||
if let value = try? container.decode(Wrapped.self) {
|
if let value = try? container.decode(Wrapped.self) {
|
||||||
self = .encodeValue(value)
|
self = .encodeValue(value)
|
||||||
@ -53,7 +53,7 @@ extension NullEncodable: Codable where Wrapped: Codable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.singleValueContainer()
|
var container = encoder.singleValueContainer()
|
||||||
switch self {
|
switch self {
|
||||||
case .encodeNothing: return
|
case .encodeNothing: return
|
||||||
|
@ -34,14 +34,14 @@ extension CaseIterableDefaultsLast {
|
|||||||
|
|
||||||
/// A flexible type that can be encoded (`.encodeNull` or `.encodeValue`)
|
/// A flexible type that can be encoded (`.encodeNull` or `.encodeValue`)
|
||||||
/// or not encoded (`.encodeNothing`). Intended for request payloads.
|
/// or not encoded (`.encodeNothing`). Intended for request payloads.
|
||||||
public enum NullEncodable<Wrapped: Hashable>: Hashable {
|
internal enum NullEncodable<Wrapped: Hashable>: Hashable {
|
||||||
case encodeNothing
|
case encodeNothing
|
||||||
case encodeNull
|
case encodeNull
|
||||||
case encodeValue(Wrapped)
|
case encodeValue(Wrapped)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension NullEncodable: Codable where Wrapped: Codable {
|
extension NullEncodable: Codable where Wrapped: Codable {
|
||||||
public init(from decoder: Decoder) throws {
|
internal init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.singleValueContainer()
|
let container = try decoder.singleValueContainer()
|
||||||
if let value = try? container.decode(Wrapped.self) {
|
if let value = try? container.decode(Wrapped.self) {
|
||||||
self = .encodeValue(value)
|
self = .encodeValue(value)
|
||||||
@ -52,7 +52,7 @@ extension NullEncodable: Codable where Wrapped: Codable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
internal func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.singleValueContainer()
|
var container = encoder.singleValueContainer()
|
||||||
switch self {
|
switch self {
|
||||||
case .encodeNothing: return
|
case .encodeNothing: return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user