-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[swift5] fixes a bug encoding/decoding decimal #13589
Conversation
@@ -147,6 +147,17 @@ extension KeyedEncodingContainerProtocol { | |||
} | |||
} | |||
|
|||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encode(_ value: Decimal, forKey key: Self.Key) throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Feuerwerk can you please fix the indentation here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, yes. Weird, i copied the indentations from the existing lines to match exactly the style. I will have a look.
try encode(stringValue, forKey: key) | ||
} | ||
|
||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encodeIfPresent(_ value: Decimal?, forKey key: Self.Key) throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Feuerwerk can you please fix the indentation here?
@@ -186,6 +197,28 @@ extension KeyedDecodingContainerProtocol { | |||
return map | |||
} | |||
|
|||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func decode(_ type: Decimal.Type, forKey key: Self.Key) throws -> Decimal { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Feuerwerk can you please fix the indentation here?
return decimalValue | ||
} | ||
|
||
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} func decodeIfPresent(_ type: Decimal.Type, forKey key: Self.Key) throws -> Decimal? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Feuerwerk can you please fix the indentation here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
@jgavris @ehyche @Edubits @jaz-ah @4brunu
Fixes the bug described in #13410
Tested with OpenAPI generator 6.2.1-snapshot and a Swift Client on iOS 14.7
All 3 commands (mvnw clean package, generate-samples.sh, export_docs_generators.sh) ran successfully.