-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip populate function proposal in Experimental_ArrayMinItems #4121
Skip populate function proposal in Experimental_ArrayMinItems #4121
Conversation
@MarekBodingerBA I like the concept. The name |
Perfect, that all makes sense! However, how should I proceed with a playground example? People should provide their own code. I am not sure I should add code input to the playground. |
Great question! Thinking about it more, this isn't a toggle on situation like the rest of the experimental options. So maybe a playground example just doesn't make sense. |
… custom logic to skip populating arrays with default values
Implemented as you requested, feel free to give a feedback. |
@MarekBodinger Great work... I've added a few suggetions for documentation changes. Also, can you rebase and resolve conflicts |
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
Thank you, I committed the suggestions and merged main. |
Reasons for making this change
As we use our custom implementation of file upload, we would like to have case-by-case method how to control population of arrays in
Experimental_ArrayMinItems
(and there might be need from others with advanced usages).Our files implementation yields this schema:
https://github.com/bratislava/konto.bratislava.sk/blob/8ce56b7fa4a62c7dd67351b617ba5ad13bc363b8/next/schema-generator/generator/functions.ts#L372
We would like to use
{ populate: 'requiredOnly' }
. It works fine for our multiselects and checkbox group, as they are handled by the isMultiSelect condition, but it populates our files array with[null]
. Therefore I would like to implementskipPopulate
(name is up for consideration) function that would allow us to have a custom logic to skip population similar to whatisMultiSelect
does.As a temporary solution, we have our own fork that allows us to add
overrideArrayMinItemsBehaviour
to schema, but this might be better and more scalable solution.What do you think? Should I continue with this idea?
Checklist
npm run test:update
to update snapshots, if needed.