Unverified Commit 2bb969f8 authored by Matteo Bigoi's avatar Matteo Bigoi Committed by GitHub
Browse files

[Python] Ensure we generate correct string literals in Python unions (#2478)

* Make sure string literals are valid

* Remove raw string marker

* Remove jsonrpc model

* Add commented JsonRPC1.0 model
parent bebc58ac
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -54,6 +54,14 @@ val allCodegenTests = "../../codegen-core/common-test-models".let { commonModels
            // TODO(https://github.com/awslabs/smithy-rs/issues/1401) `@uniqueItems` is used.
            extraConfig = """, "codegen": { "ignoreUnsupportedConstraints": true } """,
        ),
        // TODO(https://github.com/awslabs/smithy-rs/issues/2476)
        // CodegenTest(
        //     "aws.protocoltests.json#JsonProtocol",
        //     "json_rpc11",
        //     extraConfig = """, "codegen": { "ignoreUnsupportedConstraints": true } """,
        // ),
        // TODO(https://github.com/awslabs/smithy-rs/issues/2479)
        // CodegenTest("aws.protocoltests.json10#JsonRpc10", "json_rpc10"),
    )
}

+1 −1
Original line number Diff line number Diff line
@@ -186,7 +186,7 @@ class PythonServerUnionGenerator(
                    match self.0.as_$funcNamePart() {
                        Ok(variant) => Ok($variantType),
                        Err(_) => Err(#{pyo3}::exceptions::PyValueError::new_err(
                            "${unionSymbol.name} variant is not of type ${memberSymbol.rustType().pythonType().renderAsDocstring()}"
                            r"${unionSymbol.name} variant is not of type ${memberSymbol.rustType().pythonType().renderAsDocstring()}"
                        )),
                    }
                    """,