Support for patternProperties #2707
dieseldjango
started this conversation in
Ideas
Replies: 1 comment
-
Related issue: #1944 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need to render forms for schemas that use patternProperties. I'm looking into implementing this and submitting a PR since I can't otherwise use this package. If anyone else is working on this let me know, perhaps we can collaborate?
After looking briefly at the code I'm thinking of an approach that extends the way additionalProperties are implemented. Update the code that checks for and deals with additionalProperties to be more generic and work for both additional and pattern props.
I'm thinking that for schemas with additional properties but no pattern properties the UI would remain as is today. If pattern props are present, the UI presents a choice of which pattern (or additionalProperties) is intended, and uses the associated schema to render the value. It could still auto-generate a default key value when adding a prop, but display validation indicating whether or not that key matches the selected pattern.
Also, when first rendering an existing prop, it should match against any patterns and determine which initial pattern should apply or fallback to the additional properties schema, if present.
Does this approach make sense? Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions