Description
Rest API compatibility is only supporting N-1 version. We want to ensure that after major version bump we won't break the build and the N-2 code won't be used by the server.
During the major version bump we expect to remove old Version
fields and bump the RestApiVersion.CURRENT
Currently we emit an assertion error in https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/rest/RestController.java#L179
which would break the build after the major version bump is performed and N-2 compatible code is not removed.
assert RestApiVersion.minimumSupported() == version || RestApiVersion.current() == version
: "REST API compatibility is only supported for version " + RestApiVersion.minimumSupported().major;
For instance Version.CURRENT = 9.0.0, RestApiVersion.current = 9 and RestApiVersion.minimumSupported = 8.
The old routes in RestActions are still using RestApiVersion.V_7
The same applies to testing. Unit tests that are covering individual RestAction with old routes, will fail on those assertions.
Possible solution would be to remove the assertion in RestController and emit a warning/error in logs
relates #51816
follow up after #69131 (comment)