spring-projects / spring-projects/spring-data-rest

Provide a RequiredPropertyResolver for the JSON Schema Converter [DATAREST-399]

Open
#776 2 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.