spring-projects / spring-projects/spring-hateoas

Ordering of properties within a HAL forms template

Open
#1,114 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I am playing around with the new HAL forms functionality and I have a question. It appears that properties within the affordance templates are being sorted alphabetically losing the order specified on the POJO. I presume this will be by design.

My goal is to create a client which renders dynamic forms based on the response from the API but I would want to be able to control ordering from the server. A simple workaround I can see is a prefix on the name of the field (i.e. field1_firstName, field2_lastName, field3_email).

Is there a recommended approach for doing this? Is it possible to retain the order of the properties as defined in the POJO?

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

The issue names HAL forms and affordance templates but no files, tests, or entry points. Start by locating the code that generates template properties and any ordering-related tests; done means the supported ordering behavior and recommended approach are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api
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.