Maxiviper117
Aarktype
•Created by Maxiviper117 on 4/1/2025 in #questions
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.
Pattern for extra keys:
Keys should match the format:
Where: -
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?25 replies