Skip to content

Custom types not supported in HAL FORMS properties description #1697

Closed

Description

@Ickbinet

At the moment HalFormsPropertyFactory.createProperties will convert all types not known by HtmlInputType to null.
This prevents the use of possibly new html input types and of custom types.

Activity

  1. odrotbohm commented on Nov 1, 2021

    @odrotbohm
    Member

    The HAL FORMS spec defines a set of supported types, which are all included in the HtmlInputType constants. Can you elaborate on the problem you see? Do you think we should actively reject invalid input types and consider this a programming error?

  2. self-assigned this
    on Nov 1, 2021
  3. Ickbinet commented on Nov 1, 2021

    @Ickbinet
    Author

    I am not sure if "possible settings" the spec means MUST or SHOULD.
    HtmlInputType already supports more than these (e.g. file).

    Possible solutions would be:

    • reject all values not supported by HtmlInputType
    • Change the return type of PropertyMetadata.getInputType() from String to HtmlInputType
    • allow any string - which I would prefer.
  4. odrotbohm commented on Nov 1, 2021

    @odrotbohm
    Member

    The spec doesn't define anything but the listed types supported, so we don't support any other types. I suggest asking for clarification on the spec bug tracker. I prefer to add support for stuff outside the spec after clarification. We can always loosen the constraints. Allowing something to be expressed and moving back later breaks APIs.

    PropertyMetadata.getInputType()can't be of type HtmlInputType because the former is media type agnostic. That HtmlInputType is used for HAL FORMS is an implementation detail as accidentally HAL FORMS aligns a lot with the HTML spec. Other media types don't.

    Edit: the reason we went for not-supporting anything but the values in the spec is this sentence in the referenced section:

    It is an enumerated attribute.

    Enumerated means a value within a pre-defined set of potential values. The rest of the section goes into detail how the client should behave that it doesn't understand one of the (defined) values. It doesn't specify anything about what's supposed to happen if a value not in the provided list appears.

  5. changed the title [-]HalFormsPropertyFactory only allowes types which are implemented by HtmlInputType[/-] [+]HalFormsPropertyFactory only allows types which are implemented by HtmlInputType[/+] on Nov 1, 2021
  6. Ickbinet commented on Nov 1, 2021

    @Ickbinet
    Author

    OK, now that it's quite clear the the type list in the spec is not exhaustive (mamund/hal-forms#88), I reopen the issue.

  7. changed the title [-]HalFormsPropertyFactory only allows types which are implemented by HtmlInputType[/-] [+]Custom types not supported in HAL FORMS properties description[/+] on Nov 1, 2021
  8. added
    in: mediatypes
    and removed on Nov 1, 2021
  9. added this to the 1.4 GA milestone on Nov 1, 2021
  10. added a commit that references this issue on Nov 2, 2021
  11. odrotbohm commented on Nov 2, 2021

    @odrotbohm
    Member

    That's fixed and backported to 1.3.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: mediatypestype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions