p5.js icon indicating copy to clipboard operation
p5.js copied to clipboard

Revamp Friendly Error System's Parameter Validation

Open sproutleaf opened this issue 1 year ago • 2 comments

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 scoreOverload that gives user the proper error message when parameter validation fails.
  • [x] Update script that generates parameterData.json to 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] createAudio overload 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

sproutleaf avatar Aug 15 '24 14:08 sproutleaf

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!

welcome[bot] avatar Aug 15 '24 14:08 welcome[bot]

Hi @sproutleaf ! Are you still working on completing the remaining tasks / would you recommend closing this issue? Thank you!

ksen0 avatar Jun 06 '25 09:06 ksen0