Skip to content

fix: do not omit patternProperties when properties is undefined#1203

Merged
asyncapi-bot merged 3 commits intoasyncapi:masterfrom
theAnuragMishra:patternproperties
Mar 14, 2026
Merged

fix: do not omit patternProperties when properties is undefined#1203
asyncapi-bot merged 3 commits intoasyncapi:masterfrom
theAnuragMishra:patternproperties

Conversation

@theAnuragMishra
Copy link
Copy Markdown
Contributor

Description

Changes proposed in this pull request:

  • the current implementation of SchemaProperties component skips and returns null if properties is undefined which shows no patternProperties even if they are present
  • this pr converts properties and patternProperties to empty objects in case they are undefined. If there's nothing to show, Object.entries maps nothing and nothing is rendered which is desired.
  • this fixes the bug where patternProperties is omitted when properties is undefined.

Related issue(s)
closes #1197

@theAnuragMishra
Copy link
Copy Markdown
Contributor Author

@derberg can you pleaseee ehave a look? it's been so looong (the original pr was #1199 )

Copy link
Copy Markdown
Member

@AceTheCreator AceTheCreator left a comment

Choose a reason for hiding this comment

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

Left you a review :)

Comment thread library/src/components/Schema.tsx
@theAnuragMishra
Copy link
Copy Markdown
Contributor Author

@AceTheCreator so you ignore the pr for a month, come and suggest a change to remove empty fragment possibility and then disappear again? If you don't like useful prs and are only interested in reviewing prs that shift a div from one place to the other, please feel free to close the pr. Don't keep someone hanging for so long for a pr that's not even 10 lines of change.

@AceTheCreator
Copy link
Copy Markdown
Member

@AceTheCreator so you ignore the pr for a month, come and suggest a change to remove empty fragment possibility and then disappear again? If you don't like useful prs and are only interested in reviewing prs that shift a div from one place to the other, please feel free to close the pr. Don't keep someone hanging for so long for a pr that's not even 10 lines of change.

Are you aware that your PR test failed? Please refrain from accusations like this moving forward. Thank you

@AceTheCreator
Copy link
Copy Markdown
Member

Also, there wasn’t a clear signal that your PR was ready for another review since the conversation hadn’t been resolved.

Please don’t place the blame on me, or any maintainer, for that. It’s important we follow the process so everyone stays aligned. At the end of the day, it’s open source; let’s keep it constructive and not take things personally.

@theAnuragMishra theAnuragMishra force-pushed the patternproperties branch 2 times, most recently from 67b0ad4 to cec886d Compare February 12, 2026 13:47
@theAnuragMishra
Copy link
Copy Markdown
Contributor Author

Ok sorry. The pr was up for tooo long so i crashed out. The failing check was related to formatting which I have fixed. I think everything should be as expected now. Please have a look.

@theAnuragMishra
Copy link
Copy Markdown
Contributor Author

@AceTheCreator

Copy link
Copy Markdown
Member

@AceTheCreator AceTheCreator left a comment

Choose a reason for hiding this comment

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

One last review @theAnuragMishra. The potential issue I see with this current implementation is that if you only want to render when there's actual data, you might want to conditionally render each map individually.

@theAnuragMishra
Copy link
Copy Markdown
Contributor Author

theAnuragMishra commented Feb 16, 2026

conditionally render each map individually

so like, {properties.lenght > 0 && properties.map(...?
or are u suggesting two separate components for properties and patternProperties

@AceTheCreator

@theAnuragMishra
Copy link
Copy Markdown
Contributor Author

@AceTheCreator can u please collaborate on this for once and merge / close as needed?

@AceTheCreator
Copy link
Copy Markdown
Member

so like, {properties.lenght > 0 && properties.map(...?

Yes 👍🏾

@sonarqubecloud
Copy link
Copy Markdown

@theAnuragMishra
Copy link
Copy Markdown
Contributor Author

I don't think that's necessary. We return if both arrays are empty which means an empty fragment will never be rendered. properties.map or patternproperties.map do nothing if the array is empty.

@AceTheCreator
Copy link
Copy Markdown
Member

I don't think that's necessary. We return if both arrays are empty which means an empty fragment will never be rendered. properties.map or patternproperties.map do nothing if the array is empty.

Yea, that’s true if both arrays are empty (&&). But if only one of them is provided, the other would still render an empty fragment, no?

@theAnuragMishra
Copy link
Copy Markdown
Contributor Author

no, because .map on an empty array renders nothing, not even an empty fragment.

@AceTheCreator
Copy link
Copy Markdown
Member

no, because .map on an empty array renders nothing, not even an empty fragment.

Agreed 👍🏾

Copy link
Copy Markdown
Member

@AceTheCreator AceTheCreator left a comment

Choose a reason for hiding this comment

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

LGTM!

@AceTheCreator
Copy link
Copy Markdown
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit d3fd2b9 into asyncapi:master Mar 14, 2026
11 checks passed
@asyncapi-bot
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

patternProperties is ignored when properties is absent

3 participants