-
Notifications
You must be signed in to change notification settings - Fork 49
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
Ignore schema for all reply_ subtypes #1058
Conversation
@@ -728,7 +728,8 @@ private ReportingDevice validateMessageCore(Object messageObj, Map<String, Strin | |||
writeDeviceOutCapture(messageObj, attributes, deviceId, schemaName); | |||
|
|||
String subFolder = attributes.get(SUBFOLDER_PROPERTY_KEY); | |||
boolean processSchema = !IGNORE_FOLDERS.contains(subFolder); | |||
boolean processSchema = !SubType.REPLY.value().equalsIgnoreCase(schemaName) |
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.
Why the ignore case? Generally we should be pedantic about case matching (just avoids confusion elsewhere).
Also, I'm just generally confused how this works... because SubType would be reply
but the schemaName would be something with a reply_
prefix? -- so they never would be equal irrespective of case, so this change seems like a no-op?
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.
-
I removed the ignore_case.
-
Particularly for reply_update, there's this condition in function messageSchema() which would return 'reply' as the schemaName - so I had made the comparison with schemaName. I have fixed it and changed it to compare with subType instead.
private String messageSchema(Map<String, String> attributes) {
String subFolder = attributes.get(SUBFOLDER_PROPERTY_KEY);
String subType = attributes.get(SUBTYPE_PROPERTY_KEY);
if (SubFolder.UPDATE.value().equals(subFolder)) { <-------
return subType;
}
I need some suggestions on how I can test this change. So far, I have created a test schema under tests/traces/simple under an existing device GAT-123 with the name 005_reply_update.json.
@@ -798,6 +800,11 @@ public void validateDeviceMessage(ReportingDevice device, Map<String, Object> me | |||
Map<String, String> attributes) { | |||
String schemaName = ofNullable(attributes.get(SCHEMA_NAME_KEY)).orElseGet( | |||
() -> messageSchema(attributes)); | |||
|
|||
if (SubType.REPLY.value().equals(attributes.get(SUBTYPE_PROPERTY_KEY))) { |
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.
maybe extract this to a function shared with the other place, so that the logic behind this is only in one place!
@@ -0,0 +1,20 @@ | |||
{ | |||
"gateway" : { }, |
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.
hmmm -- this doesn't look like the body of a reply message, it looks like a model message of some kind. Where did you get it from? Shouldn't really matter since the filter is all on the subType, but probably a good idea to have it be representative!
@@ -0,0 +1,13 @@ | |||
{ | |||
"timestamp" : "1999-10-20T01:02:03Z", |
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.
hmmm -- maybe I'm missing something here but I thought there would not be a reploy.out since it's filtered out?
No description provided.