spring-projects / spring-projects/spring-data-rest
Provide a RequiredPropertyResolver for the JSON Schema Converter [DATAREST-399]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Petar Tahchiev opened DATAREST-399 and commented
Hello,
I was trying the JSON schema with spring-data-rest and I noticed that all my properties are required : false. So I dug in the code and I saw this in PersistentEntityToJsonSchemaConverter:137:
Property property = persistentProperty.isCollectionLike() ? //
new ArrayProperty("array", message, false)
: new Property(type, message, false);
Seems like all the properties are hard-coded to be not required. It would be nice if the client can inject some sort of RequiredPropertyResolver which returns true or false so then you can call this on line 137. Of course the default implementation could always return false it's just it would be great if are able to customize this behavior
Issue Links:
- DATAREST-354 Revamp JSON Schema support to current draft of the spec
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.