Skip to content
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

Feature/affordances #340

Closed
wants to merge 36 commits into from
Closed

Feature/affordances #340

wants to merge 36 commits into from

Conversation

dschulten
Copy link
Contributor

Initial version of Affordance and AffordanceBuilder for spring-hateoas. Still everything in the original packages and with the original copyright notice, as discussed. To be decided if a message converter using Affordance should be in spring-hateoas and if so, which one. Uber[1] and Html[2] are candidates, but maybe it would be good if we start a different converter to work with Affordance from scratch.

[1] http://tinyurl.com/nslmlha
[2] http://tinyurl.com/ojmqfkg

@odrotbohm
Copy link
Member

Some initial observations:

  • some of the stuff in the action package seems to be quite HTML-specific. Is that stuff we can still use generally speaking or does it have to be generalized even more?
  • the annotation configuration style looks pretty nifty, we probably have to discuss the details in the call

@dilipkrish
Copy link

@dschulten @olivergierke 👍 for pushing this forward. Let me know if I can help in any way. I'm interested in this from the angle of adding hypermedia support for swagger (unlike the url centric wall of operations approach that it provides of the box.)

@dschulten
Copy link
Contributor Author

@dilipkrish it would be helpful if you start using the AffordanceBuilder for your intended purpose to see if the descriptors contained in the Affordance contain everything you need.

@dschulten
Copy link
Contributor Author

@olivergierke @aheusingfeld

  • the action package sounds HTML specific, but it isn't meant to be used by HTML only. I sticked to HTML wording since it is well-known, besides I certainly see HTML5 as a potential media type to render Affordances.
  • are there existing annotations we could use instead of having our own?

moved HTML5 input String constants from AnnotatedParameter to @input
reviewed Javadoc for Html specifics, clarified usage of Options interface
gregturn added a commit that referenced this pull request May 20, 2017
* Adds new Affordances API
* Introduces HAL-Forms, which uses affordances to automatically generate HTML form data based on marked up domain objects and controllers
Attempted rebase of review/affordances against master

Original pull-request: #340, #447
Related issues: #503, #334
gregturn added a commit that referenced this pull request 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
gregturn added a commit that referenced this pull request 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
gregturn added a commit that referenced this pull request Aug 11, 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
gregturn added a commit that referenced this pull request Aug 14, 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
gregturn added a commit that referenced this pull request Aug 15, 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

Polish
gregturn added a commit that referenced this pull request Aug 15, 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
gregturn added a commit that referenced this pull request Aug 15, 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
odrotbohm added a commit that referenced this pull request Nov 6, 2017
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.
gregturn added a commit that referenced this pull request Nov 6, 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 pushed a commit that referenced this pull request Nov 6, 2017
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.
gregturn added a commit that referenced this pull request Nov 6, 2017
Used IDE to migrate several Java 6 constructors to Java 8.
gregturn added a commit that referenced this pull request Nov 6, 2017
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.
gregturn added a commit that referenced this pull request Nov 6, 2017
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.
gregturn added a commit that referenced this pull request Nov 27, 2017
gregturn added a commit that referenced this pull request Nov 27, 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 pushed a commit that referenced this pull request Nov 27, 2017
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.
gregturn added a commit that referenced this pull request Nov 27, 2017
Used IDE to migrate several Java 6 constructors to Java 8.
gregturn added a commit that referenced this pull request Nov 27, 2017
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.
odrotbohm pushed a commit that referenced this pull request Nov 29, 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
odrotbohm added a commit that referenced this pull request Nov 29, 2017
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.
odrotbohm pushed a commit that referenced this pull request Nov 29, 2017
Used IDE to migrate several Java 6 constructors to Java 8.
odrotbohm pushed a commit that referenced this pull request Nov 29, 2017
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.
odrotbohm added a commit that referenced this pull request Nov 29, 2017
More Java 8 related cleanups (diamond operator etc.).
@gregturn
Copy link
Contributor

Superceded by #612 and resolved via 70448a8.

Final solution isn't precisely the same thing, but we plan to iterate over it in the near future and expand to support other mediatypes. Feel free to check the HAL-FORMS section of code and their corresponding unit tests.

Also, see monitor Spring HATEOAS Examples repo as we plan to add an Affordances example very soon.

@gregturn gregturn closed this Nov 29, 2017
@pivotal-issuemaster
Copy link

@dschulten Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

1 similar comment
@pivotal-issuemaster
Copy link

@dschulten Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@gregturn gregturn deleted the feature/affordances branch December 6, 2017 18:18
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.

None yet

6 participants