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

Validate payload data types #5

Open
Steditor opened this issue Jan 2, 2021 · 0 comments
Open

Validate payload data types #5

Steditor opened this issue Jan 2, 2021 · 0 comments

Comments

@Steditor
Copy link

Steditor commented Jan 2, 2021

The current typing of the optional validate method of commands assumes that the payload data is already checked for correct data types. As incoming messages by clients must never be trusted without data type checking, there should be a canonical way of doing so, e.g.

  • have the dispatcher call validate before setting the payload and have validate receive the payload as unknown data type. If the method returns true, the data can be trusted and is of the specified payload data type.
  • add a separate (optional) method to commands for checking the payload data, that is called by the dispatcher before setting the payload.

Either way the interface of Dispatcher.dispatch should then allow to pass unknown data.

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