Reputation: 4538
From reading another question, I learned that Spring Data Rest exposes a JSON schema at: /{resourceName}/schema
. Ex:
GET http://localhost:8080/members/schema Accept : application/schema+json
{ "name": "org.jxc876.model.Member", "description": "rest.description.member", "links": [], "properties": { "id": { "type": "long", "description": "rest.description.member.id", "required": false }, "alias": { "type": "string", "description": "rest.description.member.alias", "required": false }, "name": { "type": "string", "description": "rest.description.member.name", "required": false } } }
I want to indicate that certain fields are required. I initially tried using Bean Validation annotations (@NotNull) and Jackson (@JacksonProperty) annotations but neither seemed to trigger the flag.
Note: I am using Spring Data Rest 2.2.1
Upvotes: 5
Views: 4069
Reputation: 4538
I looked into the source code, and found:
new Property(type, message, false)
I'm thinking I should extend PersistentEntityToJsonSchemaConverter and override the convert method, then also override the controller and call my custom JsonSchemaConverter.
Upvotes: 1