Skip to content

[FEATURE] Introduce a mechanism for detecting and incorporating breaking changes from spec in a backward compatible way #1927

Open

Description

@karenyrx

Is your feature request related to a problem?

Today, the Java client can include breaking changes in each release, as it is generated from the latest spec updates and does not always take prior Java client versions into account. This can make backward compatibility and future evolution more difficult.

What solution would you like?

Java client should introduce some kind of versioning / compatibility matrix / backward compability support (e.g. marking old fields as deprecated but not fully removing them until the next OS major version release), to support correctness fixes coming from the upstream source of truth opensearch-api-specification.
As a general principle, downstream consumers (e.g. java client, opensearch-protobufs) should not block upstream (i.e. opensearch-api-specification) from being updated.

What alternatives have you considered?

Any solution that allows independent evolution and autonomy of the opensearch-api-specification will suffice.

Do you have any additional context?

The java client today is also tightly coupled with specific syntaxes / ways of representing the spec, which is not ideal. e.g. this PR opensearch-project/opensearch-api-specification#956 was reverted in the spec repo by opensearch-project/opensearch-api-specification#1011 , despite reducing redundancy and using the correct REST API representation, because it broke java code generation

Activity

  1. added
    enhancement
    on Mar 11, 2026
  2. krisfreedain commented on Mar 30, 2026

    @krisfreedain
    Member

    @reta @Bukhtawar @szczepanczykd maintainers - can you take a look?

    Catch All Triage - 1 2 3

  3. yyfamazon commented on Nov 12, 2026

    @yyfamazon
    Contributor

    Related RFC: opensearch-project/opensearch-api-specification#1334

    It proposes that the spec build also publishes a resolved client model (opensearch-client-model.json) next to opensearch-openapi.yaml: every type with its $refs followed, its allOfs merged and its unions classified (fields with requiredness, bases for inheritance, version and deprecation metadata, union kinds with variant keys or tags, presence/container constraints). The prototype is opensearch-api-specification#1329.

    Two points connect to this issue:

    • Detecting breaking changes: the model is a flat list of types, so diffing it between spec versions shows which fields of which types changed shape, which could feed the compatibility mechanism proposed here.
    • Classification in java-codegen: today java-codegen decides itself whether a union is a tagged union (OpenApiSchema.isTaggedUnionInner) and flattens allOfs (ObjectFlatteningVisitor); with the normalized spec it would turn TermsLookup into a tagged union. The model states the union kind (presence for TermsLookup, container with its variant keys for AggregationContainer) so that decision is made once in the spec.

    Would this design work for opensearch-java? Feedback on the RFC is very welcome.

    cc @reta @Bukhtawar @szczepanczykd @madhusudhankonda @saratvemulapalli @Xtansia @VachaShah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions