Skip to content

refactor: use @Nullable String for tenant across all spec params records#910

Open
ehsavoie wants to merge 1 commit into
a2aproject:mainfrom
ehsavoie:issue_844
Open

refactor: use @Nullable String for tenant across all spec params records#910
ehsavoie wants to merge 1 commit into
a2aproject:mainfrom
ehsavoie:issue_844

Conversation

@ehsavoie
Copy link
Copy Markdown
Collaborator

@ehsavoie ehsavoie commented Jun 3, 2026

The tenant field was semantically optional but typed as non-nullable String with "" as an absent-value sentinel in most params records, while GetExtendedAgentCardParams and TaskPushNotificationConfig correctly used @nullable String. This standardizes all params records to @nullable (null = no tenant), removes the Assert.checkNotNullParam assertions for tenant, and updates gRPC MapStruct mappers to skip setTenant when null (conditionExpression) and convert proto "" back to null on fromProto (emptyToNull).

Fixes #844 🦕

@ehsavoie ehsavoie requested a review from kabir June 3, 2026 07:55
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the handling of the tenant field across various SDK specification classes, builders, and MapStruct mappers to support nullable tenants instead of using empty strings as defaults. It removes non-null assertions for the tenant parameter and updates the utility method extractTenant to accept a nullable agent tenant. Feedback suggests ensuring that the fallback agentTenant is also normalized and validated in extractTenant to prevent malformed URLs.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread spec/src/main/java/org/a2aproject/sdk/util/Utils.java
The tenant field was semantically optional but typed as non-nullable
String with "" as an absent-value sentinel in most params records,
while GetExtendedAgentCardParams and TaskPushNotificationConfig
correctly used @nullable String. This standardizes all params records
to @nullable (null = no tenant), removes the Assert.checkNotNullParam
assertions for tenant, and updates gRPC MapStruct mappers to skip
setTenant when null (conditionExpression) and convert proto "" back to
null on fromProto (emptyToNull).

Fixes a2aproject#844

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: optional tenant in spec vs non-null tenant + misleading docs in Java SDK

1 participant