diff --git a/codegen/aws/core/src/test/java/software/amazon/smithy/python/aws/codegen/MarkdownToRstDocConverterTest.java b/codegen/aws/core/src/test/java/software/amazon/smithy/python/aws/codegen/MarkdownToRstDocConverterTest.java index 5b58ecc66..8f4a7bd73 100644 --- a/codegen/aws/core/src/test/java/software/amazon/smithy/python/aws/codegen/MarkdownToRstDocConverterTest.java +++ b/codegen/aws/core/src/test/java/software/amazon/smithy/python/aws/codegen/MarkdownToRstDocConverterTest.java @@ -106,4 +106,13 @@ public void testConvertCommonmarkToRstWithNestedList() { String result = markdownToRstDocConverter.convertCommonmarkToRst(html); assertEquals(expected, result.trim()); } + + @Test + public void testConvertCommonmarkToRstWithFormatSpecifierCharacters() { + // Test that Smithy format specifier characters ($) are properly escaped and treated as literal text + String html = "
Testing $placeholder_one and $placeholder_two
"; + String expected = "Testing $placeholder_one and $placeholder_two"; + String result = markdownToRstDocConverter.convertCommonmarkToRst(html); + assertEquals(expected, result.trim()); + } } diff --git a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/ClientGenerator.java b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/ClientGenerator.java index e5e3b72d0..026e4dfe2 100644 --- a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/ClientGenerator.java +++ b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/ClientGenerator.java @@ -131,7 +131,6 @@ private void generateOperation(PythonWriter writer, OperationShape operation) { var outputSymbol = symbolProvider.toSymbol(output); writer.pushState(new OperationSection(service, operation)); - writer.addStdlibImport("copy", "deepcopy"); writer.putContext("input", inputSymbol); writer.putContext("output", outputSymbol); writer.putContext("plugin", pluginSymbol); @@ -189,6 +188,7 @@ private void writeSharedOperationInit(PythonWriter writer, OperationShape operat writer.addImport("smithy_core.types", "TypedProperties"); writer.addImport("smithy_core.aio.client", "RequestPipeline"); writer.addImport("smithy_core.exceptions", "ExpectationNotMetError"); + writer.addStdlibImport("copy", "deepcopy"); writer.write(""" operation_plugins: list[Plugin] = [ diff --git a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/StructureGenerator.java b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/StructureGenerator.java index 492e032a9..1cfa9c2cf 100644 --- a/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/StructureGenerator.java +++ b/codegen/core/src/main/java/software/amazon/smithy/python/codegen/generators/StructureGenerator.java @@ -421,8 +421,9 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None: } private void deserializeMembers(Collectiondocs //
). Since we standardize to html above, thattag @@ -91,16 +91,16 @@ public void head(Node node, int depth) { } else { writer.ensureNewline(); writer.indent(); - writer.write(text.substring(secondColonIndex + 1)); + writer.write("$L", text.substring(secondColonIndex + 1)); writer.dedent(); } } else { - writer.writeInline(text); + writer.writeInline("$L", text); } // Account for services making a paragraph tag that's empty except // for a newline } else if (node.parent() != null && ((Element) node.parent()).tagName().equals("p")) { - writer.writeInline(text.replaceAll("[ \\t]+", "")); + writer.writeInline("$L", text.replaceAll("[ \\t]+", "")); } } else if (node instanceof Element) { Element element = (Element) node; @@ -158,7 +158,7 @@ public void tail(Node node, int depth) { case "a": String href = element.attr("href"); if (!href.isEmpty()) { - writer.writeInline(" <").writeInline(href).writeInline(">`_"); + writer.writeInline(" <").writeInline("$L", href).writeInline(">`_"); } else { writer.writeInline("`"); } @@ -196,7 +196,7 @@ public void tail(Node node, int depth) { break; case "h1": String title = element.text(); - writer.ensureNewline().writeInline("=".repeat(title.length())).ensureNewline(); + writer.ensureNewline().writeInline("$L", "=".repeat(title.length())).ensureNewline(); break; default: break; diff --git a/codegen/gradle/libs.versions.toml b/codegen/gradle/libs.versions.toml index 4140d53a8..e28c67c7b 100644 --- a/codegen/gradle/libs.versions.toml +++ b/codegen/gradle/libs.versions.toml @@ -1,11 +1,11 @@ [versions] junit5 = "6.0.0" -smithy = "1.62.0" +smithy = "1.63.0" test-logger-plugin = "4.0.0" spotbugs = "6.0.22" spotless = "8.0.0" smithy-gradle-plugins = "1.3.0" -dep-analysis = "3.1.0" +dep-analysis = "3.4.0" jsoup = "1.21.2" commonmark = "0.17.0" diff --git a/packages/smithy-core/.changes/0.1.1.json b/packages/smithy-core/.changes/0.1.1.json new file mode 100644 index 000000000..26b622533 --- /dev/null +++ b/packages/smithy-core/.changes/0.1.1.json @@ -0,0 +1,8 @@ +{ + "changes": [ + { + "type": "bugfix", + "description": "Fix incorrect header casing for the shape id of eventHeaders." + } + ] +} \ No newline at end of file diff --git a/packages/smithy-core/CHANGELOG.md b/packages/smithy-core/CHANGELOG.md index 0d6e4e72c..52eb36e50 100644 --- a/packages/smithy-core/CHANGELOG.md +++ b/packages/smithy-core/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v0.1.1 + +### Bug fixes +* Fix incorrect header casing for the shape id of eventHeaders. + ## v0.1.0 ### Breaking Changes diff --git a/packages/smithy-core/src/smithy_core/__init__.py b/packages/smithy-core/src/smithy_core/__init__.py index a9e14aff3..2cf04d6ff 100644 --- a/packages/smithy-core/src/smithy_core/__init__.py +++ b/packages/smithy-core/src/smithy_core/__init__.py @@ -8,7 +8,7 @@ from . import interfaces, rfc3986 from .exceptions import SmithyError -__version__ = "0.1.0" +__version__ = "0.1.1" class HostType(Enum): diff --git a/packages/smithy-core/src/smithy_core/traits.py b/packages/smithy-core/src/smithy_core/traits.py index fe3803e51..d7dfd22cf 100644 --- a/packages/smithy-core/src/smithy_core/traits.py +++ b/packages/smithy-core/src/smithy_core/traits.py @@ -179,7 +179,7 @@ def value(self) -> str: @dataclass(init=False, frozen=True) -class EventHeaderTrait(Trait, id=ShapeID("smithy.api#eventheader")): +class EventHeaderTrait(Trait, id=ShapeID("smithy.api#eventHeader")): def __post_init__(self): assert self.document_value is None diff --git a/packages/smithy-http/.changes/0.2.1.json b/packages/smithy-http/.changes/0.2.1.json new file mode 100644 index 000000000..c9baceda0 --- /dev/null +++ b/packages/smithy-http/.changes/0.2.1.json @@ -0,0 +1,8 @@ +{ + "changes": [ + { + "type": "bugfix", + "description": "Add port to CRT HTTP client's host header." + } + ] +} \ No newline at end of file diff --git a/packages/smithy-http/CHANGELOG.md b/packages/smithy-http/CHANGELOG.md index f122c3d2e..052989523 100644 --- a/packages/smithy-http/CHANGELOG.md +++ b/packages/smithy-http/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v0.2.1 + +### Bug fixes +* Add port to CRT HTTP client's host header. + ## v0.2.0 ### Breaking Changes diff --git a/packages/smithy-http/src/smithy_http/__init__.py b/packages/smithy-http/src/smithy_http/__init__.py index bdd5efda3..c4ff55b44 100644 --- a/packages/smithy-http/src/smithy_http/__init__.py +++ b/packages/smithy-http/src/smithy_http/__init__.py @@ -6,7 +6,7 @@ from . import interfaces from .interfaces import FieldPosition -__version__ = "0.2.0" +__version__ = "0.2.1" class Field(interfaces.Field): diff --git a/packages/smithy-http/src/smithy_http/aio/crt.py b/packages/smithy-http/src/smithy_http/aio/crt.py index 4dd3232b4..a450ef9c9 100644 --- a/packages/smithy-http/src/smithy_http/aio/crt.py +++ b/packages/smithy-http/src/smithy_http/aio/crt.py @@ -273,7 +273,7 @@ def _marshal_request( headers_list: list[tuple[str, str]] = [] if "host" not in request.fields: request.fields.set_field( - Field(name="host", values=[request.destination.host]) + Field(name="host", values=[request.destination.netloc]) ) if "accept" not in request.fields: diff --git a/packages/smithy-http/tests/unit/aio/test_crt.py b/packages/smithy-http/tests/unit/aio/test_crt.py index 5b9e851e1..886bb5f2d 100644 --- a/packages/smithy-http/tests/unit/aio/test_crt.py +++ b/packages/smithy-http/tests/unit/aio/test_crt.py @@ -45,6 +45,27 @@ def test_client_marshal_request() -> None: assert crt_request.path == "/path?key1=value1&key2=value2" +@pytest.mark.parametrize( + "host,expected", + [ + ("example.com", "example.com:8443"), + ("2001:db8::1", "[2001:db8::1]:8443"), + ], +) +async def test_port_included_in_host_header(host: str, expected: str) -> None: + client = AWSCRTHTTPClient() + request = HTTPRequest( + method="GET", + destination=URI( + host=host, path="/path", query="key1=value1&key2=value2", port=8443 + ), + body=BytesIO(), + fields=Fields(), + ) + crt_request = client._marshal_request(request) # type: ignore + assert crt_request.headers.get("host") == expected # type: ignore + + async def test_body_generator_bytes() -> None: """Test body generator with bytes input.""" client = AWSCRTHTTPClient()