We are about to implement a service API for my client that consists of a number of services, lets say ServiceA, ServiceB and ServiceC. Each service can over time (independantly) introduce new versions, while the old versions still exist. So we might have:
We are required to document this API using OpenAPI. I'm not too familiar with OpenAPI, but as far as I can see you typically version the entire API, not separate services.
How would one typically document such versioning using OpenAPI? Personally I see two options, but I am very likely missing something:
Any input would be much appreciated.
Clients may not want to update their applications when the API changes, so a versioning strategy becomes crucial. A versioning strategy allows clients to continue using the existing REST API and migrate their applications to the newer API when they are ready.
Semantic Versioning is a versioning scheme for using meaningful version numbers (that's why it is called Semantic Versioning). Specifically, the meaning revolves around how API versions compare in terms of backwards-compatibility.
Maybe a little late, but consider this point of view.
If the service API is implemented by a compact component, then the API should also be compact. The consumer of your service is not interested into your versioning policies more than to the extend of backwards compatibility violations and/or new feature addition.
It is absolutely out of scope to require the consumer to know all your version numbers for individual services. He does not want to know it, he wants a complete, compact package.
If you services have little in common, your best solution may be individual OpenAPI documents with tailored versions. The point is - you will not block development of your components by unrelated customers/consumers relying on the remaining services, and you will not bother the customers with zero-change version changes for their field of interest.
On the other hand, you may as well keep a version number that is separate from the endpoints.
Something like this:
openapi: 3.1.0
info:
version: 2.0
servers:
- url: http://somewhere.com/v2
paths:
/some-action:
...
instead of
openapi: 3.1.0
info:
version: 2.0
servers:
- url: http://somewhere.com
paths:
/v2/some-action:
...
Now, your clients are expected to configure the address of your service http://somewhere.com/v2
and use it for all services, A, B, C. Once you decide to release a new major version /v3 which breaks compatibility on service A, and brings new features to B, C, and possibly new D:
server
as well. Also, they are free to use D.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With