che icon indicating copy to clipboard operation
che copied to clipboard

REST-API compatibility is not reflected in swagger.json version number

Open toorog opened this issue 8 years ago • 16 comments

Description

If I have an application connected to che via swagger definition, there is no way to know if my generated client is still compatible with the server API. Root cause of that problem is that the API version field of the swagger file is not used at all.

My suggestion would be to use the info.version field in swagger.json to maintain the version compatiblity of that API. Every change in the API needs to lead to a new swagger version number.

A more easy approach could be to simply use the current che version number as API-Version number. But of course this is not such a good solution as it would always make the API incompatible when a new release is created.

toorog avatar Jul 06 '18 13:07 toorog

@toorog good point but Che API isn't versioned. You may safely assume that client is compatible with the API.

But I agree that we should either remove API version or replace it with Che release version:

image

@skabashnyuk it looks like @mkuznyetsov can take care of it as he dealt with swagger more often that the others.

ghost avatar Jul 10 '18 04:07 ghost

@eivantsov I partitally agree, if che API is not versioned at all, it is good to use the che version for the API as well. But there should definitely be some version inside the swagger file. I am working in a microservice environment where che is just one of many services. Without a version number in swagger.json there would be no way (for a REST-Client) to dynamically determine the current supported API version and therefore using a matching client implementation. Hence removing the api version tag completely, would always require the clients to be manually configured for the che version currently deployed.

toorog avatar Jul 10 '18 05:07 toorog

@toorog so, what you are looking is a way for the client to determine current Che master version?

Right now the version is hardcoded and indeed does not make any sense https://github.com/eclipse/che-lib/blob/master/swagger/che-swagger-module/src/main/java/org/eclipse/che/swagger/deploy/BasicSwaggerConfigurationModule.java#L29

ghost avatar Jul 10 '18 05:07 ghost

@eivantsov In my opinion there is a huge difference between the che version, and the REST-API version. E.g. the che version might increase several times, while the REST-API stays exactly the same.

My point is to have a way for clients to get to know the API version automatically, in order to be able to select a compatible client implementation on the fly. The swagger-way to do so is maintaining the version number in swagger.json.

I am fine if the API version always matches the che version (even if this unnecessarily will always make clients incompatible), but it needs to be available in swagger.json's info.version field as all the swagger tooling (esp. client generators) rely on that.

toorog avatar Jul 10 '18 05:07 toorog

@toorog I see what you mean, but there's no such thing as api version for Che. At least at the moment.

So, your client may safely assume that it is ALWAYS compatible with whatever API Che master serves.

ghost avatar Jul 10 '18 05:07 ghost

@eivantsov My experience is unfortunately a different one. I am using the swagger API since che 5.x. Now we are at 6.7.1 and I can't remember a single che upgrade where the API remained compatible to the previous one. Our REST-Clients were always broken because either and endpoint was removed, or DTO structures changed.

toorog avatar Jul 10 '18 05:07 toorog

@toorog we are very sorry that you experience such kind of problems. Maybe we missed something. Can you provide some examples in 6.0.x-6.7.x window?

skabashnyuk avatar Jul 10 '18 07:07 skabashnyuk

@toorog if that's upgrade from 5.x to 6.x then yes, there can be incompatibilities.

ghost avatar Jul 10 '18 08:07 ghost

@skabashnyuk : We have been discussing this over the last years and we discussed about introducing a versioning model to the API (separated indeed from the Che versions itself.) We need to track the changes in APIs versions after versions so third part contributors can track and document the changes and easily adapt their clients.

What was your plan in order to introduce versioning of the API and backward/supportability strategies, and API changelog?

cc @l0rd

slemeur avatar Jul 10 '18 12:07 slemeur

What was your plan in order to introduce versioning of the API and backward/supportability strategies, and API changelog?

We have no (suppose to) breaking changes between major releases. Now I'm looking for more information if it's not the case.

skabashnyuk avatar Jul 10 '18 12:07 skabashnyuk

@skabashnyuk can't we follow https://semver.org/ when it's about versions and breaking changes?

l0rd avatar Jul 11 '18 17:07 l0rd

How hard would it to be to have an automated test set that checks the compatibility and flags incompatible changes? This is not the first time I heard from an adopter about API compatibility, I feel that automating the checks and managing breaking changes is the way forward.

Also updating info.version is not a good idea.

gorkem avatar Jul 11 '18 17:07 gorkem

@skabashnyuk can't we follow https://semver.org/ when it's about versions and breaking changes?

See no reason why not.

How hard would it to be to have an automated test set that checks the compatibility and flags incompatible changes?

Good question. It would be nice to narrow the scope about which API we are talking about, then we can try to figure out something.

This is not the first time I heard from an adopter about API compatibility, I feel that automating the checks and managing breaking changes is the way forward.

Until now I have no confirmed facts of API change since our last major release.

Also updating info.version is not a good idea.

Info version in swagger now hardcoded to 1.0. During this sprint, we want to make it possible to show che version in swagger instead of hardcoded value https://github.com/eclipse/che/issues/10351

As far as I remember our rules were:

  • Incompatible changes are possible during a major release
  • If incompatible changes are needed in minor version, we need to warn a community at least for 1.5 months before this changes happened. Now it's 2 minor releases.

https://github.com/eclipse/che/wiki/Development-Process#deprecation-policy this is a statement we have regarding depreciation

skabashnyuk avatar Jul 12 '18 06:07 skabashnyuk

@skabashnyuk : Where are all the changes on the apis listed? I don't think we do that today, but we should - it would definitely make the plateform easier to leverage for OEM and contributors.

In this thread, we are speaking about providing a changelog that is meaningful to other developers. You can take many examples... https://www.jetbrains.org/intellij/sdk/docs/reference_guide/api_changes/api_changes_list_2018.html

slemeur avatar Jul 12 '18 07:07 slemeur

@skabashnyuk : Where are all the changes on the apis listed? I don't think we do that today, but we should - it would definitely make the plateform easier to leverage for OEM and contributors.

This is a good question to discuss on next community call.

skabashnyuk avatar Jul 12 '18 09:07 skabashnyuk

done in https://github.com/eclipse/che-lib/pull/92

skabashnyuk avatar Aug 20 '18 06:08 skabashnyuk