spring-projects / spring-projects/spring-hateoas

Allow for Hal Forms extensions following Chapter 7 of the spec

Open
#2,377 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
476
PR merge metrics
No merged PRs in 30d

Description

Hal-Forms describes extensibility of Hal Forms.

https://github.com/mamund/hal-forms/blob/master/index.asciidoc#7-extending-the-hal-forms-document

I would find it useful if it were possible to extend Hal Responses with custom attributes of https://github.com/mamund/hal-forms/blob/master/index.asciidoc#property-element. While it is possible to customize single existing Hal Form Property Attributes using the InputPayloadMetadata.customize function, it seems not possible to add additional attributes.

That would give implementers at least some of the flexibility Mike Amundsen has intended with chapter 7, e.g. to demonstrate a spring hateoas based working implementation of such an extension that could later become part of the spec.

Simple idea: a new annotation that allows additional key-value pairs on a field, sth like:

  @HalFormPropertyExtensions({
    @HalFormPropertyAttribute(name = "myProperty", value = "myValue"),
    @HalFormPropertyAttribute(name = "myProperty", value = "myValue")
  })
  private String schluessel;

Could probably also be achieved with @JsonAppend, now that I think about it. I'll let you know, and be it simply as a discussed extensibility of Spring Hateoas ;-)

Contributor guide

No contributing guide indexed for this repository

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 with the InputPayloadMetadata.customize extension point and the Hal Forms property-element rules in the linked Chapter 7 specification. Compare the proposed annotation approach with JsonAppend and define how custom key-value attributes should be represented; done means an implementer can add extension attributes to Hal Forms properties.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.