Validating Dynamodb Data with Projections and Schema

I have the following use case: I retrieve some data from dynamodb using projections (aka paths for properties, like "a.b" for accessing the b property inside a).

Projections are typed and I have a schema for the dynamodb table. I'd like to have the returned response validated with a schema filtered by the projections.

At the moment there's pick for selecting single keys and partial for making 1 level deep partial the struct defined by a schema. How should one approach this problem?

At first I thought about making the schema completely partial (deep), cause that should be sufficient since dynamodb retrieval breaks if you ask for a key which doesn't exist. Alternatively, one could recreate a schema by picking properties from dot separated properties string like a.b but it looks like a lot of schema construction at runtime. Not sure what would the best option be.
Was this page helpful?