Skip to content

[Common Definitions] Only allow one default Form in formDefaults #2175

@benfrancis

Description

@benfrancis

PR #2173 will significantly simplify the Common Definitions proposal by flattening all definitions for Forms into a single formDefinitions member, and all defaults for Form objects into a single formDefaults member. I think this is a big improvement.

However, currently formDefaults can contain multiple default Forms (either as an array of strings referencing Form definitions, or possibly as an array of Forms). When formDefaults is an array rather than a Form it becomes more like defaultForms (i.e. a default set of Forms for every InteractionAffordance) rather than formDefaults (i.e. the default values for the Form object). When used like this, what appears to be a single Form in an InteractionAffordance can actually be expanded out into multiple Forms in non-obvious ways when parsed by a Consumer.

In my opinion having multiple defaults is confusing, non-obvious for a human reader of the Thing Description, makes expansion very complicated, and results in lots of weird edge cases when overriding Forms.

I would suggest that as a further simplification formDefaults (or defaultForm) should be a single default Form only.

Then as a rule of thumb for Thing Description authors:

  • If there is one default Form for all Forms in the Thing Description then define a default Form in formDefaults (either as a Form or a string referencing a form definition)
  • If there are multiple common Forms then define multiple definitions using formDefinitions and reference them from Forms

Although not always as compact in terms of total Thing Description size, this makes it much more explicit that an InteractionAffordance has multiple Forms, makes it more obvious which Forms are being overridden at the InteractionAffordance level, simplifies expansion, and removes a bunch of weird edge cases.

See #2165 (comment) for example Thing Descriptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    common definitionsdiscussions on the mechanisms to group more definitions and their defaults

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions