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

Problems when performing non-get requests with HAL-browser on resources with associations [DATAREST-721]

Open
#1,091 8 comments 0 reactions 1 assignee View on GitHub

@gregturn 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

Loïc Dewerchin opened DATAREST-721 and commented

Hello,
we have been trying out the HAL-browser in our Spring Boot / SDR project by using the spring-data-rest-hal-browser dependency

Everything works fine when performing:

  • GET requests on resources with and without associated resources
  • non-GET requests on resources without associated resources

However when performing a non-GET request on a resource with another associated resource the Create/Update pop up does not display the input-fields(should be generated by json-editor) or a general JSON input field (fallback?) . The Make Request button also does not trigger any action.

When checking the browser dev-tools there is an error in CustomPostForm.js (line 112) when loading the JSON Schema-driven editor.
Error:

TypeError: can't convert undefined to object

line of code

Object.keys(schema.properties).forEach(function (property) {

If I understand correctly first a call to the profile/ of the resource is made (OK) and that information is used to feed the JSON editor so it can construct input fields. I will post the profile/ information of the resource in the comment below as it may provide some valuable information for you.

Now , I also checked with a small sample SDR project, with a couple of simple entities that are linked : here the HAL browser does not choke on processing the profile/ but we observed another behavior : the linked resource are not shown as "input fields" in the Create/Update pop-up (on either side of the bidirectional linking... ) , making it impossible to create a valid new resource instance on one side of the linking

I am wondering if it wouldn't be convenient to just fall-back to the old input field were one can just enter some json (so drop the json-editor) when the call the the profile/ reveals that there is an associated resource?


Affects: 2.4.1 (Gosling SR1)

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.