Skip to content

Commit e5690f0

Browse files
authored
Add Missing Dependencies In Codegen (#557)
* Add optional 'json' dependency in smithy-aws-core. * Include optional dependencies on 'eventstream' and 'json' for smithy-aws-core when necessary
1 parent c973cbb commit e5690f0

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

codegen/core/src/main/java/software/amazon/smithy/python/codegen/ClientGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ raise ExpectationNotMetError("protocol and transport MUST be set on the config t
222222
private void generateEventStreamOperation(PythonWriter writer, OperationShape operation) {
223223
writer.pushState(new OperationSection(service, operation));
224224
writer.addDependency(SmithyPythonDependency.SMITHY_CORE);
225+
writer.addDependency(SmithyPythonDependency.SMITHY_AWS_CORE.withOptionalDependencies("eventstream"));
225226
var operationSymbol = symbolProvider.toSymbol(operation);
226227
writer.putContext("operation", operationSymbol);
227228
var operationMethodSymbol = operationSymbol.expectProperty(OPERATION_METHOD);

codegen/core/src/main/java/software/amazon/smithy/python/codegen/integrations/RestJsonProtocolGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public ApplicationProtocol getApplicationProtocol(GenerationContext context) {
8383

8484
@Override
8585
public void initializeProtocol(GenerationContext context, PythonWriter writer) {
86-
writer.addDependency(SmithyPythonDependency.SMITHY_AWS_CORE);
86+
writer.addDependency(SmithyPythonDependency.SMITHY_AWS_CORE.withOptionalDependencies("json"));
8787
writer.addImport("smithy_aws_core.aio.protocols", "RestJsonClientProtocol");
8888
var serviceSymbol = context.symbolProvider().toSymbol(context.settings().service(context.model()));
8989
var serviceSchema = serviceSymbol.expectProperty(SymbolProperties.SCHEMA);

packages/smithy-aws-core/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ path = "src/smithy_aws_core/__init__.py"
4747
eventstream = [
4848
"smithy-aws-event-stream"
4949
]
50+
json = [
51+
"smithy-json"
52+
]
5053

5154
[tool.hatch.build]
5255
exclude = [

uv.lock

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)