feat: Support lists in expressions in App Frontend#18974
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds frontend list-expression support: new ExprVal.List and recursive ValidValue/ValidArray types, validation helpers, a list(...) function and runtime, expression casting updates, JSON schema additions for list expressions, codegen mappings, and test fixtures. ChangesList expression feature implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/App/backend/src/Altinn.App.Core/Internal/Expressions/ExpressionValue.cs`:
- Around line 679-681: The converter's Write method handles JsonValueKind.Array
but the Read method still rejects JsonTokenType.StartArray, preventing array
ExpressionValue from round-tripping; update the Read implementation in
ExpressionValue converter to accept JsonTokenType.StartArray (matching
JsonValueKind.Array) and parse the array into an ExpressionValue.Array
representation, ensuring symmetry with the Write case (handle token StartArray,
iterate/read elements into the same internal structure used by Write, and return
the corresponding ExpressionValue).
In
`@src/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/TestFunctions.cs`:
- Around line 390-404: The current branch silently skips when test.Expression is
null; update the method that contains the if (test.Expression != null) block
(the test runner in TestFunctions that calls RunTestCaseItem and constructs
ExpressionTestCaseRoot.TestCaseItem) to fail fast when a test fixture contains
neither an Expression nor any testCases: detect when test.Expression is null AND
test.TestCases (or equivalent collection/property) is null or empty, and throw
an exception or Assert.Fail with a clear message identifying the offending
fixture so the CI fails rather than silently passing; otherwise continue to call
RunTestCaseItem as before when an Expression is present.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d55f142c-2742-4152-bebf-a6d7a998db13
📒 Files selected for processing (25)
src/App/backend/src/Altinn.App.Core/Internal/Expressions/ExpressionEvaluator.cssrc/App/backend/src/Altinn.App.Core/Internal/Expressions/ExpressionValue.cssrc/App/backend/src/Altinn.App.Core/Models/Expressions/ExpressionFunction.cssrc/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/ExpressionTestCaseRoot.cssrc/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/TestBackendExclusiveFunctions.cssrc/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/TestFunctions.cssrc/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/TestInvalid.cssrc/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/shared-tests/functions/component/lookup-list.jsonsrc/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/shared-tests/functions/dataModel/array-is-null.jsonsrc/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/shared-tests/functions/dataModel/lookup-list.jsonsrc/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/shared-tests/functions/list/list.jsonsrc/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/ExpressionEvaluatorTests/EqualsTests.cssrc/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/TestUtilities/DynamicClassBuilder.cssrc/App/backend/test/Altinn.App.Core.Tests/PublicApiTests.PublicApi_ShouldNotChange_Unintentionally.verified.txtsrc/App/frontend/schemas/json/layout/expression.schema.v1.jsonsrc/App/frontend/src/codegen/dataTypes/GenerateExpressionOr.tssrc/App/frontend/src/features/expressions/expression-functions.tssrc/App/frontend/src/features/expressions/index.tssrc/App/frontend/src/features/expressions/shared-tests/functions/component/lookup-list.jsonsrc/App/frontend/src/features/expressions/shared-tests/functions/dataModel/array-is-null.jsonsrc/App/frontend/src/features/expressions/shared-tests/functions/dataModel/lookup-list.jsonsrc/App/frontend/src/features/expressions/shared-tests/functions/list/list.jsonsrc/App/frontend/src/features/expressions/types.tssrc/App/frontend/src/features/expressions/validation.tssrc/Designer/frontend/libs/studio-components/src/components/StudioExpression/validators/expression.schema.v1.json
💤 Files with no reviewable changes (3)
- src/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/ExpressionEvaluatorTests/EqualsTests.cs
- src/App/frontend/src/features/expressions/shared-tests/functions/dataModel/array-is-null.json
- src/App/backend/test/Altinn.App.Core.Tests/LayoutExpressions/CommonTests/shared-tests/functions/dataModel/array-is-null.json
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #18974 +/- ##
========================================
Coverage 95.84% 95.85%
========================================
Files 3018 3023 +5
Lines 39575 39716 +141
Branches 4849 4892 +43
========================================
+ Hits 37931 38070 +139
- Misses 1230 1232 +2
Partials 414 414 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…essions # Conflicts: # src/App/frontend/monorepo-changed-paths.txt
Description
This pull request adds support for arrays, along with a
listfunction, in expressions in App Frontend.listfunction is addedExprValenumisValidValuealong with a new type namedValidValueis added for better typingHere is the corresponding change in App Backend: Altinn/app-lib-dotnet#1769
Verification
Summary by CodeRabbit
New Features
Behaviour
Tests