Skip to content

Additional validation for assay run configurations#118

Merged
labkey-klum merged 3 commits intodevelopfrom
fb_issue_53481
Jul 22, 2025
Merged

Additional validation for assay run configurations#118
labkey-klum merged 3 commits intodevelopfrom
fb_issue_53481

Conversation

@labkey-klum
Copy link
Copy Markdown
Contributor

Rationale

related issue

This change validates the shape of the run properties that might be passed into the experiment.createRun function so we don't fail when we try to parse the JSON posted data on the server. The repro is to run this or similar code:

runConfig <- fromJSON(txt='{"name" : "api imported run",
    "properties" : ["lab" , "test lab", "location" , "Seattle"]
    }')

run <- labkey.experiment.createRun(runConfig, dataRows = df)

The other client APIs don't seem to have this problem due to the presence of more composed types versus allowing free form JSON text.

With this change, if the properties object is not valid, we will throw the following error (list is the R data type that serializes to a JSON object):

image

@labkey-klum labkey-klum requested a review from cnathe July 21, 2025 20:21
@labkey-klum labkey-klum self-assigned this Jul 21, 2025
Comment thread Rlabkey/R/labkey.experiment.R Outdated

## validate run properties if provided
if (!is.null(run$properties) && !is.list(run$properties))
stop (paste("run properties must be a list of key value pairs."))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: the first param is "config" so should this say "config properties must be a list of key value pairs."?

@labkey-klum labkey-klum merged commit 0ec3cc5 into develop Jul 22, 2025
6 checks passed
@labkey-klum labkey-klum deleted the fb_issue_53481 branch July 22, 2025 19:47
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.

2 participants