-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Compute API v1: xxxResourceName.parse throws ValidationException #3604
Closed
dtretyakov opened this issue
Aug 24, 2018
· 1 comment
· Fixed by googleapis/gapic-generator#2478 or #4213
Closed
Compute API v1: xxxResourceName.parse throws ValidationException #3604
dtretyakov opened this issue
Aug 24, 2018
· 1 comment
· Fixed by googleapis/gapic-generator#2478 or #4213
Labels
api: compute
Issues related to the Compute Engine API.
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.
Comments
andreamlin
added
api: compute
Issues related to the Compute Engine API.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
labels
Aug 24, 2018
yihanzhen
added
the
priority: p2
Moderately-important priority. Fix may not be included in next release.
label
Aug 27, 2018
@andreamlin I added |
andreamlin
added a commit
to googleapis/gapic-generator
that referenced
this issue
Dec 11, 2018
Partially addresses googleapis/google-cloud-java#3604. Don't force pathtemplate strings to start with a literal string. The status quo, for path templates, is to magically append a literal string to templated paths that begin with a bracketed string, e.g. the path {project}/zones/{zone} is rendered as projects/{project}/zones/{zone}. I don't remember exactly why we decided to do this, though it may have been related to purity of usage of PathTemplates, where all existing Google grpc path templates start with a projects (or possibly organizations) substring. More importantly, this PR allows us to parse a resource string returned from the server (see issue googleapis/google-cloud-java#3604), which often looks like https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}. The compute.v1.json Discovery API specifies that the baseUrl is exactly https://www.googleapis.com/compute/v1/projects. We can then take a resource string from the server, remove the given baseUrl prefix, and then parse the remaining suffix {project}/zones/{zone} into a ProjectsZoneName. See googleapis/google-cloud-java#3899 and googleapis/discovery-artifact-manager#95 for the resulting surface diffs from this generator change.
This was referenced Dec 11, 2018
andreamlin
added a commit
to googleapis/gapic-generator
that referenced
this issue
Dec 13, 2018
This was referenced Jan 28, 2019
dtretyakov
added a commit
to JetBrains/teamcity-google-agent
that referenced
this issue
Jan 28, 2019
Fixes issues after changes in googleapis/google-cloud-java#3604
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
api: compute
Issues related to the Compute Engine API.
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.
Currently all
parse()
methods inxxxResourceName
classes expect that input string will be formatted likeprojects/{project}/...
, but data returned from APIs contains URL prefixes likehttps://www.googleapis.com/compute/v1/projects/...
and as result parsing fails withValidationException
.Example
Receive instance details where:
Then when trying to parse it with
ProjectZoneName.parse(instance.zone)
will cause the following exception:The text was updated successfully, but these errors were encountered: