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

false positive validation error from queries:run #838

Closed
aclum opened this issue Dec 12, 2024 · 5 comments
Closed

false positive validation error from queries:run #838

aclum opened this issue Dec 12, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@aclum
Copy link
Contributor

aclum commented Dec 12, 2024

Describe the bug
I believe I'm getting a false positive validation error from queries:run, when I dump the document that runtime says is not valid, it in fact validates against the schema with linkml-validate

To Reproduce
Steps to reproduce the behavior:

  1. curl command
    curl -X 'POST' \
      'https://api.microbiomedata.org/queries:run' \
      -H 'accept: application/json' \
      -H 'Authorization: Bearer $TOKEN' \
      -H 'Content-Type: application/json' \
      -d '
      {
       "update": "data_generation_set",
       "updates": [{"q": {"id": "nmdc:omprc-12-bk872674"}, "u": {"$set": {"has_input": ["nmdc:dobj-11-nxmk9429"]}}}]
     }'

Error is:

{
  "detail": "Schema document(s) would be invalid after proposed update: {'data_generation_set': [\"{'add_date': '2022-03-25', 'gold_sequencing_project_identifiers': ['gold:Gp0618285'], 'has_input': ['nmdc:dobj-11-nxmk9429'], 'id': 'nmdc:omprc-12-bk872674', 'mod_date': '2024-01-07', 'name': 'Soil microbial communities from pasture in Falmouth, Massachusetts, USA - PETF_TOP', 'ncbi_project_name': 'Soil microbial communities from pasture in Falmouth, Massachusetts, USA - PETF_TOP', 'principal_investigator': {'email': '[email protected]', 'has_raw_value': 'Nancy Hess', 'name': 'Nancy Hess', 'type': 'nmdc:PersonValue'}, 'processing_institution': 'JGI', 'type': 'nmdc:NucleotideSequencing', 'analyte_category': 'metagenome', 'associated_studies': ['nmdc:sty-11-28tm5d36'], 'instrument_used': ['nmdc:inst-14-xx07be40'], 'has_output': ['nmdc:dobj-11-nxmk9429', 'nmdc:dobj-11-x7tmms98', 'nmdc:dobj-11-b7kmr176', 'nmdc:dobj-11-fj64fw53']} is not valid under any of the given schemas\"]}"
}

copy the result, replace single with double quotes, convert to yaml and validate with

$ poetry run linkml-validate -C NucleotideSequencing -s src/schema/nmdc.yaml test2.yaml
No issues found

Expected behavior
A clear and concise description of what you expected to happen.
expected 200 response code

Screenshots
If applicable, add screenshots to help explain your problem.

Acceptance Criteria

  • Clear to everyone involved
  • Can be tested or verified
  • Either passes or fails (cannot be 50% completed, for example)
  • Focus on the outcome, not how the outcome is achieved
  • As specific as possible (fast page load speed vs. 3-second page load speed)
  • if multiple criteria, present as a bulleted list of short scenarios (see template below)

Example scenario-based template:
Given (some given context or precondition), when (I take this action), then (this will be the specific outcome).

Additional context
I need this to clean up some the issues from running import automation. blocks parts of microbiomedata/nmdc_automation#333

@aclum aclum added the bug Something isn't working label Dec 12, 2024
@eecavanna
Copy link
Collaborator

Here's a formatted version of the input JSON payload (from the curl command):

{
    "update": "data_generation_set",
    "updates": [
        {
            "q": {
                "id": "nmdc:omprc-12-bk872674"
            },
            "u": {
                "$set": {
                    "has_input": [
                        "nmdc:dobj-11-nxmk9429"
                    ]
                }
            }
        }
    ]
}

@dwinston
Copy link
Collaborator

@aclum the current (valid) document has nmdc:bsm-11-g06qhv26 in has_input. I notice you are updating the input to be a DataObject versus a Biosample. Is that intended?

@dwinston
Copy link
Collaborator

also, nmdc:dobj-11-nxmk9429 is currently an output of https://api.microbiomedata.org/nmdcschema/ids/nmdc:omprc-12-bk872674. do you want to $unset that as you $set it as an input?

@dwinston
Copy link
Collaborator

from discussion, it seems this update as expressed was not the intended update, so closing.

@eecavanna
Copy link
Collaborator

Thanks, @dwinston, and thanks for providing the reproduction steps, @aclum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants