How to find out programmatically the api-version of a given type in the API? #23357
Labels
CodeGen
Issues that relate to code generation
feature-request
This issue requires a new behavior in the product in order be resolved.
Feature Request
ARM api-version is handled pretty opaquely in azure-sdk-for-go. By that, I mean that when I import, say, "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3", I have no easy way to know programatically what api-version is being used for requests to ARM.
In fact, in that specific example, the answer is "it depends": within the same package version, the role assignments client currently uses
2022-04-01
whereas the role definitions client currently uses2022-05-01-preview
.For requests to ARM, it is generally useful not to know or care what the api-version is, but there are exceptions.
For example, sometimes a client may want to locally persist some data retrieved from ARM, and in that case it is important to know the api-version of the object that is being persisted.
Part one of this request is: it would be really useful to be able to find that information out programmatically.
Unfortunately, this leads to a trickier follow-up issue, which is that if I bump my azure-sdk-for-go dependencies between persisting and re-reading some ARM data, I fear there's no guarantee that the more recent library will still use the same api-version as the older library, and if there is a breaking change in the API in question, my data might be read in wrong.
At the very least, if I know the api-versions of the persisted data and the library types, I can detect this issue.
More widely, it's not clear how to solve this further: as someone who wants to do this kind of thing, do I need to go to azure-rest-api-specs and generate my own clients to manage the use of api-versions more carefully myself?
The text was updated successfully, but these errors were encountered: