Skip to content
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

Closed
wants to merge 8 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I removed the ignore_case.

  2. 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.

&& !IGNORE_FOLDERS.contains(subFolder);

try {
if (processSchema && !schemaMap.containsKey(schemaName)) {
Expand Down