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
fix: update GoogleJsonError object to accomodate all fields in Invalid parameter exception #1783
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,6 +183,59 @@ public ErrorInfo clone() { | |
} | ||
} | ||
|
||
public static class Details { | ||
@Key("@type") | ||
private String type; | ||
|
||
@Key private String detail; | ||
@Key private List<ParameterViolations> parameterViolations; | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
|
||
public String getDetail() { | ||
return detail; | ||
} | ||
|
||
public void setDetail(String detail) { | ||
this.detail = detail; | ||
} | ||
|
||
public List<ParameterViolations> getParameterViolations() { | ||
return parameterViolations; | ||
} | ||
|
||
public void setParameterViolations(List<ParameterViolations> parameterViolations) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exposes mutable private state |
||
this.parameterViolations = parameterViolations; | ||
} | ||
} | ||
|
||
public static class ParameterViolations { | ||
@Key private String parameter; | ||
@Key private String description; | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public String getParameter() { | ||
return parameter; | ||
} | ||
|
||
public void setParameter(String parameter) { | ||
this.parameter = parameter; | ||
} | ||
} | ||
|
||
/** List of detailed errors or {@code null} for none. */ | ||
@Key private List<ErrorInfo> errors; | ||
|
||
|
@@ -192,6 +245,9 @@ public ErrorInfo clone() { | |
/** Human-readable explanation of the error or {@code null} for none. */ | ||
@Key private String message; | ||
|
||
/** Lists type and parameterViolation details of an Exception */ | ||
@Key private List<Details> details; | ||
|
||
/** | ||
* Returns the list of detailed errors or {@code null} for none. | ||
* | ||
|
@@ -246,6 +302,14 @@ public final void setMessage(String message) { | |
this.message = message; | ||
} | ||
|
||
public List<Details> getDetails() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exposes mutable private state |
||
return details; | ||
} | ||
|
||
public void setDetails(List<Details> details) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exposes mutable private state |
||
this.details = details; | ||
} | ||
|
||
@Override | ||
public GoogleJsonError set(String fieldName, Object value) { | ||
return (GoogleJsonError) super.set(fieldName, value); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"error": { | ||
"code": 400, | ||
"message": "The template parameters are invalid.", | ||
"status": "INVALID_ARGUMENT", | ||
"details": [ | ||
{ | ||
"@type": "type.googleapis.com/google.dataflow.v1beta3.InvalidTemplateParameters", | ||
"parameterViolations": [ | ||
{ | ||
"parameter": "safeBrowsingApiKey", | ||
"description": "Parameter didn't match regex '^[0-9a-zA-Z_]+$'" | ||
} | ||
] | ||
}, | ||
{ | ||
"@type": "type.googleapis.com/google.rpc.DebugInfo", | ||
"detail": "test detail" | ||
} | ||
] | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exposes mutable private state, needs a defensive copy