Skip to content

Commit 5ae5de9

Browse files
committed
fix: Make tenant optional in MessageSendParams
The `tenant` field in `MessageSendParams` was previously required and validated as non-null, which forced callers to always provide a tenant even when it is not applicable. This change makes `tenant` optional by annotating it with `@Nullable` and removing the null-check in the compact constructor. The `Builder.tenant()` method is also updated to accept a nullable value. Javadoc is updated to reflect the new optional semantics. Fixes: #693
1 parent c595071 commit 5ae5de9

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎spec/src/main/java/io/a2a/spec/MessageSendParams.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* @see <a href="https://a2a-protocol.org/latest/">A2A Protocol Specification</a>
2323
*/
2424
public record MessageSendParams(Message message, @Nullable MessageSendConfiguration configuration,
25-
@Nullable Map<String, Object> metadata, String tenant) {
25+
@Nullable Map<String, Object> metadata, @Nullable String tenant) {
2626

2727
/**
2828
* Compact constructor for validation.
@@ -31,11 +31,10 @@ public record MessageSendParams(Message message, @Nullable MessageSendConfigurat
3131
* @param message the message to send
3232
* @param configuration optional message send configuration
3333
* @param metadata optional metadata
34-
* @param tenant the tenant identifier
34+
* @param tenant optional tenant identifier
3535
*/
3636
public MessageSendParams {
3737
Assert.checkNotNullParam("message", message);
38-
Assert.checkNotNullParam("tenant", tenant);
3938
}
4039

4140
/**
@@ -112,10 +111,10 @@ public Builder metadata(@Nullable Map<String, Object> metadata) {
112111
/**
113112
* Sets optional tenant for the request.
114113
*
115-
* @param tenant arbitrary key-value metadata
114+
* @param tenant tenant identifier
116115
* @return this builder
117116
*/
118-
public Builder tenant(String tenant) {
117+
public Builder tenant(@Nullable String tenant) {
119118
this.tenant = tenant;
120119
return this;
121120
}

0 commit comments

Comments
 (0)