Skip to content

fix: Update JSON Schema for expressions in Studio with new functions - #19364

Merged
TomasEng merged 5 commits into
mainfrom
update-json-schema-for-expressions-with-sum-and-average
Jun 30, 2026
Merged

fix: Update JSON Schema for expressions in Studio with new functions#19364
TomasEng merged 5 commits into
mainfrom
update-json-schema-for-expressions-with-sum-and-average

Conversation

@TomasEng

@TomasEng TomasEng commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request updates the JSON Schema used in the expression editor in studio with the recently added functions.

Current:
components altinn studio__path=_story_components-studioexpression--preview (3)

This pull request:
localhost_6007__path=_story_components-studioexpression--preview (3)

Verification

Summary by CodeRabbit

  • New Features
    • Expanded numeric expression support to include aggregation functions for sum, average, and count.
    • Added validation for these new aggregation formats, enabling them anywhere numeric expressions are used.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The head commit changed during the review from 0d6d79c to cb3af8e.

📝 Walkthrough

Walkthrough

The schema for strict-number now includes func-sum, func-average, and func-count, and adds JSON schema definitions for all three numeric function forms.

Changes

Numeric expression schema extensions

Layer / File(s) Summary
Strict-number function forms
src/Designer/frontend/libs/studio-components/src/components/StudioExpression/validators/expression.schema.v1.json
Extends strict-number.anyOf with func-sum, func-average, and func-count, and adds JSON schema definitions for the new function shapes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Altinn/altinn-studio#19254: Also updates expression.schema.v1.json by expanding strict-number with additional numeric function forms.

Suggested labels

area/studio-components

Suggested reviewers

  • ErlingHauan
  • olavsorl

Poem

🐇 I hop through JSON, neat and bright,
With sum, average, and count in sight.
strict-number grows with every bite,
A rabbit’s nibble, tidy and light.
Hop hop! ✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the schema update and the addition of new expression functions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description covers the change summary, screenshots, and verification items, with only minor template details left implicit.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-json-schema-for-expressions-with-sum-and-average

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added skip-releasenotes Issues that do not make sense to list in our release notes frontend solution/studio/designer labels Jun 26, 2026
@TomasEng TomasEng added the squad/data Issues that belongs to the named squad. label Jun 26, 2026
@TomasEng TomasEng moved this to 👷 In progress in Team Altinn Studio Jun 26, 2026
@TomasEng
TomasEng marked this pull request as ready for review June 26, 2026 11:55
@TomasEng TomasEng moved this from 👷 In progress to 🔎 In review in Team Altinn Studio Jun 26, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 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/Designer/frontend/libs/studio-components/src/components/StudioExpression/validators/expression.schema.v1.json`:
- Around line 688-705: The sum/average schemas currently point to the generic
list definition, so they allow non-numeric values instead of only number lists.
Update the argument schema used by func-sum and func-average in
expression.schema.v1.json to reference a numeric-list definition (for example a
new helper definition) rather than `#/definitions/list`, and make sure it covers
only numeric list literals plus any explicitly supported list-producing
expressions. Use the existing func-sum and func-average symbols to locate the
affected entries and keep their array shape unchanged aside from the tightened
argument validation.
🪄 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: 4b3f44ac-8f3b-4865-9fc8-0a85c3113793

📥 Commits

Reviewing files that changed from the base of the PR and between 94ad4c0 and eb6deb6.

📒 Files selected for processing (1)
  • src/Designer/frontend/libs/studio-components/src/components/StudioExpression/validators/expression.schema.v1.json

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.86%. Comparing base (070c7ab) to head (fb34cfd).
⚠️ Report is 227 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19364      +/-   ##
==========================================
+ Coverage   95.84%   95.86%   +0.01%     
==========================================
  Files        3028     3024       -4     
  Lines       39819    39548     -271     
  Branches     4910     4866      -44     
==========================================
- Hits        38166    37914     -252     
+ Misses       1235     1223      -12     
+ Partials      418      411       -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@TomasEng
TomasEng merged commit cd813ec into main Jun 30, 2026
9 checks passed
@TomasEng
TomasEng deleted the update-json-schema-for-expressions-with-sum-and-average branch June 30, 2026 11:17
@github-project-automation github-project-automation Bot moved this from 🔎 In review to ✅ Done in Team Altinn Studio Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend skip-releasenotes Issues that do not make sense to list in our release notes solution/studio/designer squad/data Issues that belongs to the named squad.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants