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

Message.parse_obj(d) inconsistent with MessageDecoder.decode_obj(d) #105

Open
anschweitzer opened this issue Feb 24, 2023 · 0 comments
Open

Comments

@anschweitzer
Copy link
Collaborator

anschweitzer commented Feb 24, 2023

Problem events from drivers have a src object that isn't the scada, and when parsed in gridworks-debug-cli, these end up with Src from the Event, even though the received Header has the correct Src of the generating scada. Does the decoder do this?

For example:

d = {
    "Header": {"Src": "FOO", "MessageType": "."},
    "Payload": {"Src": "BAR",},
}

m = Message.parse_obj(d)
assert m.src() == "BAR"

d["Header"] = Header.parse_obj(d.get("Header", dict()))
m = Message.parse_obj(d)
assert m.src() == "BAR"

d["Src"] = "FOO"
m = Message.parse_obj(d)
assert m.src() == "FOO"

I believe all of these should have src of "FOO".

If they aren't consistent that should be documented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant