Skip to content
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

Merged
merged 2 commits into from
Oct 5, 2022

Conversation

Feuerwerk
Copy link
Contributor

@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.

@@ -147,6 +147,17 @@ extension KeyedEncodingContainerProtocol {
}
}

{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} mutating func encode(_ value: Decimal, forKey key: Self.Key) throws {
Copy link
Contributor

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?

Copy link
Contributor Author

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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? {
Copy link
Contributor

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?

Copy link
Contributor

@4brunu 4brunu left a 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 👍

@4brunu 4brunu merged commit 8b10dc3 into OpenAPITools:master Oct 5, 2022
@Feuerwerk Feuerwerk deleted the swift-decimal-coding branch October 5, 2022 12:41
@wing328 wing328 added this to the 6.2.1 milestone Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants