Conversation
📝 WalkthroughWalkthroughAdds a new JSON Schema file that defines the Altinn 3 Calculation configuration format: a root object requiring "calculations", pattern-based calculation entries, items that are calculation objects or string refs, and definitions for "calculation" with "condition" and "ref". Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
schemas/json/calculation/calculation.schema.v1.json (1)
16-17: Consider using^.+$to prevent empty key names.The pattern
^.*$matches empty strings, which would allow calculation keys with empty names. Using^.+$ensures at least one character is required for key names.💡 Suggested improvement
"patternProperties": { - "^.*$": { + "^.+$": {Apply the same change to line 36.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@schemas/json/calculation/calculation.schema.v1.json` around lines 16 - 17, Update the JSON schema's patternProperties entries to disallow empty property names by replacing the regex key "^.*$" with "^.+$" wherever it appears (e.g., the patternProperties mapping in calculation.schema.v1.json); ensure both occurrences (the one around "patternProperties" and the other similar entry later in the file) are changed so keys require at least one character.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@schemas/json/calculation/calculation.schema.v1.json`:
- Around line 34-40: The JSON Schema under "definitions" has an invalid keyword
"ref" and is missing an explicit object type; update the block that contains
"patternProperties" so the property reference uses "$ref":
"#/definitions/calculation" instead of "ref", and add type: "object" at the same
level as "patternProperties" (the object that defines the pattern keyed entries)
so the schema correctly declares that the patterned entries are objects.
- Around line 20-29: The schema references "#/definitions/calculation" inside
the oneOf for the calculations property but no top-level JSON Schema
"definitions" exists; add a top-level "definitions" sibling to "properties" that
declares a "calculation" schema (the shape referenced by the oneOf) so the
reference resolves; ensure the new definitions.calculation describes the
expected fields for a calculation object (types, required fields, nested
structures) and update any titles/descriptions to match existing "calculation"
usage so "#/definitions/calculation" is valid.
---
Nitpick comments:
In `@schemas/json/calculation/calculation.schema.v1.json`:
- Around line 16-17: Update the JSON schema's patternProperties entries to
disallow empty property names by replacing the regex key "^.*$" with "^.+$"
wherever it appears (e.g., the patternProperties mapping in
calculation.schema.v1.json); ensure both occurrences (the one around
"patternProperties" and the other similar entry later in the file) are changed
so keys require at least one character.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 718f523e-5692-41d8-952f-d1644525fdd2
📒 Files selected for processing (1)
schemas/json/calculation/calculation.schema.v1.json
Description
Calculation schema used in calculation.json files. PR in app-lib-dotnet: Altinn/app-lib-dotnet#1683
Related Issue(s)
Verification/QA
kind/*andbackport*label to this PR for proper release notes groupingSummary by CodeRabbit