fix: allow indexed_shape-only geo/xy shape queries - #2088
Conversation
The OpenSearch geo_shape / xy_shape APIs allow either an inline shape or a pre-indexed shape via indexed_shape. Requiring shape in the OpenAPI schema and generated builders made indexed_shape-only queries impossible. Remove shape from required in the local OpenAPI copy and update the generated models so shape is nullable, matching indexed_shape. Fixes opensearch-project#2011 Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
| $ref: '#/components/schemas/_common.query_dsl___GeoShape' | ||
| relation: | ||
| $ref: '#/components/schemas/_common___GeoShapeRelation' | ||
| required: |
There was a problem hiding this comment.
Thanks @arimu1 , please submit a pull request against https://github.com/OpenSearch-project/openSearch-api-specification
|
@reta Thanks for the review direction — understood that I'll open a PR against the API specification for the geo/xy shape oneOf (inline |
|
Closing as requested — the schema fix needs to land in opensearch-api-specification first, then the client can pick it up via regeneration. Happy to open a follow-up once the OpenAPI change is in. |
Description
Fixes #2011.
GeoShapeQueryField(and the siblingXyShapeQueryField) currently markshapeas required. OpenSearch documents that a geo/xy shape query may use either an inlineshapeor a pre-indexed shape viaindexed_shape(not both). Because the generated builder enforcesshape, callers cannot construct valid pre-indexed shape queries:Changes
required: [shape]from_common.query_dsl___GeoShapeQueryFieldand_common.query_dsl___XyShapeQueryFieldinjava-codegen/opensearch-openapi.yamlGeoShapeQueryField/XyShapeQueryFieldsoshapeis@Nullable(noApiTypeHelper.requireNonNull, conditional serialization, null-safe equals/hashCode)indexed_shape-only construction/serializationRelated
shapeshould not be required inGeoShapeQueryField(blocks pre-indexed shape queries in generated clients) opensearch-api-specification#1160 / Fix copy-paste mistake in NeuralSearch sample #1161 (same schema correction). This client PR unblocks users of the generated DSL until the next full spec refresh.Testing
Temurin 21 / macOS — 4 tests, 0 failures (
toBuilder+indexedShapeOnlyfor both classes).Check List
Signed-off-byBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.