This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
fix: REST: Make make LRO stub accept APIs of different versions #1622
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this fix it worked only with
v1
APIs.HttpJsonOperationsStub
is shared by multiple different services similarly toGrpcOperationsStub
. Unlike grpc version, the verison of the actual API that this stub is used by is supposed to be encoded in the http url, so theHttpJsonOperationsStub
must adjust to the actual version of the API it is being used from. Similarly we also need to make the url patterns less restrictive, to accept operaion names in different formats (this is what caused the{name=}
pattern changes).The solution is hacky, but simple and should work for all known APIs. It is based on the fact that even though the
HttpJsonOperationsStub
is shared by all clients (i.e. is ingax
), itsHttpJsonStubCallbackFactory
argument, on the other hand, is a generated one (i.e. is in a gapic client for a specific API) and its package corresponds to the API version, which is a convention for all google APIs (i.e. version in the proto package corresponds to the version of the API).Doing this the other way would require a lot of work (parsing yaml, generating operations stub on the fly etc), and we may come back to it if even needed (most probably never).