eclipse-uprotocol / up-cpp

uProtocol Language Specific Library for C++
Apache License 2.0
15 stars 25 forks source link

UMessage validator isValid() will always return WRONG_MESSAGE_TYPE for invalid (non-notification) messages #178

Closed gregmedd closed 3 weeks ago

gregmedd commented 3 weeks ago

The current implementation of isValid() checks validity for each message type, returning true on the first valid message. At the end, it returns whatever is returned by isValidNotification(). For any message that is not of notification type, the reason returned will always be WRONG_MESSAGE_TYPE. This is not particularly helpful in diagnosing an error with a message.

Since a message can only have one type, we can assume that any reason that is not WRONG_MESSAGE_TYPE is probably the right reason the message failed validation.