Skip to content
Snippets Groups Projects
Unverified Commit 04dac019 authored by adam-james's avatar adam-james Committed by GitHub
Browse files

Add Temporal Units List to Dashboard Parameters Schema (#44454)

* Add Temporal Units List to Dashboard Parameters Schema

Closes: #44361

This adds an entry to the Dashboard Parameter schema so that we can validate
the list of temporal_units that might be passed from the frontend when adding
or updating the `Unit of Time` type parameters.

* This is the way

the real reason the schema wasn't working... well, it was, but the un-decoded versoin of parameters was being passed
to `update-dashboard` because inside defendpoint, you can use map destructuring and bind the whole map to whatever
with :as keyword.

If you decode/validate on all of the symbols in the destructuring, that's great, but if you then pass the map bound
with `:as whatever`, you don't get that decoded goodness, just the data that our http middleware produces (that is, it
might not be the shape you expect).

So, here I've created a private Schema for the :body of the request and use the same schemas to validate each key in
that map. The result should be the same but we can pass a fully decoded/validated map along.

* change test to look for the error in the right place
parent 20ab934f
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment