-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add default trait support (#803)
* Add default value handling to SwiftSymbolProvider. * Add default value handling for generating expected body when generating expected HTTP response in protocol tests. * Add more comprehensive default value handling for deserialization, also add error correction for server failing to send a required value in response by filling with zero or zero-equivalents. * Modify ShapeExt::defaultValue logic to handle an optional value having a default value. * Handle edgecase where floating point value has integer default value given in trait. * Provide zero-equivalent error correction default value for enums by using .sdkUnknown case. * Handle JSON number value equality with loosened restriction (JSON handles 2 and 2.0 the same, as numbers) * Add enum trait handling * Fix enum case name codegen for default value * Fix int enum value handling & address future Swift 6 error warning by using Foundation.Data() to convert string to data. Use symbol's property bag to set flag for importing Data outside of SwiftSymbolProvider. * Refactor blob and document shape type default value codegen to reduce duplication. * Use flag for importing Foundation.Data set by SwiftSymbolProvider (when handling blob shape) and add import. * Ktlint * Refactor to use when{} as expression; return no default value instead of throwing error in MemberShapeDecodeGenerator for null node case. * ktlint * Address PR comments * Address PR comments * Address PR comment * Use closure to handle dependency import for the default value resolved by SwiftSymbolProvider at a later time when the resolved symbol gets used by SwiftWriter. Also, fix timestamp value handling and add logic for date-time case as well. * ktlint --------- Co-authored-by: Sichan Yoo <chanyoo@amazon.com>
- Loading branch information
Showing
8 changed files
with
351 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.