Skip to content

Align expression validation with datashield4j 3.0.0 - #8

Merged
ymarcon merged 1 commit into
masterfrom
align-ds4j-3.0-validation
Nov 11, 2026
Merged

ymarcon merged 1 commit into
masterfrom
align-ds4j-3.0-validation

Conversation

@ymarcon

@ymarcon ymarcon commented Nov 11, 2026

Copy link
Copy Markdown
Member

Brings DSLite's parser and validation in line with the datashield4j 3.0.0 changes (0caefb4, 390e2eb, 0b6989b, 4f7875d).

Changes

  • Aggregate expressions must invoke a function (parentheses are transparent).
  • Assignments (= outside a named argument) are rejected in aggregate expressions.
  • Argument names must be names or strings: f(D$A = 1) is rejected; f('x' = 1) is now accepted.
  • Range operands must be numbers or arithmetic on numbers (1:n, D$A:3, 1:g(3) are rejected); : inside formulas is unaffected.
  • Unary + is no longer accepted (+1 is a syntax error).
  • Expressions are parsed and validated even when no methods are configured; function replacement and strict-mode errors still apply only when methods are configured.

Behaviour change

x = length(1) in aggregate now fails with "must invoke a function" (the root check runs first, as in datashield4j). Nested assignments such as length((x = 1)) fail with "Assignments are not allowed".

Tests

devtools::test() passes; new cases in test-parser.R and test-server.R.

Validate parsed expressions as datashield4j does: aggregate expressions
must invoke a function and cannot assign, argument names must be names
or strings, and range operands must be numbers. Accept quoted argument
names, drop unary plus, and validate even when no methods are configured.
@ymarcon
ymarcon merged commit 9237ae8 into master Nov 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant