-
Notifications
You must be signed in to change notification settings - Fork 62
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
[PROPOSAL] Publish versioned API specs #84
Comments
I would propose that the API spec include version ranges as a field for a method. A given client should be able to speak with multiple servers, and by knowing which server version we're talking to, or by specifying it in the request, a single client with a multi-version spec could handle that situation. |
I kind of like this approach: continuously evolving the spec. I would like to suggest a combined approach, keep one spec for a release line (1.x, 2.x, 3.x). Why is that: within the release line, the spec should evolve in a backward compatible way but not between major releases. I have difficulties expressing the API in spec that was introduced in 1.3.7, deprecated in 2.7.0 and removed in 3.0.0 (we could only express the latter essentially). The only option with single spec I see is when we always evolve the spec in backward compatible way. For cases where there is a need to have connect to multi-version clusters, non issue in scope of same release line, but if the support of multiple major versions is needed, several clients could be generated easily (one for 2.x and one for 3.x fe). What do you think? |
I think if the spec can span as wide a range of versions as possible, it becomes more capable of generating a client that "just works." The challenge of migrating across major versions is the place where a multi-version client makes the biggest difference. The minor version changes, assuming semver is getting followed, introduce changes that are unlikely to lead to heartache of a user. If the client had a feature missing in a server, a lot of unlikely things would have to come together for an engineer to build an application that relied on those features because they exist in the client but didn't want to upgrade their server to enable the feature. I think I empathize with the more constrained engineer who is contending with major version changes and old codebases of working code, maybe because I've been there. That's who benefits from a more capable multi-major-version client. |
@wbeckler A client that can talk to any server version is nice but it might be more troublesome than it's worth. It will drastically increase the complexity of the code generator, increase performance overheads for the client (from server version checking and guards for different versions of the server when a request is executed). On the other hand, there are very few use cases where an application has to talk to multiple OS clusters of different major versions. |
You cannot evolve a spec in backwards compatible ways across major semver versions because of breaking changes in parameters. For example, imagine an API that takes a field called |
That's actually not true.
|
Approaches for Versioning for API specsThe versioning implemented for specs will also be used for client generation, hence the purpose of this design is:
Approach 1As the specs are evolving to be the true representation of the server, the OpenAPI specs can be divided according to major versions of the server in their own branch: For minor versions of the APIs, the branched specs can extend the current OpenAPI vendor extension traits Pros
Cons
Approach 2Publish a single spec for all versions of the server. Use the current OpenAPI vendor extensions to get the server versions of when the APIs were added, deprecated or removed. This approach works similar to approach 1 but spans across major versions. Pros
Cons
Approach 3OpenAPI specs are published for each minor version of the server. Pros
Cons
With the above trade offs for approaches, to add versioning for the specs (approach 1), following items need to be addressed:
|
Thanks @VachaShah , to me the Approach 1 presents the best balance of the usability and maintainability |
With the publishing mechanism in #211 we can publish builds from multiple branches and thus track multiple versions of OpenSearch that aren't compatible. |
#120 is related |
overall +1 on approach 1) proposing maybe we can start V2.0.0-beta (v2 is the current public OS core release major version) while continue fixing issues in specs.
v[CORE-MAJOR-VERSION].[SPEC-MAJOR-VERSION].[SPEC-MINOR/PATCH-VERSION] |
I like this minus the "beta" terminology that is not necessary imo. The spec today tests against 2.17 (released) and 3.0 (unreleased). I think we should publish two versions today: |
beta is for if we are not fully ready, if not concern of following the regular release, then yeah, we don't need "beta".
what's the purpose of keeping the date here? what if there's any breaking change in Spec itself which would very likely happen as Core <> Spec not forcefully in-sync at this moment. Also, for |
Let's backup. What are we trying to solve? I think I'm confused. The spec today supports versioning via OpenAPI extensions.
Furthermore, the spec merger supports Today we publish one single spec from I renamed this issue to "publish versioned API specs". The intent is that we would use the Is there something else that you're looking for @amberzsy? |
@dblock I think the issue is a bit different (and if it is not, than I am confused as well). The API spec is reverse engineered at the moment. What it practically means, despite the best effort, we could have added API elements (schema, properties, endpoints, etc) which deviate from the current "real" API. Correcting those makes sense but the API spec could be altered in a way that makes it incompatible with the previous one. I think this is perfectly fine for the time being, but could be disruptive for the folks that are building on top of it since there is no "sticky" / "stable" published version to point to. |
I think I understand having heard @amberzsy on Slack too. Does publishing a 0.1.0 work? We would publish 0.2.0 when we introduce a breaking change, and 0.1.1 when we don't? |
sg, +1
typo? 0.1.1 i guess. |
With #635 merged I will try and do a 0.1.0 release this week. |
What/Why
What are you proposing?
Every version of OpenSearch has its own version of the API and therefore the API specs should reflect that.
What users have asked for this feature?
In opensearch-project/opensearch-clients#58 we plan to auto-generate clients. Therefore we need a way to both version API specs and a way to know the exact API spec for a given version of server.
What problems are you trying to solve?
What is the developer experience going to be?
I see several options.
a) The specs tag when APIs were added/removed/changed, see #80, and publish a single version of specs with the options/tags.
b) The repo is branched in ways that follows OpenSearch and each branch publishes a version of the specs.
What is the user experience going to be?
I'd like to be able to say "where's the 2.7.0 version of OpenSearch specs" and consume it directly.
The text was updated successfully, but these errors were encountered: