Commit Graph

734 Commits

Author SHA1 Message Date
Oliver Drotbohm
59b861b158 #1682 - Update changelog prior to release. 2021-10-14 16:57:06 +02:00
Josh Gough
994bf861d2 #1659 - Documentation fix in HalModelBuilder usage.
Changed ….halModel(order) to ….halModelOf(order) for plain entities.
2021-10-13 16:31:47 +02:00
Oliver Drotbohm
3d7458b5f6 #1662 - HAL FORMS template target must be a URL.
We now expand the affordance link before we add it to the HAL FORMS template.

Also see #1660.
2021-10-12 13:52:34 +02:00
Oliver Drotbohm
ab02d45b8e #1657 - Prevent IndexOutOfBoundException in WebConverters.
We now skip the registration of the default media type if no hypermedia types are activated in the first place. We previously assumed there'd be at least one media type configuration registered.
2021-10-12 13:14:08 +02:00
Oliver Drotbohm
eca7fc23e7 #1658 - Re-expose AnnotationMappingDiscoverer.
It's required from Spring Data REST.
2021-10-08 10:50:28 +02:00
Oliver Drotbohm
f0a000a07e #1652 - Tighten contracts for parameter values in MethodLinkBuilderFactory.linkTo(…).
If a parameter array is given to MethodLinkBuilderFactory.linkTo(…) methods, we now verify its correct length in correspondence to the method given. If no parameters are given at all, we automatically create a parameter value array of the required length.
2021-09-24 16:36:53 +02:00
Oliver Drotbohm
3b94d4b862 #1448 - Improve proxy creation in DummyInvocationUtils.
We now explicitly set the optimize flag on the ProxyFactory for class based proxies used to create dummy invocation proxies. Still needs the upgrade to Spring Framework 5.3.11 (spring-projects/spring-framework#27439, #1647) to create full effect.
2021-09-21 17:55:28 +02:00
Oliver Drotbohm
fe1657386d #1648 - Removed further deprecations. 2021-09-21 17:46:04 +02:00
Oliver Drotbohm
fc99a84439 #1639 - Javadoc polishing in preparation of stringer linting in JDK 17. 2021-09-21 14:20:50 +02:00
Oliver Drotbohm
690ea3e967 #1638 - Avoid trying to proxy Object for controller method dummy invocations.
On JDK 17, trying to proxy Object doesn't work anymore. We now simply return the interceptor that would've been applied to the proxy directly and detect that properly in requests to extract the LastInvocationAware instance.
2021-09-20 13:27:35 +02:00
Oliver Drotbohm
1ad6448c36 #1635 - Prepare changelog for 1.4 M3 release. 2021-09-16 15:06:28 +02:00
Oliver Drotbohm
60e7f2e04e #1608 - HAL FORMS templates now expose HTTP method in all caps.
See the RFC for details: https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.1.
2021-09-16 15:03:44 +02:00
Oliver Drotbohm
140ae541f6 #1609 - Avoid superfluous object creation in Link.valueOf(…).
We now avoid calling with…-methods for every attribute parsed from an RFC-8288 link string.
2021-09-16 11:28:00 +02:00
Oliver Drotbohm
2751b11acf #1607 - Polishing. 2021-09-14 11:43:31 +02:00
Oliver Drotbohm
7d763043d2 #1607 - Remove deprecations in Affordances. 2021-09-14 11:43:04 +02:00
Oliver Drotbohm
55aa4ff278 #1602 - Polish nullability for Link. 2021-09-14 10:17:26 +02:00
Oliver Drotbohm
cfd891ebf1 #1599 - Properly contextualize MapSuppressingUnwrappingSerializer.
According to FasterXML/jackson-databind#3272, we have to explicitly contextualize the delegate serializer we use for non-Map content in EntityModel.
2021-09-14 09:01:35 +02:00
Oliver Drotbohm
4705797322 #1402 - Properly create Property instances in PropertyUtils.
We now hand the already known property name (from the PropertyDescriptor) to the Property instance we create when inspecting classes for metadata. This avoids ambiguities stemming from the fact that Property assumes Java Bean style properties but Spring's BeanUtils also supporting Java Records style accessors. In special naming contexts like the one used in the test case, this can lead to properties considered "the same" as their accessor methods imply their name is the same.
2021-09-09 13:00:32 +02:00
Oliver Drotbohm
f891f3be6d #1598 - Fully prepare handler method values in link creation.
We now eagerly convert all request parameters and path variables into their String representation using the MVC ConversionService to make sure we can use all formatting metadata available on the parameters.
2021-08-27 17:41:47 +02:00
Oliver Drotbohm
8bec37c67c #1595 - Update changelog. 2021-08-12 10:24:31 +02:00
Oliver Drotbohm
748da756db #1591 - Polishing.
Port configuration lookup caching from HAL FORMS into HAL configuration.
2021-07-29 17:58:20 +02:00
Oliver Drotbohm
662dde692e #1591 - Support for custom media type aliases in HAL FORMS. 2021-07-29 17:58:20 +02:00
Oliver Drotbohm
db885baaff #1590 - Polishing. 2021-07-29 17:58:20 +02:00
Oliver Drotbohm
a1d2752dd0 #1590 - Support for explicit type information on CollectionModel.
We now allow explicit definition of a fallback collection element type on CollectionModel to be used in cases of an empty model, so that the RepresentationModelProcessor infrastructure can still reason about the element type and also invoke the processor for empty collection models.

Fixes #1590.
2021-07-29 17:58:17 +02:00
Oliver Drotbohm
db1cd5db16 #1485 - Ensure proper encoding for request parameter expansion.
We now use the encoding rules defined in RFC 6570 (URI templates, API introduced in #1583) to prepare request parameters added to the URIs rendered.
2021-07-28 22:42:08 +02:00
Oliver Drotbohm
d6d816d77b #1575 - Support for non-composite request parameters.
This commit introduces @NonComposite, an annotation to be used with collection or array typed @RequestParam handler method parameters. Using the annotation causes the rendering of request parameters to use the non-composite way of rendering URI template values (param=value1,value2) rather than the default, composite flavor of param=value1&param=value2.

A bit of polish in TemplateVariable, which now also exposes a prepareAndEncode(Object) method that renders a given value according to the rules defined in the URI template spec for the particular variable type and state (composite VS. non-composite).
2021-07-28 17:28:02 +02:00
Oliver Drotbohm
ce71b144a1 #1588 - WebMvcLinkBuilder.linkTo(Method, Object[]) now properly handles request parameters.
We now route calls to WebMvcLinkBuilder.linkTo(Method, Object[]) through the same infrastructure that linkTo(…) calls with a dummy method invocation are routed through. We construct a fake LastInvocationAware pointing to the given Method and parameters.
2021-07-21 10:02:51 +02:00
Oliver Drotbohm
ea720b4ba7 #1587 - Prepare 1.4 M1 release. 2021-07-14 23:32:28 +02:00
Oliver Drotbohm
f99d94f0c7 #467 - Polishing.
General house keeping.

Original pull request: #1576.
2021-07-14 17:46:47 +02:00
Réda Housni Alaoui
445d5fd4d8 #467 - AnnotationMappingDiscoverer now considers @RequestMapping(params = …)
We now inspect the static request parameters declared in the actual request mapping and apply those values when building URIs pointing to those methods.

Original pull request: #1576.
2021-07-14 17:46:08 +02:00
Oliver Drotbohm
8c4824245e #1583 - Full support for level 4 URI templates.
Significant rewrite of UriTemplate to bring it up to level for template variables. We now additionally support:

* Composite values correctly
* Prefix values
* Multi-value template variables
* Path-style parameters
* Label expansion with dot-prefix
* Reserved expansion

Unit tests have been enriched with all examples given in the corresponding RFC [0]. Template variable types have been aligned with the terminology used in the RFC. Currently differently named types have been deprecated in favor of the new ones.

The commit slightly changes the behavior in two different aspects:

1. Query parameter values are now encoded as described in the RFC. Previously, special characters like comma (,) have not been percent encoded but now are. To create comma-separated values, expand an array of values instead of a prepared String. I.e. instead of expanding {?sort} with "foo,asc", expand it with [ "foo", "asc" ].

2. The aspect of variable optionality has been deprecated as it doesn't actually exist for template variables. This causes expansions that were previously rejected (e.g. ones using {foo} in paths) are now not rejected anymore. This is due to the way that the expansions are defined in the RFC.

[0] https://datatracker.ietf.org/doc/html/rfc6570
2021-07-14 17:32:03 +02:00
Greg L. Turnquist
fff452cf8a #1557 - Polishing. 2021-07-06 17:24:41 +02:00
Greg L. Turnquist
33e853cbb5 #1557 - Add support for @DecimalMin and @DecimalMax.
Add support for decimal-based type validation constraints.
2021-07-06 17:24:41 +02:00
Oliver Drotbohm
08bc96493e #1540 - Avoid double curie-ing of HalModel embeds.
Embedded elements assembled through a HalModelBuilder expose those through a CollectionModel to make sure that the individual elements get grouped by their link relation and those potentially curied. To indicate a curie link needing to be added because of curied embeds, the serialization adds a magic link to the list of links of that CollectionModel. As the latter is unwrapped, an additiona _links block rendering a curie had been added to the representation rendering the JSON representation invalid, as it now contained two _links fields (the latter stemming from the actual links added to the HAL representation model).

We now tweak the CollectionModel returned to override ….add(Link) and rather route the magic link to the outer representation model, causing the inner one to never accumulate any links in the first place and thus not render an invalid _links.
2021-06-30 10:59:31 +02:00
Kyle Hoehns
ce36feeb8c #1475 - Fix custom media type parser documentation.
Documentation for `HypermediaMappingInformation.getMediaTypes` expects to return a `List<MediaType>` which is not shown in the ref docs. Amend it with a proper parsing API as well as formatting.
2021-06-29 17:13:31 -05:00
larsw
5cf9fd1c29 #1562 - Add MARKDOWN as a supported Alps documentation format.
Per section 2.2.5 of the ALPS spec, `markdown` is a valid value for the `format` field.
2021-06-29 16:56:57 -05:00
Oliver Drotbohm
c6a6d370ad #1563 - Deprecate PayloadMetadata.getPropertyMetadata(…).
This method is currently used in test cases only and the just introduced ability to rename property makes the method not reliably usable as the way it is named doesn't convey which name is to be used. It currently is the potentially renamed value. Moving to the actual property name as input creates stronger boundaries to assume a type backing the metadata, which we want to avoid.
2021-06-29 16:15:24 +02:00
Oliver Drotbohm
8347554969 #1563 - Consider @JsonProperty-defined property name.
We now consider Jackson's @JsonProperty annotation to rename PropertyMetadata instances accordingly.

Original pull request: #1594.
2021-06-29 16:15:20 +02:00
Florian Cramer
a77c6e1593 #545 - Support for implicitly not required request parameters.
Handler method parameters annotated with @RequestParam(defaultValue = …) are implicitly not required and thus should still be advertised in the URI templated generated. Previously it was necessary to explicitly set @RequestParam(required = …) to false.

Original pull request: #1511.
Related ticket: #331.
2021-06-28 09:34:32 +02:00
Oliver Drotbohm
9702527786 #1548 - Delay request parameter variable lookup until necessary.
We pulled up the parameter name lookup for request parameters to avoid repeated lookups but unfortunately missed that the lookup will fail e.g. for @RequestParam Map<…> as we now strictly tried to find a request parameter name that doesn't actually exist in this case.
2021-06-18 14:48:07 +02:00
Oliver Drotbohm
d22629fd0b #1529 - Make WebConverters public. 2021-05-12 13:04:24 +02:00
Oliver Drotbohm
b03944be91 #1523 - Additional HtmlInputTypes (checkbox, radio, file). 2021-04-20 23:48:42 +02:00
Oliver Drotbohm
5764648adb #1515 - Fix key rendering of embedded resources.
We now also eagerly map the keys for the _embedded map in a HAL response to Strings to make sure they work properly when sorting of map keys is activated for the Jackson ObjectMapper.
2021-04-20 12:51:38 +02:00
Oliver Drotbohm
d7ac32a99d #1521 - Allow HATEOAS bootstrap without any default media type enabled.
@EnableHypermediaSupport(types = {}) was not working anymore as the Comparator implementation working with the selected types rejected an empty list. We now do not reject that anymore to enable applications that solely work with third party media types.
2021-04-19 16:53:46 +02:00
Oliver Drotbohm
91e17f1196 #1516 - Support for NamingBase in property translation for HAL.
We now also support the newly NamingBase introduced in Jackson 2.12 as a replacement for PropertyNamingStrategyBase.
2021-04-14 09:39:31 +02:00
Oliver Drotbohm
e939852362 #1515 - Fix HAL link serialization issues when Jackson map entry sorting is enabled.
Prior to this commit, the map of links to be rendered would key by LinkRelation. Unfortunately, Jackson requires `Map` keys to implement `Comparable` in case `SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS` is enabled. We now use the link relation's value as key right aways as Strings are comparable out of the box.

Switched to use Spring's MultiValueMap to avoid having to deal with the value list initialization ourselves.
2021-04-14 09:33:20 +02:00
Oliver Drotbohm
ebcbaeb7cc #1514 - Prepare changelog. 2021-04-13 19:41:47 +02:00
Oliver Drotbohm
bbb8f426fe #1510 - Support for defining the selected value on HalFormsOptions.
We now expose a HalFormsOptions.withSelectedValue(…) and propagate this into the HAL FORMS property field named "value".
2021-04-08 13:08:50 +02:00
Greg L. Turnquist
39775148dd #1509 - Migrate to main branch.
Move all project references to `main` instead of `master`.
2021-04-08 12:46:06 +02:00
Oliver Drotbohm
43b9f29ee8 #1507 - Fix potential NullPointerException in Jsr303AwarePropertyMetadata.
We now check whether we could really load `@Range`, which is only available in Hibernate Validator. An arrangement in which the Validation API JAR is on the classpath but not Hibernate Validator would let us end up with the relevant instance being `null` and need a check for before being handed into code that requires the type to not be `null`.
2021-04-03 17:16:23 +02:00