Skip to content

feat: Update JSON Schema for expression component - #19254

Merged
TomasEng merged 3 commits into
mainfrom
update-json-schema-for-expression-component
Jun 23, 2026
Merged

feat: Update JSON Schema for expression component#19254
TomasEng merged 3 commits into
mainfrom
update-json-schema-for-expression-component

Conversation

@TomasEng

@TomasEng TomasEng commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

This pull request updates the JSON Schema used in the expression editor in Studio with the new list, object and jmespath functions.

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

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

Verification

Summary by CodeRabbit

Release Notes

  • New Features
    • Enhanced expression language support by expanding allowed expression types, including component/data model lookups and JMESPath function references
    • Extended JMESPath results handling across additional expression contexts (string, boolean, numeric, list, and object)
    • Added support for new expression function forms, including list/object variants and a two-argument jmespath form (data to query plus query string)

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3881e4ea-7acb-42ed-84e8-d5a76220d3a0

📥 Commits

Reviewing files that changed from the base of the PR and between 7992c4d and 04c9571.

📒 Files selected for processing (1)
  • src/Designer/frontend/libs/studio-components/src/components/StudioExpression/validators/expression.schema.v1.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Designer/frontend/libs/studio-components/src/components/StudioExpression/validators/expression.schema.v1.json

📝 Walkthrough

Walkthrough

The expression JSON schema is updated to extend type union definitions (any, strict-string, strict-boolean, strict-number, strict-list, strict-object) to accept func-jmespath, func-list, func-object, and func-countDataElements. New definitions entries for func-list, func-object, and func-jmespath are added, specifying their array forms and argument constraints.

Changes

Expression Schema Extensions

Layer / File(s) Summary
Type union expansions for jmespath and countDataElements
src/Designer/frontend/libs/studio-components/src/components/StudioExpression/validators/expression.schema.v1.json
definitions.any.anyOf gains func-component, func-dataModel, and func-jmespath; strict-string and strict-boolean gain func-jmespath; strict-number gains func-countDataElements and func-jmespath; strict-list and strict-object each gain func-jmespath alongside their existing constructors.
New func-list, func-object, and func-jmespath definitions
src/Designer/frontend/libs/studio-components/src/components/StudioExpression/validators/expression.schema.v1.json
Adds definitions.func-list, definitions.func-object, and definitions.func-jmespath, specifying expected array formats, argument shapes, and the two-argument structure required by jmespath (data argument and query string argument).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Altinn/altinn-studio#18974: Extends the expression JSON schema's list-related function support, overlapping on the same func-list and list-expression surface area modified here.
  • Altinn/altinn-studio#19028: Introduces and wires func-jmespath in the expression JSON schema, targeting the same JMESPath support in the expression language.

Suggested labels

area/studio-components

Suggested reviewers

  • olemartinorg

Poem

🐇 Hop, hop through the schema tree,
JMESPath joins the family!
func-list and func-object find their place,
Each union grows with newfound grace.
The rabbit stamps the JSON done —
More expressions for everyone! 🎉

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarises the main change: updating the JSON Schema file for the expression component, which directly aligns with the changeset.
Description check ✅ Passed The description covers all required template sections: detailed description of changes, verification checklist completed with related issues linked, build confirmation, and manual testing confirmation.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-json-schema-for-expression-component

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 and usage tips.

@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 19, 2026
@TomasEng
TomasEng marked this pull request as ready for review June 19, 2026 07:11
@TomasEng TomasEng added the squad/data Issues that belongs to the named squad. label Jun 19, 2026
@TomasEng TomasEng moved this to 🔎 In review in Team Altinn Studio Jun 19, 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Designer/frontend/libs/studio-components/src/components/StudioExpression/validators/expression.schema.v1.json (1)

37-46: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

any currently excludes list/object expressions, which blocks new function composition

Line 37-46 defines #/definitions/any without #/definitions/strict-list and #/definitions/strict-object. That prevents func-list/func-object outputs from being used in positions typed as any (including Line 679 in func-jmespath, and existing func-if/func-equals arguments).

Suggested fix
     "any": {
       "title": "Any expression",
       "anyOf": [
         { "type": "null", "title": "Null/missing value" },
         { "$ref": "`#/definitions/strict-string`" },
         { "$ref": "`#/definitions/strict-boolean`" },
         { "$ref": "`#/definitions/strict-number`" },
+        { "$ref": "`#/definitions/strict-list`" },
+        { "$ref": "`#/definitions/strict-object`" },
         { "$ref": "`#/definitions/func-if`" },
         { "$ref": "`#/definitions/func-component`" },
         { "$ref": "`#/definitions/func-dataModel`" },
         { "$ref": "`#/definitions/func-jmespath`" }
       ]
     },
🤖 Prompt for 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.

In
`@src/Designer/frontend/libs/studio-components/src/components/StudioExpression/validators/expression.schema.v1.json`
around lines 37 - 46, The anyOf array in the `#/definitions/any` section is
missing references to strict-list and strict-object type definitions, which
prevents func-list and func-object outputs from being used in positions typed as
any. Add two new items to the anyOf array: a reference to
`#/definitions/strict-list` and a reference to `#/definitions/strict-object`,
alongside the existing references to strict-string, strict-boolean,
strict-number, and the function definitions.
🤖 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 673-683: The func-jmespath schema definition is missing a minItems
constraint that enforces the required 2-argument (plus function name) structure.
The schema currently has items defined as a tuple array with additionalItems set
to false, but this allows fewer than the required 3 items. Add "minItems": 3 to
the func-jmespath schema object to ensure that invocations must include the
function name, data argument, and query string argument, rejecting malformed
calls that lack required parameters.

---

Outside diff comments:
In
`@src/Designer/frontend/libs/studio-components/src/components/StudioExpression/validators/expression.schema.v1.json`:
- Around line 37-46: The anyOf array in the `#/definitions/any` section is missing
references to strict-list and strict-object type definitions, which prevents
func-list and func-object outputs from being used in positions typed as any. Add
two new items to the anyOf array: a reference to `#/definitions/strict-list` and a
reference to `#/definitions/strict-object`, alongside the existing references to
strict-string, strict-boolean, strict-number, and the function definitions.
🪄 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: c513f8d4-54ab-4083-8a4f-ca1c0bdf8fd4

📥 Commits

Reviewing files that changed from the base of the PR and between bdbaff4 and 7992c4d.

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

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19254      +/-   ##
==========================================
+ Coverage   95.84%   95.88%   +0.03%     
==========================================
  Files        3028     3035       +7     
  Lines       39819    39763      -56     
  Branches     4910     4901       -9     
==========================================
- Hits        38166    38128      -38     
+ Misses       1235     1222      -13     
+ Partials      418      413       -5     

☔ 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 96a1f35 into main Jun 23, 2026
10 checks passed
@TomasEng
TomasEng deleted the update-json-schema-for-expression-component branch June 23, 2026 10:18
@github-project-automation github-project-automation Bot moved this from 🔎 In review to ✅ Done in Team Altinn Studio Jun 23, 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