Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "force" version type #47228

Merged
merged 1 commit into from
Sep 30, 2019
Merged

Conversation

ywelsch
Copy link
Contributor

@ywelsch ywelsch commented Sep 27, 2019

It's been deprecated long ago and can be removed.

Relates to #20377

Closes #19769

It's been deprecated long ago and can be removed.
@ywelsch ywelsch added >non-issue :Distributed Indexing/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. v8.0.0 v7.5.0 labels Sep 27, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ywelsch ywelsch merged commit 9592b59 into elastic:master Sep 30, 2019
ywelsch added a commit that referenced this pull request Sep 30, 2019
It's been deprecated long ago and can be removed.

Relates to #20377

Closes #19769
@Mpdreamz
Copy link
Member

Note force was removed from the java enum and therefore should be removed from all the rest-spec json files documenting version_type.

cc @elastic/es-clients

This is a good highlight for the API versioning discussion, ideally this is only removed in major versions. cc @jakelandis

Mpdreamz added a commit to elastic/elasticsearch-net that referenced this pull request Nov 19, 2019
Mark as obsolete to warn the user but without breaking backwards
compatibily. The 7.5 client should be able to be used against < 7.5
server.

relates: github.com/elastic/elasticsearch/pull/47228
Mpdreamz added a commit to elastic/elasticsearch-net that referenced this pull request Nov 20, 2019
* update specs

* update ignore list

* sync docgen changes from master, ignore time enum for now since its values are descriptions and we already have a Time type

* codegen line ending changes

* Add back local/master_timeout

And document them as deprecated

relates: elastic/elasticsearch#47933

* do not generate time and byte querystring parameters

* patch now also hoists params over, we can no longer rely on simple merge since we temporarily still rework the spec files in memory to the old format

* add changes and remove bytes for now

* Add back force as option for version_type

Mark as obsolete to warn the user but without breaking backwards
compatibily. The 7.5 client should be able to be used against < 7.5
server.

relates: github.com/elastic/elasticsearch/pull/47228

* codegen for enums can now pragma disable obsolete members in generated GetString()

* Generated pragma disable for obsolete enum members
Mpdreamz added a commit to Mpdreamz/elasticsearch that referenced this pull request Nov 20, 2019
As per elastic#47228 `force` is no longer a valid option
@ywelsch
Copy link
Contributor Author

ywelsch commented Nov 20, 2019

This is a good highlight for the API versioning discussion, ideally this is only removed in major versions.

@Mpdreamz note that this parameter had been rejected already since the previous major. I consider this purely a code clean-up. The only behavioral change here is that a more generic exception message is provided if someone specifies force version type. The question here rather is: When should the REST spec have been adapted? If the system always rejects a given parameter, is there a point to keep that parameter in the REST spec?

@russcam
Copy link
Contributor

russcam commented Nov 21, 2019

When should the REST spec have been adapted?

The REST API spec should have been adapted when the version type was deprecated in the server source code; if deprecation results in a validation error, this sounds like good cause to remove from the spec if the deprecation is for a major release, or to be signalled in the REST API spec as deprecated for any other release.

If the system always rejects a given parameter, is there a point to keep that parameter in the REST spec?

A lot of the Elasticsearch clients generate a large amount of their API surface from the REST API specs, including API params. For those params that constrain the accepted values to a known set, a client may generate code to uphold this constraint, such as an enum of values.

When the REST API spec changes in ways that would violate semantic versioning e.g. removing params in a minor version, removing an accepted value for a param in a minor, etc., it has ramifications for client generation; for statically typed languages like Java1, C#, Go and Rust, such a change in the REST API spec can manifest as an API breaking change in the client. Since clients also follow semantic versioning2 in order to provide guarantees to their consumers, API breaking changes should not happen in minors or patches, and if they do, it results in each client having to independently patch their code generation process to deal with them.

The REST API specs are currently the best specification for the REST API surface of Elasticsearch that we have to work with, and the best representation of the external contract that clients, products and integrations use to communicate with Elasticsearch. I think it's crucially important that it follows the same semantic versioning rigour that I know the Elasticsearch team puts into the public API surface of the server side code.

1 - I don't know how the Java client is written, whether it generates the API surface from the REST API specs, and to what extent the API is typed
2 - The extent to which a client follows semantic versioning is language ecosystem dependent to some degree, but the vast majority do. Some clients may provide other guarantees around API changes, such as binary compatibility within a major version.

@ywelsch
Copy link
Contributor Author

ywelsch commented Nov 22, 2019

Thanks for the explanations @russcam. If this is critical for client development, could we put safeguards in place that check API compatibility with prior versions of the spec, to avoid problems like this in the future?

@russcam
Copy link
Contributor

russcam commented Nov 25, 2019

Safeguards would be very welcome! It could start with something more simple such as a diff of *.json files in a PR for changed files in

  • /rest-api-spec/src/main/resources/rest-api-spec/api
  • /x-pack/plugin/src/test/resources/rest-api-spec/api

and flag when a change is breaking between two known versions.

There is an initiative to record requests and responses of YAML tests to notify of changes in structure which should also help, but because it is detached from server side changes, it's more "after the fact" rather than flagging when a change will be merged into a main branch.

ywelsch pushed a commit that referenced this pull request Nov 26, 2019
As per #47228 `force` is no longer a valid option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >non-issue v7.5.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove version type FORCE
6 participants