core-java
core-java copied to clipboard
Validate filtering client queries on the client
Suppose I want to subscribe to messages of a certain type filtering by the value of a field. Suppose I made a mistake in the name of the field. The mistake would result in server-side error because we don't validate the reference when the subscription is posted. This is:
- too late;
- hard to debug.
We need to have client-side validation of field references before the request is submitted to the server.
It can be made via a mix-in interface. We know the name of the type, we can obtain the descriptor of the message. Get the field reference and see if the field is there.