spring-data-rest icon indicating copy to clipboard operation
spring-data-rest copied to clipboard

JSON schema has a field `requiredProperties` but this should be `required` per the JSON Schema spec

Open lion7 opened this issue 3 months ago • 0 comments

As the title says, when generating a JSON schema from a Spring Boot application with Spring Data REST the resulting schema contains a field requiredProperties with all non-nullable fields. This field should be named required instead. The field is defined here:

https://github.com/spring-projects/spring-data-rest/blob/66589c60a59273f8ab0ee6503761a26eddc31e5d/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/JsonSchema.java#L210

See this page for the exact spec: https://json-schema.org/understanding-json-schema/reference/object#required .

I also found this issue that mentions a requiredProperties field, perhaps that might be related / have caused some confusion.

For extra context, I generated the JSON schema like this (for a companies repo): curl --header 'Accept: application/schema+json' http://localhost:8080/api/v1/profile/companies

lion7 avatar Oct 02 '25 11:10 lion7