Closed adriansmares closed 5 years ago
I've encountered an issue with validator generation in the case of oneof fields - the validator does not seem to check if the field is nil or not.
oneof
The proto I've tested this with is https://github.com/TheThingsNetwork/lorawan-stack/blob/895d4920ebd1a2dc5207f45b70c3b83eb896df7d/api/applicationserver_pubsub.proto#L48-L53 (I've seen that the same validation is used for ApplicationUp).
ApplicationUp
The resulting validator code does not check for nil fields - see https://github.com/TheThingsNetwork/lorawan-stack/blob/895d4920ebd1a2dc5207f45b70c3b83eb896df7d/pkg/ttnpb/applicationserver_pubsub.pb.validate.go#L322-L349 . If Provider is set to nil, the default path is never taken, since nats is added in case no sub fields are specified.
Provider
nats
I've encountered an issue with validator generation in the case of
oneof
fields - the validator does not seem to check if the field is nil or not.The proto I've tested this with is https://github.com/TheThingsNetwork/lorawan-stack/blob/895d4920ebd1a2dc5207f45b70c3b83eb896df7d/api/applicationserver_pubsub.proto#L48-L53 (I've seen that the same validation is used for
ApplicationUp
).The resulting validator code does not check for nil fields - see https://github.com/TheThingsNetwork/lorawan-stack/blob/895d4920ebd1a2dc5207f45b70c3b83eb896df7d/pkg/ttnpb/applicationserver_pubsub.pb.validate.go#L322-L349 . If
Provider
is set to nil, the default path is never taken, sincenats
is added in case no sub fields are specified.