-
Notifications
You must be signed in to change notification settings - Fork 472
Ordering of properties within a HAL forms template #1114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
While I sympathize with your desire to control the order of properties on an HTML form, it appears that the code that retrieves properties of a POJO are found in the Spring Framework ( spring-hateoas/src/main/java/org/springframework/hateoas/mediatype/PropertyUtils.java Lines 201 to 208 in fc1b4a8
There is no form of sorting done inside Spring HATEOAS, so I don't see how to affect any changes. |
I wonder if In general any kind of reflection lookup of properties does not regard any declaration orders as in the reflection API methods do not guarantee any order of the results at all. |
With options for a “strict” mode that ONLY applies to the specified type, and perhaps an “inherited” mode that does an instanceof check? |
Register various patterns of sorting based on types.
Register various patterns of sorting based on types.
Register various patterns of sorting based on types.
Register various patterns of sorting based on types.
Register various patterns of sorting based on types.
Register various patterns of sorting based on types.
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?
The text was updated successfully, but these errors were encountered: