added pattern properties feature#33
Conversation
|
@ehxter |
|
Hi, just checking in to see if there’s anything else needed from my side to move this pull request forward. Let me know if you’d like me to address anything! |
Of course, decription added! |
lovasoa
left a comment
There was a problem hiding this comment.
AI-written review, requested by the maintainer.
Thanks for adding support for patternProperties; the underlying feature is useful, but I don't think this UI should merge as-is.
The current implementation makes patternProperties much too prominent in the common case. src/components/SchemaEditor/types/ObjectEditor.tsx:159 and src/components/SchemaEditor/SchemaFieldList.tsx:173 add large Regular Properties: headings whenever an object has normal properties, and src/components/SchemaEditor/SchemaPropertyEditor.tsx:192 adds a Regular / Pattern toggle to every property row. Most schemas only have JSON Schema properties, and users do not normally think of them as "regular properties"; they are just properties. Adding these labels everywhere makes ordinary schemas harder to scan and gives a rare/advanced feature the same visual weight as type and required/optional.
The wording also needs rethinking before it is translated. Regular Properties is awkward in English and becomes even more confusing in other languages, for example Propriétés Régulières in French. The disabled-required tooltip also points users to the Regular Properties section, so the confusing distinction leaks into help text as well.
I would prefer a simpler design: keep the existing property list visually unchanged for schemas that only use properties; only show a Pattern properties subsection when patternProperties actually exists; avoid a Regular badge/toggle on every row; and use Properties for normal properties rather than inventing a new user-facing term.
There is also an implementation issue in src/components/SchemaEditor/types/ObjectEditor.tsx:89: handlePropertyNameChange always searches properties, even when isPatternProperty is true, so renaming a pattern property will not find the field and will silently do nothing.
6be5565 to
5ae5b30
Compare
|
I reimplemented it, and fixed the "required" bug: regexes are not allowed in the required property in json schema. |
|
Thank you! |







This feature allows to define object keys as regexes and is useful where we don’t want to define every possible key in schema but simply provide a pattern as regex. Here you can find more about feature itself: https://tour.json-schema.org/content/03-Objects/01-Pattern-Properties
In our configurations where we use your tool we have a lot of objects that needs structured keys and defining every single one would be painful.
Most important changes:
regular, pattern, and additional properties
rather than keeping it inline
toggles