Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changesheet validator returns HTTP 200 response even when reporting write errors #326

Closed
eecavanna opened this issue Oct 13, 2023 · 2 comments · Fixed by #375
Closed

Changesheet validator returns HTTP 200 response even when reporting write errors #326

eecavanna opened this issue Oct 13, 2023 · 2 comments · Fixed by #375
Assignees
Labels
bug Something isn't working priority X SMALL Less than 1 day

Comments

@eecavanna
Copy link
Collaborator

API endpoint URL: https://api-dev.microbiomedata.org/metadata/changesheets:validate

Example problematic changesheet:

id	action	attribute	value
nmdc:bsm-11-kyjye260	insert	gold_biosample_identifiers	gold:Gb0255534

Corresponding HTTP response body (excerpt):

        "writeErrors": [
          {
            "index": 0,
            "code": 14,
            "errmsg": "The argument to $each in $addToSet must be an array but it was of type string"
          }
        ],

Screenshot:

image

I expected the endpoint to return an HTTP 422 instead of an HTTP 200.

@aclum
Copy link
Contributor

aclum commented Nov 3, 2023

FYI @dwinston @eecavanna @shreddd adding this to the sprint for next week as this is a high priority issue to get fixed. cc @sujaypatil96 @mbthornton-lbl

@dwinston
Copy link
Collaborator

returns 422 response with code fix. will link to PR.

{
  "detail": {
    "update_cmd": {
      "nmdc:bsm-11-kyjye260": {
        "update": "biosample_set",
        "updates": [
          {
            "q": {
              "id": "nmdc:bsm-11-kyjye260"
            },
            "u": {
              "$addToSet": {
                "gold_biosample_identifiers": {
                  "$each": "gold:Gb0255534"
                }
              }
            }
          }
        ]
      }
    },
    "validation_errors": [
      [
        {
          "index": 0,
          "code": 14,
          "errmsg": "The argument to $each in $addToSet must be an array but it was of type string"
        }
      ]
    ]
  }
}
image

dwinston added a commit that referenced this issue Nov 13, 2023
dwinston added a commit that referenced this issue Nov 13, 2023
* fix: include mongo-command update_info writeErrors when determining response code

fixes #326

* fix: default to empty dict
@github-project-automation github-project-automation bot moved this from At bat to Scored in Polyneme mixset Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority X SMALL Less than 1 day
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants