Commit Graph

675 Commits

Author SHA1 Message Date
Oliver Gierke
3a6b9ea3ff DATAREST-699 - Fixed pageable parameters showing up as is in search resource links on Java 8.
We now explicitly drop parameters of type Pageable and Sort from being exposed as search resource parameters as they're added via the UriComponentsContributors anyway. This prevents "pageable" from showing up as parameter on Java 8 code compiled with -parameters. The latter adds naming information for the Pageable parameter and caused it showing up as is despite the fact that the UriComponentsContributor for Pageables exposes a dedicated syntax.
2015-11-06 16:36:47 +01:00
Oliver Gierke
35a86f7656 DATAREST-683 - Enum values are now correctly i18ned in ALPS.
If enum translation is enabled, ALPS descriptors now expose the translated values correctly.
2015-11-06 16:36:43 +01:00
Oliver Gierke
cc7bc7aa79 DATAREST-683 - ALPS documents are now correctly nested.
We now wrap the ALPS descriptors into a root ALPS JSON node.
2015-11-06 16:36:39 +01:00
Greg Turnquist
a93f68e227 DATAREST-684 - Added details on how to return a HAL document in reference documentation.
Original pull request: #199.
2015-11-02 16:30:19 +01:00
Oliver Gierke
9689b6716e DATAREST-686 - Set default encoding for resource description message source to UTF-8. 2015-11-02 11:59:56 +01:00
Oliver Gierke
1a68c94c04 DATAREST-693 - Updated changelog. 2015-10-14 14:02:32 +02:00
Oliver Gierke
619511d8fe DATAREST-674 - Defensively handle potential double slashes in lookup
path.

We now defensively replace all double slashes contained in the lookup
path as Spring 4.2 might return such paths due to a regression in
UrlPathHelper. This might occur if the original URL contains
intermediate matrix parameters (e.g. /books/;test/1) whose removal now
results in double slashes and thus the downstream repository metadata
lookup to fail.

Related tickets: SPR-13455.
2015-09-10 09:25:08 +02:00
Oliver Gierke
2a835c48fa DATAREST-665 - Prevent non-serializable properties from making it into the schema.
We now explicitly skip non-Jackson-serializable properties from being rendered in the schema. This prevents exceptions in rare cases where the Jackson BeanPropertyDefinition is only backed by a setter.

The issue occurred with current Spring Data Gemfire as it considers a BigDecimal a PersistentEntity and then failed to produce a proper ResolvableProperty for setScale(…) as it's a setter-only property.

Related tickets: SGF-429.
2015-09-08 15:15:07 +02:00
Oliver Gierke
468c7b4d12 DATAREST-669 - Include section on dependency management from Spring Data Commons into reference docs.
Related tickets: DATACMNS-762.
2015-09-03 18:20:32 +02:00
Oliver Gierke
228cc94331 DATAREST-665 - Switched to a more consistent scheme for I18N of JsonSchema.
We now use the following keys in the resource bundle to determine values for the title attribute of JSON schema property (in descending order of preference):

$fullyQualifiedClassName.$property._title
$simpleClassName.$property._title
$property._title

Also tweaked JsonProperty.format to make sure it always serializes as its toString() value.
2015-09-02 15:28:02 +02:00
Oliver Gierke
1906e10ca7 DATAREST-663 - After release cleanups. 2015-09-02 15:27:52 +02:00
Spring Buildmaster
a43ecf3795 DATAREST-663 - Prepare next development iteration. 2015-09-02 15:27:06 +02:00
Spring Buildmaster
1a38f96602 DATAREST-663 - Release version 2.4.0.RELEASE (Gosling GA). 2015-09-01 02:46:01 -07:00
Oliver Gierke
2dfce406e9 DATAREST-663 - Switched to Spring HATEOAS version property from build parent. 2015-09-01 11:28:41 +02:00
Oliver Gierke
e35313ad20 DATAREST-663 - Prepare 2.4.0.RELEASE (Gosling GA). 2015-09-01 09:44:22 +02:00
Oliver Gierke
83680b505e DATAREST-663 - Updated changelog. 2015-09-01 09:44:19 +02:00
Greg Turnquist
be67f3e5b0 DATAREST-627 - HAL Browser now uses JSON Editor view for resources exposing metadata.
In case a link relation's target exposes a profile link (via HTTP HEAD and "Link" response header), we now try to obtain a JSON schema from the target resource and use a custom view based on the JSON Editor library fro non-GET requests.

This creates a customized, user friendly pop-up dialog for data entry with a nice polished look. If there is no profile link, we use a fallback editor for raw JSON input.

Original pull request: #191.
2015-08-31 18:59:15 +02:00
Oliver Gierke
71cfe235ad DATAREST-662 - Polishing.
Simplified test case. Added author tags.
2015-08-29 15:32:42 +02:00
Valentin Rentschler
b7e650af5e DATAREST-662 - Tweaked UriStringDeserializer to work for polymorphic references. 2015-08-29 15:32:07 +02:00
Oliver Gierke
e7374697f1 DATAREST-363 - Fixed Resources setup for embedded values in PersistentEntityResource.
We're now creating a dedicated Resources inner class to be able to explicitly ignore the links of the embeds as they would cause the link attribute to be rendered when the unwrapping is applied in the custom JSON serializer.

