Key validation on arbitrary number of properties.
I'm working on validating an object where:
- Some property keys are known and expected.
- Other extra/unknown keys are allowed only if they follow a specific pattern.
Where:
-
Here's the regex I'm using:
- Some known, explicitly typed keys.
- And any number of extra keys that match the regex pattern above?
- Some property keys are known and expected.
- Other extra/unknown keys are allowed only if they follow a specific pattern.
Pattern for extra keys:
Keys should match the format:metafield.<namespace>.<key> Where:
-
namespace and key can contain alphanumeric characters, underscores, or hyphens.Here's the regex I'm using:
Example payload:
Question:
How can I define a Arktype type that allows:- Some known, explicitly typed keys.
- And any number of extra keys that match the regex pattern above?
