Figure out how to validate analytics input params
This is about FE requesting data for rendering the charts. In some cases the FE needs to send parameters to the BE, examples:
- date range (
String
-> needs to be casted toDate
) - group (should be present)
- project
- label ids (
Array
, should not be empty)
The BE needs to verify these parameters (maybe do type casting) and pass them down to the service. We need to find a standard way to validate/handle parameters. Options:
- Validate params at the controller level
- Validate params at the service level
Questions:
- Internal API, should we care about the validation error messages? (example:
project_id
parameter is missing)- User cannot fix this error, it's a bug: FE code didn't pass the
project_id
parameter.
- User cannot fix this error, it's a bug: FE code didn't pass the
Related issue: #32759 (closed)
cc @djensen