Skip to content

#340 - Adds new Affordances API + HAL-Forms mediatype #612

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

Closed
wants to merge 5 commits into from

Conversation

gregturn
Copy link
Contributor

@gregturn gregturn commented Jul 28, 2017

  • Introduces new Affordances API to build links related to each other to serve other mediatypes
  • Introduces HAL-Forms, which uses affordances to automatically generate HTML form data based on Spring MVC annotations.

Original pull-request: #340, #447, #581
Related issues: #503, #334, #71

@gregturn gregturn force-pushed the feature/hal-forms branch from 72cd3f3 to 02d188c Compare July 28, 2017 19:21
@gregturn gregturn requested a review from odrotbohm July 28, 2017 19:22
@gregturn gregturn force-pushed the feature/hal-forms branch 3 times, most recently from f96f034 to be4649e Compare August 15, 2017 14:34
@gregturn gregturn force-pushed the feature/hal-forms branch 2 times, most recently from 3eb64ac to f5bf966 Compare August 15, 2017 17:43
@odrotbohm odrotbohm added this to the 1.0 M1 milestone Oct 13, 2017
@gregturn gregturn force-pushed the feature/hal-forms branch 2 times, most recently from 544edcd to 217cd66 Compare November 6, 2017 21:59
@gregturn
Copy link
Contributor Author

gregturn commented Nov 6, 2017

@olivergierke I rebased this PR and got all the test cases to work (again). Also migrated many MORE test cases to AssertJ in the process. It has probably undone some of your polishing from the 2nd commit.

Additionally, I used the IDE to complete several other polishings that are Java 8-based, and that is the 3rd commit. I can understand if you'd prefer cherry picking that separately.

Also, all of this work somehow caused an ALPS test case to break simply due to Jackson and property ordering. I looked up the ALPS spec and adjusted the serializer to order things properly and patched the test case. Again, I can understand opening a separate issue and cherry picking that commit as well.

As a side effect of reading the ALPS spec, it appears the "descriptors" should actually be "descriptor" so I opened #665 but opted to not go THAT far out of scope. :)

Hopefully we are close to merging things, however that needs to be done ultimately. Once done, I can certainly invest some effort in Spring Data REST's Lovelace version to enhance all those controllers to leverage affordances and have an instant increase in usability before circling back to more mediatypes. ;)

gregturn and others added 5 commits November 27, 2017 15:55
* Introduces new Affordances API to build links related to each other to serve other mediatypes
* Introduces HAL-FORMS, which uses affordances to automatically generate HTML form data based on Spring MVC annotations.

Original pull-request: #340, #447, #581
Related issues: #503, #334, #71
Moved AffordanceModelFactory into core package as it's SPI. Switched to Spring Factories lookup of implementation classes so that we avoid a package dependency between the MVC package and the media type specific packages. Removed reference to MediaType from AffordanceModelFactory to AffordanceModel so that a factory can even provide models for different MediaTypes (i.e. different flavors of the same one, e.g. HAL Forms for JSON and XML). Also removed addAffordanceModel(…) from Affordance to not force the implementations into mutability. Made most of the affordance building API types package protected. HalFormsAffordanceModel now uses MethodParameters abstraction to simplify model parsing code.

Tweaked HAL forms model to work with factory methods for required properties and wither methods to add optional properties. Tweaked and inlined mixin types in Jackson module for HAL forms.

Slight API polishing on Link to make sure Affordance collecting methods are not named with….

Tweaked Lombok setup to use all caps for logger constants. Removed deprecation warnings in Jackson2HalModule.
Used IDE to migrate several Java 6 constructors to Java 8.
Side effect of upgrading Jackson appears to be arbitrary change in order of property serialization. This commit forces the order to match the spec and fixes the related test cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants