Skip to content

feat: Add removeOptionalIfDefaultExists option#673

Open
sortA0329 wants to merge 2 commits intobcherny:masterfrom
sortA0329:removeOptionalIfDefaultExists
Open

feat: Add removeOptionalIfDefaultExists option#673
sortA0329 wants to merge 2 commits intobcherny:masterfrom
sortA0329:removeOptionalIfDefaultExists

Conversation

@sortA0329
Copy link
Copy Markdown

Fixes #558

This PR adds a new option, removeOptionalIfDefaultExists, which allows the code generator to omit the optional modifier for properties that have a default value in the JSON Schema. The enhancement includes updates to the CLI, documentation, and core parsing logic, and is covered by new end-to-end tests.

@calleli
Copy link
Copy Markdown

calleli commented Oct 27, 2025

Perfect timing!
I realized this morning that I was looking for this functionality :)

Would love to have this in place!

@yonatan2703
Copy link
Copy Markdown

When will this be merged and released?
We really want this feature

@calleli
Copy link
Copy Markdown

calleli commented Jan 13, 2026

When will this be merged and released? We really want this feature

I forked the repo and brought in this functionality and then installed it using patch-package. It does the trick for me in the meantime.

@sortA0329
Copy link
Copy Markdown
Author

@bcherny

I'd left this PR hanging since I no longer needed it, but it looks like there's more demand for it than I expected.
No rush, but if you get a chance, could you take a look?

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.

Remove optional flag in case of default in schema.

3 participants