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

Codegenerate Python application example and add explicit cast during JSON deserialization #1520

Merged
merged 10 commits into from
Jul 26, 2022

Conversation

crisidev
Copy link
Contributor

@crisidev crisidev commented Jun 30, 2022

Motivation

See #1367.

Description

  • Explicitly call from complex types in JSON deserialization if the shape has been overriden by the symbol provider.
  • Codegenerate Python application example.

Checklist

  • I have updated CHANGELOG.next.toml if I made changes to the smithy-rs codegen or runtime crates
  • I have updated CHANGELOG.next.toml if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

… types in JSON deserialization if the shape has been overriden by the symbol provider
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@crisidev crisidev changed the title Codegenerate Python application example. Codegenerate Python application example and add explicit cast during JSON deserialization Jul 6, 2022
@github-actions
Copy link

github-actions bot commented Jul 6, 2022

A new generated diff is ready to view.

A new doc preview is ready to view.

@crisidev
Copy link
Contributor Author

crisidev commented Jul 6, 2022

Example:

image

@crisidev crisidev marked this pull request as ready for review July 6, 2022 13:02
@crisidev crisidev requested a review from a team as a code owner July 6, 2022 13:02
@crisidev crisidev requested a review from a team July 6, 2022 13:02
@github-actions
Copy link

github-actions bot commented Jul 6, 2022

A new generated diff is ready to view.

A new doc preview is ready to view.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@crisidev crisidev added enhancement New feature or request server Rust server SDK needs-sdk-review labels Jul 13, 2022
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link
Collaborator

@jdisanti jdisanti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good to me. Just a few suggestions on ParserUtil.

* with wrappers compatibile with Python, without touching the original implementation coming from `aws-smithy-types`.
*/
class ParserUtil(private val symbolProvider: RustSymbolProvider, private val runtimeConfig: RuntimeConfig) {
fun convertViaFrom(shape: Shape): Writable =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How this is written now assumes the conversion will always be a .something() suffix, which may not always be the case. I think this would be a lot more flexible if it took a String or Writable as an argument that represents the value/expression being converted, and then places that in the correct place itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I understand properly what you are suggesting here...

What do you mean with expect .something() to always exists?

I thought that passing a shape and adding the suffix to it in case it differs from the original shape was the most general way of achieving this.

Can you expand a little on your proposal?

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@crisidev crisidev enabled auto-merge (squash) July 26, 2022 15:15
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@crisidev crisidev merged commit c7b97dc into main Jul 26, 2022
@crisidev crisidev deleted the crisidev/oxipy-json-from branch July 26, 2022 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request server Rust server SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants