Unverified Commit 2f4bc337 authored by 82marbag's avatar 82marbag Committed by GitHub
Browse files

Dense maps cannot deserialize null values (#2239)



* Dense maps cannot deserialize null values

Signed-off-by: default avatarDaniele Ahmed <ahmeddan@amazon.de>
parent 4257a188
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -436,8 +436,24 @@ class JsonParserGenerator(
                        if (isSparse) {
                            rust("map.insert(key, value);")
                        } else {
                            rustBlock("if let Some(value) = value") {
                                rust("map.insert(key, value);")
                            codegenTarget.ifServer {
                                rustTemplate(
                                    """
                                    match value {
                                        Some(value) => { map.insert(key, value); }
                                        None => return Err(#{Error}::custom("dense map cannot contain null values"))
                                            }""",
                                    *codegenScope,
                                )
                            }
                            codegenTarget.ifClient {
                                rustTemplate(
                                    """
                                    if let Some(value) = value {
                                        map.insert(key, value);
                                    }
                                    """,
                                )
                            }
                        }
                    }
+0 −1
Original line number Diff line number Diff line
@@ -774,7 +774,6 @@ class ServerProtocolTestGenerator(

            FailingTest(RestJson, "RestJsonWithBodyExpectsApplicationJsonContentType", TestType.MalformedRequest),
            FailingTest(RestJson, "RestJsonBodyMalformedListNullItem", TestType.MalformedRequest),
            FailingTest(RestJson, "RestJsonBodyMalformedMapNullValue", TestType.MalformedRequest),

            // Deprioritized, sets don't exist in Smithy 2.0.
            // They have the exact same semantics as list shapes with `@uniqueItems`,