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

Fix message not restored in delete operations #284

Closed
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -390,8 +390,13 @@ public void visitOperation(Operation node) {
Object parent = this.lookupParentJson(node);
Object json = this.writeOperationBase(aaiNode);

JsonCompat.setPropertyNull(json, Constants.PROP_TRAITS); // prop
JsonCompat.setPropertyNull(json, Constants.PROP_MESSAGE); // prop
JsonCompat.setPropertyNull(json, Constants.PROP_TRAITS);
if (aaiNode.message != null) {
Object messageJson = writeMessageBase(aaiNode.message);
JsonCompat.setProperty(json, Constants.PROP_MESSAGE, messageJson);
} else {
JsonCompat.setPropertyNull(json, Constants.PROP_MESSAGE);
}
Comment on lines +393 to +399
Copy link
Member

Choose a reason for hiding this comment

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

So I think the way this should work is that the message child of the operation should be processed in a separate visit method called visitMessage. The reason we set nulls for the child property values at this level is to force the ordering of the properties in the resulting JSON.

So if there's a bug here, it's likely to be in the visitMessage method.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, I will revisit this and let you know my findings.

// PROCESS PARENT
JsonCompat.setProperty(parent, node.getType(), json);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"myChannel": {
"description": "This is myChannel description",
"subscribe": {
"summary": "Subscribe summary"
"summary": "Subscribe summary",
"message": {
"name": "bullshit"
Copy link
Member

Choose a reason for hiding this comment

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

Can we use less offensive test data? :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, copied from the issue test data.

}
}
}
}
Expand Down