Polished test case. Foxed Javadoc in PersistentEntityResource.Builder. Tweaked the TestDataPopulator to always reinitialize the data set to make sure the test cases see the expected data.
2015-08-29 14:50:43 +02:00
Greg Turnquist
22bbc6d305 DATAREST-363 - Added test cases exposing legacy format issue.
Added integration test to show the "links" attribute rendered twice in the legacy JSON format.
2015-08-28 18:29:38 +02:00
Oliver Gierke
a5ed63050f DATAREST-661 - Fixed non-existant resource detection for PATCH requests.
PATCH requests to non existing resource now correctly return 404 Not Found as PersistentEntityResourceHandlerMethodArgumentResolver.read(…) now correctly throws the ResourceNotFoundException.
2015-08-28 10:51:27 +02:00
Oliver Gierke
1c1766ba12 DATAREST-658 - HEAD requests now return resource links.
HEAD requests to both item and collection resource now return the top-level links as a Link header. Fixed HEAD requests to the item resource now use the raw domain object instead of the projected resource to calculate ETag and Last-Modified headers.
2015-08-22 20:10:51 +02:00
Oliver Gierke
8ed188cbc2 DATAREST-654 - Additional tweaks and tests for enum deserialization.
Made the EnumTranslatingDeserializer contextual to make sure we get access to the BeanProperty and thus the actual enum target type.
2015-08-21 17:03:27 +02:00
Oliver Gierke
9280a4e4b6 DATAREST-655 - Fixed type in exception message for parameter checks of ParameterMetadata. 2015-08-21 16:00:16 +02:00
Oliver Gierke
06b6b266db DATAREST-654 - Added suport for internationalization of enum values.
RepositoryRestConfiguration now exposes an option to enable enum value serialization and a nested configuration object to tweak the details.

If enabled, a Jackson serializer and deserializer is registered trying to resolve the enum values from the Spring Data REST resource bundle using the fully-qualified enum value name as key. If no explicitly configured value is configured a default translation is triggered that capitalizes the lowercased value name replacing the underscores with spaces (e.g. PAYMENT_EXPECTED -> Payment expected). This can be opted out of, of course.

On the parsing side the deserializer will also consult the resourcebundle and default translation but also accepting the enum name as is (also opt-outable).

Deprecated non-bean-style accessors for projection and metadata configuration on RepositoryRestConfiguration to make these options tweakable via Spring Boot application properties by default.
2015-08-21 15:22:27 +02:00
Oliver Gierke
39eb338025 DATAREST-651 - Upgraded to Spring HATEOAS 0.19.
Upgraded to snapshots of Spring HATEOAS to use the now extended constructor of HalHandlerInstantiator to be able to render title attributes for links.
2015-08-19 19:13:03 +02:00
Oliver Gierke
52a8d837f0 DATAREST-638 - Polishing.
Removed unnecessary dependencies from AlpsController. Minor formatting issues. Copyright years.

Original pull request: #196.
2015-08-19 11:44:49 +02:00
Greg Turnquist
345c198a75 DATAREST-638 - Consolidated metadata under a single profile link.
Moved /alps into a separate link underneath /profile, so that /schema can ALSO be served there as well. Also added a profile link to the collection resources, linking to collection-specific metadata. We now use strict content negotiation for each form of metadata so clients don't have to navigate a labyrinth of links. To preserve backwards compatibility, make ALPS the default metadata type.

Original pull request: #196.
2015-08-19 11:25:17 +02:00
Oliver Gierke
5f7f912e69 DATAREST-647 - Removed unnecessary lookup of the entity to update.
RepositoryEntityController.patchItemResource(…) triggered an additional, unnecessary lookup of the original entity to be updated. However the resolution algorithm for PersistentEntityResource already checks the presence and rejects an invalid identifier with a ResourceNotFoundException.

PersistentEntityResource now carries a boolean flag to expose whether the entity is about to be created. That allows us to avoid the additional lookup in the method handling PUT requests, too.

Related tickets: DATAREST-441.
2015-08-18 18:14:24 +02:00
Oliver Gierke
d4dbeb93a0 DATAREST-644 - Improvements to JSON Schema output.
Fixed JSON Schema output use "definitions" keyword instead of the previously used wrong "descriptors".

We now also include the title attribute for properties, using rest.description.$type.$property._title as i18n key. Titles are now also defaulted to the camel-case property name split up, lowercased and capitalized, e.g. "orderDate" will become "Order date".

JacksonMetadata now allows obtaining the Jackson serializer being used for a given type and exposes whether a property is considered read-only for Jackson.

