p5.js
p5.js copied to clipboard
Revamp Friendly Error System's Parameter Validation
Most Appropriate Sub-area of p5.js?
- [ ] Accessibility
- [ ] Color
- [ ] Core/Environment/Rendering
- [ ] Data
- [ ] DOM
- [ ] Events
- [ ] Image
- [ ] IO
- [ ] Math
- [ ] Typography
- [ ] Utilities
- [ ] WebGL
- [ ] Build process
- [ ] Unit testing
- [ ] Internationalization
- [X] Friendly errors
- [ ] Other (specify if possible)
Feature Enhancement Details
Migrate the parameter validation flow in FES to Zod.
Main task list:
- [x] Use the new modular syntax for the param validator
- [x] Add test file for new param validator
- [x] Validate against real p5 constructors
- [x] Account for less frequently used types (i.e. AudioNode)
- [x] Handle schema generation for optional parameters.
- [x] Validate against real p5 constants.
- [x] Implement a distance calculation mechanism similar to
scoreOverloadthat gives user the proper error message when parameter validation fails. - [x] Update script that generates
parameterData.jsonto further reduce the information load.
New bugs discovered / TODOs after introducing changes:
- [x]
cursor's overload is different from expectation (a mix of constants and primitive types) - [x]
createAudiooverload is an array of empty arrays - [x] Add support for
lerpPalette's parameter, see #6960 - [ ] Agree on a most appropriate way to format and present error messages (mostly done, might require more work upon Ken's feedback)
To be completed before wrapping up the project:
- [ ] Use the new parameter validation in p5
- [ ] Clean up old code
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!
Hi @sproutleaf ! Are you still working on completing the remaining tasks / would you recommend closing this issue? Thank you!