fix: Allow to tag non-exhaustive union types - #1182
Open
acote-coveo wants to merge 1 commit into
Open
Conversation
Add a new OpenAPI annotation that allows to tag union types that are non-exhaustive. Union types are considered "non-exhaustive" when they can be extended through plugins. Generators can later leverage this annotation to support extension.
4 tasks
acote-coveo
marked this pull request as ready for review
August 3, 2026 15:49
acote-coveo
requested review from
Tokesh,
VachaShah,
Xtansia,
aabeshov,
harshavamsi,
karenyrx,
lucy66hw,
sachetalva and
sean-
as code owners
August 3, 2026 15:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add a new
x-non-exhaustiveOpenAPI vendor extension that marks discriminated union (tagged) types as non-exhaustive. Union types are considered "non-exhaustive" when they can be extended through plugins at runtime — code generators should treat these unions as open/extensible rather than sealed.Changes
New vendor extension: Introduced
x-non-exhaustive: trueannotation on the following plugin-extensible union schemas:Property(_common.mapping.yaml)Analyzer,TokenizerDefinition,TokenFilterDefinition,CharFilterDefinition(_common.analysis.yaml)QueryContainer,SpanQuery(_common.query_dsl.yaml)AggregationContainer(_common.aggregations.yaml)ProcessorContainer(ingest._common.yaml)FieldSuggester(_core.search.yaml)Linter/Tester updates: Registered
x-non-exhaustiveas a recognized additional keyword in bothSchemasValidator.tsandSchemaValidator.tsto prevent unknown-keyword lint errors.Documentation: Added
x-non-exhaustiveto the vendor extensions section ofDEVELOPER_GUIDE.md.Changelog: Documented the addition under the "Added" section.
Motivation
Generators (e.g. opensearch-java) need a way to know which union types are open to extension so they can emit appropriate code — such as an "custom" variant or a custom deserialization fallback — rather than failing on unrecognized discriminator values introduced by plugins.
Related Issues
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check [here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).