Introduced JsonSchemaPropertyCustomizer to potentially tweak the JSON schema property definition. This is helpful in case custom JsonSerializers are implemented to also reflect the change in representation in the schema.
2015-08-14 19:13:23 +02:00
Oliver Gierke
14df6fcbc0 DATAREST-623 - Polishing.
Removed trailing spaces.

Original pull request: #195.
2015-08-12 19:06:52 +02:00
Greg Turnquist
06e2564f66 DATAREST-623 - Added documentation on how to programmatically link to resource controllers.
Documented how to use RepositoryEntityLinks to link to Spring Data REST controllers.

Original pull request: #195.
2015-08-12 19:06:49 +02:00
Oliver Gierke
867875e610 DATAREST-634 - After release cleanups. 2015-08-04 14:09:23 +02:00
Spring Buildmaster
1d7e7f4ea4 DATAREST-634 - Prepare next development iteration. 2015-08-04 05:06:47 -07:00
Spring Buildmaster
402d7c9382 DATAREST-634 - Release version 2.4.0.RC1 (Gosling RC1). 2015-08-04 05:06:44 -07:00
Oliver Gierke
fc85586384 DATAREST-634 - Prepare 2.4.0.RC1 (Gosling RC1). 2015-08-04 13:12:25 +02:00
Oliver Gierke
4cedd71de7 DATAREST-634 - Updated changelog. 2015-08-04 13:12:25 +02:00
Oliver Gierke
4e40bb456a DATAREST-634 - Upgraded to Spring HATEOAS 0.18.0.
Upgraded to Hibernate 4.3.10 along the way.
2015-08-04 13:11:03 +02:00
Oliver Gierke
f17bd13c73 DATAREST-616 - Initial support to execute Querydsl predicates.
If Querydsl is on the classpath and the repository exposed implements QuerydslPredicateExecutor, we now register a component that customizes the RepositoryInvoker to route repository interactions for collection resource calls to the QuerydslPredicateExecutor.

The invocation gets enriched with a Predicate obtained from the request data. Bindings can be customized through the QuerydslBinderCustomizer interface implemented in a default method on the repository.

Tweaked the build to generate Querydsl meta-model classes for the MongoDB domain types.
2015-08-04 10:19:07 +02:00
Greg Turnquist
2244a2c588 DATAREST-632 - Fixed gap in JSON Schema unit tests.
Consolidated constraint tests for JSON Schema test for User and Profile.

Original pull request: #192.
2015-08-04 02:02:25 +02:00
Greg Turnquist
5dac9eac0c DATAREST-624 - Added reference documentations for Spring Data REST HAL Browser.
Original pull request: #193.
2015-08-04 01:57:53 +02:00
Oliver Gierke
4e0d0e4df1 DATAREST-631 - Polishing.
Moved just introduced test case into PersistentEntityToJsonSchemaConverterUnitTests. Added ticket reference. Removed obsolete test case.

Original pull request: #190.
2015-07-31 16:07:25 +02:00
Greg Turnquist
45d1e4d9f4 DATAREST-631 - Expose id attributes with JSON Schema metadata if configured.
The JSON Schema we expose now considers the owning type for configuration to expose the identifier. Previously, we erroneously checked the property type.

Original pull request: #190.
2015-07-31 16:07:25 +02:00
Oliver Gierke
ec0590ff51 DATAREST-630 - Polishing.
Simplified implementation change. Integrated new test case into the existing one. Cleaned up existing test case to always use TestMvcClient.

Original pull request: #189.
2015-07-31 14:45:24 +02:00
Greg Turnquist
b359aba77a DATAREST-630 - ALPS metadata now only exposes identifier property if explicitly configured to.
The ALPS metadata exposed now considers the id exposure configuration to decide whether to skip the identifier property or not.

Original pull request: #189.
2015-07-31 14:45:24 +02:00
Oliver Gierke
dee22d2726 DATAREST-628 - Updated changelog. 2015-07-28 16:46:16 +02:00
Fabian Trampusch
f180a3ef1a DATAREST-619 - Fixed HTTP method mentioned in Javadoc of RepositoryEntityController.patchItemResource(…).
Previously the Javadoc for said method mentioned PUT as the mapped HTTP method while it's actually PATCH.

Original pull request: #188.
2015-07-27 16:05:27 +02:00
Oliver Gierke
5b0b368353 DATAREST-625 - Removed references to BeanWrapper.
DomainObjectMerger is now using the PersistentPropertyAccessor API instead of the BeanWrapper.

Related ticket: DATACMNS-738.
2015-07-22 21:09:56 +02:00
Oliver Gierke
3ac3c0b828 DATAREST-605 - Fixed processing of Maps in DomainObjectReader.
We now post-process Map values recursively to make sure they get merged correctly if they're complex objects in turn.

Improved the exception message for invalid payloads for JSON Patch requests to indicate the expected payload as the root Jackson exception does not contain any hints to what's actually expected.
2015-07-22 17:46:01 +02:00