Skip to content

Revamp Friendly Error System's Parameter Validation #7178

Open
@sproutleaf

Description

@sproutleaf

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
  • Friendly errors
  • Other (specify if possible)

Feature Enhancement Details

Migrate the parameter validation flow in FES to Zod.

Main task list:

  • Use the new modular syntax for the param validator
  • Add test file for new param validator
  • Validate against real p5 constructors
  • Account for less frequently used types (i.e. AudioNode)
  • Handle schema generation for optional parameters.
  • Validate against real p5 constants.
  • Implement a distance calculation mechanism similar to scoreOverload that gives user the proper error message when parameter validation fails.
  • Update script that generates parameterData.json to further reduce the information load.

New bugs discovered / TODOs after introducing changes:

  • cursor's overload is different from expectation (a mix of constants and primitive types)
  • createAudio overload is an array of empty arrays
  • Add support for lerpPalette's parameter, see added paletteLerp #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

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions