Skip to content

Generating from latest spec + JDK TimeZone type#48319

Open
jpalvarezl wants to merge 3 commits intomainfrom
jpalvarezl/fix/type_overrides
Open

Generating from latest spec + JDK TimeZone type#48319
jpalvarezl wants to merge 3 commits intomainfrom
jpalvarezl/fix/type_overrides

Conversation

@jpalvarezl
Copy link
Member

This pull request introduces several important improvements to the Azure AI Agents SDK, focusing on stronger type safety for feature opt-in keys and enhanced handling of time zones in location models. It replaces string-based enums with Java enum types for opt-in keys, updates the ApproximateLocation and WebSearchApproximateLocation models to use TimeZone objects instead of strings, and adds comprehensive tests to ensure correct serialization and deserialization of time zones.

Type Safety and Enum Refactoring:

  • Refactored AgentDefinitionOptInKeys and FoundryFeaturesOptInKeys from ExpandableStringEnum-based classes to standard Java enum types, improving type safety and simplifying usage. Both now include a fromString method for parsing and a toString override for serialization. [1] [2]

TimeZone Handling in Location Models:

  • Changed the timezone property in ApproximateLocation and WebSearchApproximateLocation from String to TimeZone. Updated getter/setter methods, JSON serialization (writes the timezone ID), and deserialization (parses the timezone ID into a TimeZone object). [1] [2] [3] [4] [5] [6] [7] [8]

Testing Improvements:

  • Added a new test class ApproximateLocationSerializationTests that thoroughly tests serialization and deserialization of the ApproximateLocation model with various time zone scenarios, including round-trip tests and edge cases.

These changes collectively make the SDK safer, more robust, and easier to use when working with feature opt-in keys and time zone-aware location data.

Copilot AI review requested due to automatic review settings March 6, 2026 19:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Azure AI Agents/Projects SDKs to regenerate from a newer azure-rest-api-specs commit, while improving type-safety around preview feature opt-in keys and switching several model timezone fields from String to java.util.TimeZone (with accompanying serialization tests).

Changes:

  • Bump tsp-location.yaml commits to generate from a newer spec revision.
  • Replace several String timezone properties with TimeZone and update JSON (de)serialization accordingly.
  • Refactor feature opt-in key types from ExpandableStringEnum to closed Java enum, and add/extend serialization tests.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
sdk/ai/azure-ai-projects/tsp-location.yaml Updates the spec commit used for generation.
sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/RecurrenceTrigger.java Changes timeZone to TimeZone and serializes as timezone ID.
sdk/ai/azure-ai-projects/src/test/java/com/azure/ai/projects/models/RecurrenceTriggerSerializationTest.java Adds timezone serialization/deserialization tests for RecurrenceTrigger.
sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/FoundryFeaturesOptInKeys.java Refactors opt-in keys to a closed Java enum.
sdk/ai/azure-ai-projects/src/main/java/com/azure/ai/projects/models/CodeBasedEvaluatorDefinition.java Adjusts model shape (adds entry_point/image_tag) and changes construction pattern.
sdk/ai/azure-ai-agents/tsp-location.yaml Updates the spec commit used for generation.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/models/ApproximateLocation.java Changes timezone to TimeZone and serializes as timezone ID.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/models/WebSearchApproximateLocation.java Changes timezone to TimeZone and serializes as timezone ID.
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/ApproximateLocationSerializationTests.java Adds timezone serialization/deserialization tests for ApproximateLocation.
sdk/ai/azure-ai-agents/src/test/java/com/azure/ai/agents/WebSearchApproximateLocationSerializationTests.java Adds timezone serialization/deserialization tests for WebSearchApproximateLocation.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/models/FoundryFeaturesOptInKeys.java Refactors opt-in keys to a closed Java enum.
sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/models/AgentDefinitionOptInKeys.java Refactors opt-in keys to a closed Java enum.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

API Change Check

APIView identified API level changes in this PR and created the following API reviews

com.azure:azure-ai-agents
com.azure:azure-ai-projects

@jpalvarezl jpalvarezl enabled auto-merge (squash) March 6, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants