playcanvas / playcanvas/engine

Investigate function parameter validation for public Engine API

Open
#2,529 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

To help engine customers catch issues early instead of getting unhandled exceptions / undefined behavior, we should consider validating parameters passed into public API functions / possibly some internal functions.

Validation:

  • should run in the debug mode only to not impact performance
  • could be specified outside of the function and code generated in debug mode to do validation
  • ideally without having to add #ifdef
  • unified approach with unified error reporting
  • ideally should check parameter types, unexpected null / undefined parameters and similar

And likely some other validations - please add comments with ideas and suggestions on how this could be implemented.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by surveying public Engine API functions and the existing error-reporting approach, then determine whether debug-only type, null, and unexpected-parameter validation can use a unified implementation without #ifdef; done requires a concrete, agreed scope and implementation plan.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.