Skip to content

Commit 522b085

Browse files
committed
Only import Field when single-value httpHeader is actually in the model
1 parent 32b7a53 commit 522b085

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private void serializeHeaders(
199199
) {
200200
writer.pushState(new SerializeFieldsSection(operation));
201201
writer.addDependency(SmithyPythonDependency.SMITHY_HTTP);
202-
writer.addImports("smithy_http", Set.of("Field", "Fields"));
202+
writer.addImport("smithy_http", "Fields");
203203
writer.write("""
204204
headers = Fields(
205205
[
@@ -331,6 +331,7 @@ private void serializeIndividualHeaders(GenerationContext context, PythonWriter
331331
headers.extend(tuples_to_fields(($S, $L) for e in input.$L$L))
332332
""", binding.getLocationName(), inputValue, pythonName, trailer);
333333
} else {
334+
writer.addImport("smithy_http", "Field");
334335
var dataSource = "input." + pythonName;
335336
var inputValue = target.accept(new HttpMemberSerVisitor(
336337
context,

0 commit comments

Comments
 (0)