Skip to content

feat: auto populate propertyOrdering in Schema builder and transformers - #1172

Open
hemasekhar-p wants to merge 1 commit into
googleapis:mainfrom
hemasekhar-p:propertyOrdering-fix
Open

feat: auto populate propertyOrdering in Schema builder and transformers#1172
hemasekhar-p wants to merge 1 commit into
googleapis:mainfrom
hemasekhar-p:propertyOrdering-fix

Conversation

@hemasekhar-p

Copy link
Copy Markdown

Fixes #1169

Description

Automatically populates propertyOrdering with property keys when constructing a Schema object with multiple properties if propertyOrdering was not explicitly set.

Changes

  • Updated Schema.Builder.build() to auto-populate propertyOrdering if omitted and properties has > 1 key.
  • Updated Transformers.tSchema helper to recursively populate propertyOrdering on nested object schemas and items.
  • Added unit test coverage in TransformersTest.java.

Test Coverage

  • Explicit user property ordering is preserved.
  • Single-property and empty schemas remain untouched.

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.

Gen AI with structured output - propertyOrdering in Python vs. Java implementations

1 participant