Skip to content

Consider deprecating single-property schemas #2536

@ngokevin

Description

@ngokevin

Description:

Advantages:

  • Single-property components are inflexible in that you cannot add a new property to the schema without having it be a breaking change. I was looking at Alphatest addition #2297, and I couldn't add a new prop without a breaking change.
  • Less confusing having to guess if a component is single-property or multi-property, for example, is it hand-controls="hand: left" or hand-controls="left" (some controllers are single-prop, some are multi)? Is it gltf-model="src: #model" or gltf-model="#model" (some loaders are single-prop, some are multi). It's been inconsistent so I've seen people make mistakes including myself
  • Less documentation about schemas in the component API (https://aframe.io/docs/0.5.0/core/component.html#single-property-schema is a bit awkward to explain)
  • Reduced API surface/branching in the component API (e.g., if you do this, then it's single prop, if you specify this, it's multi prop)
  • Can delete a lot of code where we check isSingleProp in a lot of places in the core component code

If we do this, then we'd need to introduce a default property for cases such as position, rotation, scale that designates if the component value is used in single-prop mode:

schema: {
  position: {type: 'vec3', default: true}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions