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

Support aws.protocoltests.json10#JsonRpc10 #2479

Closed
Tracked by #1367
crisidev opened this issue Mar 21, 2023 · 0 comments · Fixed by #2501 or #2541
Closed
Tracked by #1367

Support aws.protocoltests.json10#JsonRpc10 #2479

crisidev opened this issue Mar 21, 2023 · 0 comments · Fixed by #2501 or #2541
Assignees
Labels
bug Something isn't working python-server Python server SDK

Comments

@crisidev
Copy link
Contributor

crisidev commented Mar 21, 2023

To support this model we need:

  • Properly cast BlobShape inside constrained unions:
diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGenerator.kt
index dd7255e47..2389fc89c 100644
--- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGenerator.kt
+++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/parse/JsonParserGenerator.kt
@@ -276,7 +276,7 @@ class JsonParserGenerator(
             is StringShape -> deserializeString(target)
             is BooleanShape -> rustTemplate("#{expect_bool_or_null}(tokens.next())?", *codegenScope)
             is NumberShape -> deserializeNumber(target)
-            is BlobShape -> deserializeBlob()
+            is BlobShape -> deserializeBlob(target)
             is TimestampShape -> deserializeTimestamp(target, memberShape)
             is CollectionShape -> deserializeCollection(target)
             is MapShape -> deserializeMap(target)
@@ -294,9 +294,10 @@ class JsonParserGenerator(
         }
     }
 
-    private fun RustWriter.deserializeBlob() {
+    private fun RustWriter.deserializeBlob(target: BlobShape) {
         rustTemplate(
-            "#{expect_blob_or_null}(tokens.next())?",
+            "#{expect_blob_or_null}(tokens.next())?#{ConvertFrom:W}",
+            "ConvertFrom" to typeConversionGenerator.convertViaFrom(target),
             *codegenScope,
         )
     }
  • Disable generation of protocol tests until we can fully support them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python-server Python server SDK
Projects
None yet
1 participant