Closed TheSadlig closed 2 months ago
Hi @TheSadlig, thanks for the issue :)
For this version, a flag is indeed better and in a future version it could be a default behavior.
Feel free to propose a PR if you need this, as I don't have a lot of time in my hands actually.
Hello,
The definition for
required
in the asyncapi specification, and the validator'srequired
are different:Because of this behaviour, the validator cannot be used to validate most structs.
What I would recommend:
required
for non-pointer fieldsWithout the point 2., we have no way of knowing whether the incoming message was absent or not, since non-pointer struct will be initialized with empty/zero-value. This could be the default behaviour (in a future version ?), but since this would have large impacts on users, I figured having it opt-in was best for now
Thanks