Skip to content

added pattern properties feature#33

Merged
lovasoa merged 3 commits into
lovasoa:mainfrom
piotrcieslak:pattern-properties
May 21, 2026
Merged

added pattern properties feature#33
lovasoa merged 3 commits into
lovasoa:mainfrom
piotrcieslak:pattern-properties

Conversation

@piotrcieslak
Copy link
Copy Markdown
Contributor

@piotrcieslak piotrcieslak commented Feb 26, 2026

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:

  • Extended ObjectEditor.tsx to render three distinct property types:
    regular, pattern, and additional properties
  • Extracted state logic into a dedicated handlePropertyToggle.tsx utility
    rather than keeping it inline
  • New button-toggle.tsx and input.tsx components for managing property
    toggles

@piotrcieslak
Copy link
Copy Markdown
Contributor Author

@ehxter
Hi, i resolved merge conflicts. Branch should be safe for merge now.

@piotrcieslak
Copy link
Copy Markdown
Contributor Author

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!

@lovasoa
Copy link
Copy Markdown
Owner

lovasoa commented May 20, 2026

Hi ! Yes, a human written description of the motivation behind the pr, why you think the feature is needed, motivation behind the ui and technical choices would be welcome.

currently the pr description is completely empty

image

@piotrcieslak
Copy link
Copy Markdown
Contributor Author

Owner

Of course, decription added!

Copy link
Copy Markdown
Owner

@lovasoa lovasoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@lovasoa
Copy link
Copy Markdown
Owner

lovasoa commented May 21, 2026

Here is what the default view looks like with this pr

image

There is not even enough space to display the two-word field description Personal information.
The super prominent new "Regular Properties:" title feels both unnecessary and confusing.
Overall, I think this PR suffers from a common problem in fully ai written changes: the place the new feature should take in the overall product hasn't been weighted correctly. Pattern properties are a niche feature, not the first thing that should jump to the eye when opening the app

And what it looks like today

image

It feels like this PR has not received enough human attention as to what the user experience should look like.

@piotrcieslak piotrcieslak requested a review from lovasoa May 21, 2026 11:45
@piotrcieslak
Copy link
Copy Markdown
Contributor Author

piotrcieslak commented May 21, 2026

Hey, thanks for your inputs. I've fixed everything you've mentioned. Base UI should look the same as before pattern properties chagnes. Headings appear only once pattern properties are configured. Toggle was moved to "extended" object view. Renaming bug has been fixed. Hope it's okay now.

Screenshot 2026-05-21 at 13 43 21 Screenshot 2026-05-21 at 13 43 28 Screenshot 2026-05-21 at 13 43 35 Screenshot 2026-05-21 at 13 43 41

@lovasoa lovasoa force-pushed the pattern-properties branch from 6be5565 to 5ae5b30 Compare May 21, 2026 12:50
@lovasoa lovasoa merged commit 79169bd into lovasoa:main May 21, 2026
3 checks passed
@lovasoa
Copy link
Copy Markdown
Owner

lovasoa commented May 21, 2026

I reimplemented it, and fixed the "required" bug: regexes are not allowed in the required property in json schema.

@piotrcieslak
Copy link
Copy Markdown
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants