Discovery API should either work with version=None or raise an exception #971
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Background
Google API Discovery V2 supports not supplying the version: for example, this URI happily returns what looks like the latest version of the service discovery document.
Requesting specific service version in discovery is probably a more common case (correct me if I am wrong here), but it comes with some maintenance cost: when a version of the service gets deprecated, customers have to explicitly move to another version when making
discovery.build()
calls.Passing
version=None
todiscovery.build()
, having the intent to always get the latest version of the discovery document, results in aBad Request
errors because by default we prefer discovery v1, which does not support "default" or "latest" version semantics:However, this works just fine:
This means that while we could fail over to the V2 discovery, we don't. We should probably correct this behavior in one of the two ways I am proposing below.
Proposal
Choice 1:
version is not None
, keep the order of discovery as is (i.e. V1 first, then V2 if V1 returns 404)version is None
, drop V1 discovery (we know it will return an error) and only use V2, with logging a warning, something likeNot providing specific service version during discovery may result in unexpected failures due to backwards compatibility
Choice 2:
version
is required during discovery andNone
is passed in.The text was updated successfully, but these errors were encountered: