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

Wrong property type in JSON Schema for lists with a @DBRef annotation [DATAREST-1096]

Open
#1,461 7 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

in: repository status: feedback-provided type: bug type: task
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Marc Mannig opened DATAREST-1096 and commented

We found a confusing problem with the returned JSON Schema in combination with the mongoDB @DBRef annotation and lists. List of objects which are embedded in the document are correctly described by the JSON Schema i get from /profile/theresource. But if i want to store the objects in a different mongoDB collection and simply add @DBRef to my list in the root object, the JSON Schema returns "string" instead "array" as type for the list property.

You can find a simple example with unittests which describes the problem under:
https://bitbucket.org/martinschueller/data-mongo-rest-test
(No DB needed)

The last test "shouldAlsoRetrieveTypeArrayWithDefinition" failed, because of the wrong type.

The problem occurred with all springboot versions


Affects: 3.0 M4 (Kay)

Reference URL: https://bitbucket.org/martinschueller/data-mongo-rest-test

2 votes, 5 watchers

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.