forked from loafle/openapi-generator-original
[swift5] Fix Xcode 16 compilation crash with Extensions.swift generation (#19564)
* Update Extensions template for Swift5 generation * update samples
This commit is contained in:
parent
1658264261
commit
0e763b096e
@ -155,9 +155,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
internal mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
internal mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -154,9 +154,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -59,9 +59,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
@ -153,9 +153,12 @@ extension KeyedEncodingContainerProtocol {
|
||||
}
|
||||
|
||||
public mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
|
||||
var mutableValue = value
|
||||
let stringValue = NSDecimalString(&mutableValue, Locale(identifier: "en_US"))
|
||||
try encode(stringValue, forKey: key)
|
||||
let decimalNumber = NSDecimalNumber(decimal: value)
|
||||
let numberFormatter = NumberFormatter()
|
||||
numberFormatter.numberStyle = .decimal
|
||||
numberFormatter.locale = Locale(identifier: "en_US")
|
||||
let formattedString = numberFormatter.string(from: decimalNumber) ?? "\(value)"
|
||||
try encode(formattedString, forKey: key)
|
||||
}
|
||||
|
||||
public mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws {
|
||||
|
Loading…
x
Reference in New Issue
Block a user