Skip to content

Commit 1626e1b

Browse files
committed
Fix domarshall logic
1 parent 39456ce commit 1626e1b

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

core/protocols/aws-json-protocol/src/main/java/software/amazon/awssdk/protocols/json/internal/marshall/JsonProtocolMarshaller.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,14 @@ void doMarshall(SdkPojo pojo) {
215215
marshallExplicitJsonPayload(field, val);
216216
} else if (val != null) {
217217
marshallField(field, val);
218-
} else if (field.containsTrait(RequiredTrait.class,
219-
TraitType.REQUIRED_TRAIT)) {
220-
throw new IllegalArgumentException(
221-
String.format("Parameter '%s' must not be null",
222-
field.locationName()));
218+
} else if (field.location() == MarshallLocation.PAYLOAD) {
219+
if (field.containsTrait(RequiredTrait.class, TraitType.REQUIRED_TRAIT)) {
220+
throw new IllegalArgumentException(
221+
String.format("Parameter '%s' must not be null",
222+
field.locationName()));
223+
}
224+
} else {
225+
marshallField(field, val);
223226
}
224227
}
225228
}

0 commit comments

Comments
 (0)