Skip to content

BrAPI: fix PUT /trials response returning trialName in trialDescription#6121

Open
shbrainard wants to merge 1 commit into
solgenomics:masterfrom
shbrainard:fix/brapi-put-trials-trialdescription
Open

BrAPI: fix PUT /trials response returning trialName in trialDescription#6121
shbrainard wants to merge 1 commit into
solgenomics:masterfrom
shbrainard:fix/brapi-put-trials-trialdescription

Conversation

@shbrainard
Copy link
Copy Markdown

Summary

  • One-line fix in lib/CXGN/BrAPI/v2/Trials.pm. The PUT response was returning $folder->name in the trialDescription field of the response payload, with a comment "description doesn't exist".
  • The DB write earlier in the same function ($folder->description($description || '') at line 322) was correct, so persistence has always been fine. Only the response payload was wrong.
  • Read the description directly from the project row instead.
  • Any BrAPI client that uses the PUT response to update its in-memory representation of the trial silently overwrites its local trialDescription with the trial name.

Reproducer

  1. POST /brapi/v2/trials to create a trial.
  2. PUT /brapi/v2/trials/{id} with the existing body and a modified trialDescription.
  3. The PUT response's trialDescription field contains the trial's name, not the value sent.
  4. A subsequent GET returns the correct (sent) value.

Verification

Reproduced and verified the fix on the breedbase_dockerfile dev stack at sgn-454.0: PUT round-trip now returns the correct trialDescription; subsequent GET confirms the database value matches.

The update handler used $folder->name to populate trialDescription in
the response, with a comment that description was not accessible from
the Folder object. The database write at line 322 was correct; only
the response payload was wrong. Read the description from the project
row instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant