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

Arithmetic expressions in condition of number arrays #76

Open
lionelpa opened this issue Jan 28, 2020 · 0 comments
Open

Arithmetic expressions in condition of number arrays #76

lionelpa opened this issue Jan 28, 2020 · 0 comments
Assignees
Labels
feature Requested features parsing

Comments

@lionelpa
Copy link
Contributor

lionelpa commented Jan 28, 2020

Current Behavior

Testcase currently disabled in "openvalidation-core\src\test\java\end2ast\lambdas\FirstFunctionsTests.java":

@Test
  void first_function_on_numbers_array_with_arithmetic_in_condition_playground() throws Exception {
    String rule = "First from numbers with a value * 2 greater than 3 as myNumber";
    String schema = "{numbers: [1,2,3]}";

    End2AstRunner.run(
        rule,
        schema,
        r ->
            r.variables()
                .first()
                .function("FIRST")
                .parameters()
                .second()
                .lambdaCondition()
                .leftArithmeticalOperation()
                .first()
                .propertyValue()
                .hasType(DataPropertyType.Decimal)
                .hasEmptyPath()
                .hasSameLambdaTokenAsParentLambdaCondition());
  }

The Validator will mark the resulting ASTModel as faulty because the condition contains a static string.

Possible Solution

Add manual resolution in io/openvalidation/antlr/transformation/postprocessing/PostModelWhereOnSimpleTypeResolver.java.

NOTE: There is also a disabled integration test for this in "openvalidation-integration-tests/src/test/resources/playground-tests.test"

@lionelpa lionelpa added feature Requested features parsing labels Jan 28, 2020
@lionelpa lionelpa self-assigned this Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Requested features parsing
Projects
None yet
Development

No branches or pull requests

1 participant