aframevr / aframevr/aframe

Eliminate single-property schemas.

Open
#4,009 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
17.6k
Forks
4.4k
PR merge metrics
No merged PRs in 30d

Description

Description:

Supporting both single and multi prop schemas have made it so most A-Frame internal-related codepaths (and stuff like Inspector, aframe-react) need to branch and check to support both, often causing bugs.

Also causes API breakages when a component decides to go from single to multi prop.

We can eliminate single-prop schemas.

To support components such as visible or perhaps position, we can perhaps have components specify a designated "default property". Where if only a plain value is passed into setAttribute (e.g., true), it will set the designated property.

registerComponent('visible', { 
  schema: {
    visible: {default: true, primary: true}
  }
});

// setAttribute('visible', true);
// equivalent to setAttribute('visible', 'visible', true);
registerComponent('position', { 
  schema: {
    position: {type: 'vec3', primary: true}
  }
});
// setAttribute('position', '0 0 1');
// equivalent to setAttribute('visible', 'position', '0 0 1');
// or we can split to X / Y / Z...

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

Start by tracing the registerComponent schema handling and the setAttribute paths described in the issue, including consumers such as Inspector and aframe-react. Determine how single- and multi-property schemas currently branch, then define the intended primary-property behavior and compatibility requirements before implementation. Done means the schema model no longer needs separate single-property handling while the proposed plain-value usage remains supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-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.