-
Notifications
You must be signed in to change notification settings - Fork 162
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
Enhanced Target Server Validator #715
Enhanced Target Server Validator #715
Conversation
return False | ||
else: | ||
print(response.text) | ||
logger.debug(f"{response.text}") |
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.
Does this need an f-string?
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.
Changed it.
@@ -0,0 +1,190 @@ | |||
// JavaxJson.java |
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.
License Header needed here
return (T) decode(value, beanClass); | ||
} | ||
|
||
private static Object decode(JsonValue jsonValue, Type targetType) { |
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.
What's the rationale for mixing getValueType Enums and instanceof? Would it be more readable to just use the enum and turn it into a switch?
if (payload != null) { | ||
Map<String, List<Map<String, String>>> result = new HashMap<>(); | ||
result.put("hostname_portnumbers_status", new ArrayList<>()); | ||
Map<String,List<Map<String,String>>> outerMap = JavaxJson.fromJson(payload,Map.class); |
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.
What's the motivation for implementing a generic json parser if we know the json format to be expected. Can't we traversing the known structure with a JsonReader.readMap() and continue from there the same way as you do with the explicit mapping operations below?
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.
+1 Can we not simply parse the entire JSON into HashMaps and ArrayLists with a single operation? I think this approach is suitable if unmarshalling into custom classes, but gson (and other libraries) should natively parse into HashMaps and ArrayLists.
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.
Right, I have updated the library to Gson and removed the generic parsing.
if (payload != null) { | ||
Map<String, List<Map<String, String>>> result = new HashMap<>(); | ||
result.put("hostname_portnumbers_status", new ArrayList<>()); | ||
Map<String,List<Map<String,String>>> outerMap = JavaxJson.fromJson(payload,Map.class); |
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.
+1 Can we not simply parse the entire JSON into HashMaps and ArrayLists with a single operation? I think this approach is suitable if unmarshalling into custom classes, but gson (and other libraries) should natively parse into HashMaps and ArrayLists.
/gcbrun |
Pipeline Report
View details in Cloud Build (permission required) Commit version: 5b5b4e5 |
/gcbrun |
Pipeline Report
View details in Cloud Build (permission required) Commit version: ac590b6 |
/gcbrun |
Pipeline Report
View details in Cloud Build (permission required) Commit version: 1db14cc |
/gcbrun |
Pipeline Report
View details in Cloud Build (permission required) Commit version: 83f4c98 |
Description
What's changed, or what was fixed?
Issues Fixed
Housekeeping
(please check all that apply [x], do not edit the text)
Full Repo Validation Required
(please check all that apply [x], do not edit the text)
CC: @apigee-devrel-reviewers