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.
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.
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.
Moved the accessibility tweak to the EventHandlerMethod's constructor so that the modification only occurs at detection time. Polished unit test.
Original pull request: #187.
AnnotatedEventHandlerInvoker now uses the user class to detect handler methods on to make sure we don't accidentally find CGLib generated methods and thus invoke the handler multiple times later on.
Extended MethodFilter Methods.USER_METHODS to filter methods on CGLib proxy classes, too.
Added missing license header and Javadocs where necessary.
Excerpt projections defined in @RepositoryRestResource had to be discoverable (i.e. located in a sub-package of the domain type). RepositoryRestMvcConfiguration now uses an newly introduced constructor of ProjectionDefinitionConfiguration that automatically registers all projects in the given ResourceMappings.
Updated existing unit tests to use setBasePath. Added extra assertion to setBasePath to guard against sending in a URI with a protocol.
Original pull request: #178.
We now support augmenting elements of a collection resource by using POST which previously only worked with PATCH requests. Took the chance to clean up RepositoryPropertyReferenceController by quite a bit and refactor functionality to discover the supported HTTP methods for a PersistentProperty into RootResourceInformation.
Instead of rendering an empty _embedded document for empty collections and pages we now explicitly trigger the creations of an EmbeddedWrapper for that empty, collection to preserve the collection's element type.
Tweaked ResourceProcessorHandlerMethodReturnValueHandler to invoke ResourceProcessor instances for those empty collections, too. PRHMRVH now checks the assignability of the raw resource type before analyzing the value type for a match.
RepositorySearchController now adds additional self links for the list of searches and a search execution.
Added an UnwrappingRepositoryInvokerFactory that transparently unwraps JDK 8 and Guava Optionals to make sure the consuming code works with values or plain nulls correctly.
We no correctly handle the customized association path if @RestResource is used on an association. Took the chance to refactor the resource mapping subsystem quite significantly to improve the handling of property mappings. Those had been externalized before.
RepositorySearchController now takes all request parameters as MultiValueMap to execute query methods. For parameters mapping to a managed resource we try to interpret the given parameter value as URI to actually trigger the URI-to-entity resolution through the newly registered UriToEntityConverter.
The latter is now registered with the default ConversionService registered so that it's
A lot of cleanups in RepositorySearchController. Removed some obsolete prints to the console to reduce log output during test execution.
Related ticket: DATACMNS-678.
Moved decision logic on whether to return response bodies int RepositoryRestConfig to ease testability of the controller. Added more unit tests and simplified the controller integration tests accordingly. Had to deactivate some Cassandra related tests as they don't seem to handle nulling of properties correctly.
Changed configuration to rely on the presence of the Accept header by default. Deprecated parameterless isReturnBodyFor…(…) methods in favor of the ones taking the Accept header to avoid the null checks on the calling side.
Polished JavaDoc for the isReturnBodyOn(Create|Update) methods. Polished formatting in RepositoryEntityController.
Original pull request: #167.
By default, whether to return response bodies for PUT and POST is determined by the presence of an Accept header, unless explicitly activated or deactivated in RepositoryRestConfiguration.
Original pull request: #167.
Significant overhaul of the JSONSchema support. This currently adds the following features:
- Complex nested types are exposed as descriptors with the properties pointing to them whenever necessary.
- Sets are treated as unique collections.
- Enums are handled as expected (enum values are listed).
- Renamings via @JsonProperty are considered.
- @JsonProperty(required = true) is considered and added to required properties.
- Date/time types (legacy Date, JSR-310, ThreeTenBP and Joda Time) are exposed with format "date-time".
- Objects with @JsonValue methods are considered to be rendered as String value.
- Formats and patterns can be manually configured on MetadataConfiguration.
TODOs:
- Implementation polish, JavaDoc
- Automatically inspect ObjectMapper to detect customizations made through Mixins and custom Serializers.
RepositoryEntityLinks now exposes methods to obtain links to all search resources and individual ones, including overloads to pre-expand Pageable and Sort parameters potentially contained in the method signature.
Search links now also contain a projection template variable if the type returned by the query method backing the search resource has projections registered.
To be sure to pick up domain type lookup customizations we now consistently use RepositoryMetadata instead of trying to be clever and re-detecting it via RepositoriesUtils.
Instead of using a DomainClassConverter directly we now use a raw ConversionService in UriToEntityConverter. This allos us to get rid off the bean definitions for UriToEntityConverter and DomainClassConverter. The population of the ConversionService is now taken care of by calling SpringDataWebConfiguration's addFormatter(…) in defaultConversionService().
Added unit tests for UriToEntityConverter.