Docs for new feature custom templates in Studio#2644
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Note
|
| Cohort / File(s) | Summary |
|---|---|
Custom Template Documentation content/altinn-studio/v8/guides/development/custom-templates/_index.en.md, content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md |
New guides describing repository layout, required files (templatemanifest.json, template.json, content/), example JSON and schemas, validation guidance, recursive content copy behavior, setup checklist, and best practices. |
JSON Schema Validator Shortcode themes/hugo-theme-altinn/layouts/shortcodes/jsonschema-validator.html |
New Hugo shortcode that renders an interactive JSON Schema validator UI (textarea, Validate button, results). Sets needsAjv, accepts schemaUrl/label params, fetches and compiles schema with AJV (allErrors: true, strict: false), validates input, and displays formatted errors or success with error handling. |
Theme Layout & AJV Loader Partial themes/hugo-theme-altinn/layouts/_default/list.html, themes/hugo-theme-altinn/layouts/partials/ajv.html |
list.html updated to conditionally include the ajv.html partial when needsAjv is set; ajv.html added to include the /js/ajv.bundle.js script. |
Sequence Diagram(s)
sequenceDiagram
actor User
participant Browser
participant Page
participant AJV
participant SchemaHost
User->>Browser: Open page with validator shortcode
Browser->>Page: Load rendered HTML (validator UI present, needsAjv set)
Page-->>Browser: Render textarea, Validate button, results area
Browser->>Page: Detects needsAjv -> loads `/js/ajv.bundle.js`
Browser->>AJV: Initialize AJV instance
Browser->>SchemaHost: Fetch schema from schemaUrl
SchemaHost-->>Browser: Return schema JSON
Browser->>AJV: Compile schema (allErrors: true, strict: false)
User->>Browser: Enter JSON and click Validate
Browser->>AJV: Validate JSON
alt valid
AJV-->>Browser: No errors
Browser->>User: Display success
else invalid
AJV-->>Browser: Error list
Browser->>User: Display formatted errors
end
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
A guide in English and Bokmål appear,
AJV waits to chase the schema fear,
Paste your JSON, click to see,
Errors shown or green-lit tree,
Templates ready — documentation near. ✨
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately reflects the main changeset: documentation for a new custom templates feature in Altinn Studio, including guides and a JSON Schema validator shortcode. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
docs/custom-template
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 help to get the list of available commands and usage tips.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.en.md`:
- Around line 60-64: Update the third requirement bullet to tighten label
formatting and add the English label: change "`name` and `description` must
include entries for `nb`(norsk bokmål)." to include a space before the
parenthesis and an English label, e.g. "`name` and `description` must include
entries for `nb` (Norsk bokmål) and `en` (English)." Ensure the wording matches
this format and correct capitalization/spacing.
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md`:
- Around line 7-8: The sentence starting "tilpassede maler lar organisasjoner
lage gjenbrukbare applikasjonsmaler." should begin with a capital letter; change
the leading "tilpassede" to "Tilpassede" in the document (the sentence that
currently reads "tilpassede maler..." in the Markdown content). Ensure the same
capitalization rule is applied if the identical sentence appears elsewhere in
this file.
- Around line 14-30: The code fences in the markdown lack language tags and a
bare shortcode URL triggers MD034; update each fenced block around the directory
trees to use a language tag (e.g., ```text) and add an HTML markdownlint-disable
comment immediately before the shortcode instance {{< jsonschema-validator ...
>}} (<!-- markdownlint-disable-next-line MD034 -->) to silence the bare URL
rule; apply the same changes to the other occurrences mentioned (around
Templates/min-mal/content/ and the other noted blocks) so all code fences are
labeled and all shortcode lines are prefixed with the MD034 suppression.
…index.nb.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…index.en.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Updated the content structure examples in the custom templates guide.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.en.md`:
- Around line 106-117: The code block is incorrectly labeled as JSON and
contains inconsistent tree glyphs and a stray '|' character; change the fence
language from ```json to ```text, replace the ASCII '|' with the Unicode
box-drawing vertical bar '│' for alignment, and fix the misindented branch so
lines using "├──", "│", and "└──" form a consistent tree (ensure the "config/"
entry uses "│ ├── config/" and "│ │ └── applicationmetadata.json"
formatting to match the other nodes).
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md`:
- Around line 106-117: Ret Rett opp tegnene i trevisningen under
"Templates/min-mal/content/" ved å erstatte alle forekomster av pipe-tegnet '|'
med det grafiske vertikale tegnet '│' og juster innrykkene slik at alle nivåer
bruker samme tegntype og avstand (f.eks. linjene for App/, models/, ui/,
layouts/, Settings.json, logic/, config/, applicationmetadata.json og
README.md). Sørg for konsekvent bruk av '│' for alle mellomnivåer og samme
antall mellomrom før hver gren for å få et jevnt og korrekt tre.
♻️ Duplicate comments (2)
content/altinn-studio/v8/guides/development/custom-templates/_index.en.md (1)
60-63: Language label requirement still reads incomplete.Same issue as previously noted: the requirement only mentions
nband formatting could be clearer. Please align with the earlier suggestion to include English and spacing.content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md (1)
97-97: Bare URL in shortcode still triggers MD034.Same markdownlint issue as previously flagged; add the MD034 suppression comment immediately above the shortcode.
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.en.md`:
- Around line 106-117: The ASCII tree uses the end-child marker incorrectly:
`logic/` is marked with `└──` but `config/` is listed as a sibling beneath it;
update the tree so only the actual last child at each level uses `└──`. Locate
the block showing Templates/my-template/content and adjust the markers so either
`logic/` is not `└──` (use `├──`) and `config/` remains a sibling, or make
`config/` the final sibling and keep `logic/` as `├──`, ensuring the indentation
and branch characters for `App/` -> `logic/` -> `config/` reflect the correct
parent/child relationships.
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md`:
- Around line 106-117: The ASCII tree in the doc has inconsistent branch
markers: `logic/` is shown with a terminal marker `└──` while `config/` is added
as a sibling underneath; update the tree so branch characters reflect the actual
nesting (use `├──` for intermediate siblings and `└──` only for the last child)
— adjust the entries under "Templates/min-mal/content/" (entries `App/`,
`models/`, `ui/`, `layouts/`, `Settings.json`, `logic/`, `config/`,
`applicationmetadata.json`, `README.md`) so their `└──`/`├──` markers correctly
represent which items are last in each folder level.
- Around line 64-98: The schema URL referenced in the template.json section
(both the inline markdown link near "Alle `template.json`-filer må være i
samsvar med" and the jsonschema-validator shortcode attribute schemaUrl in the
`jsonschema-validator` shortcode) returns 404; update both places to a valid
schema location or remove/disable the validator. Locate the markdown link text
and the `jsonschema-validator label="Din mal:" schemaUrl="..."` shortcode in
this file and replace the broken URL with the correct reachable raw GitHub URL
for customtemplate.schema.json (or to an alternative hosted schema) so the
validator and link work, ensuring both references are identical.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md`:
- Around line 132-134: The tree diagram continues a vertical bar after the
last-child marker; update the line after the '└── config/' entry so it does not
continue the vertical pipe. Replace the continuation indentation that includes
'│' with plain spaces so the 'applicationmetadata.json' entry is indented under
'config' (i.e., align the line containing "applicationmetadata.json" under "└──
config/" without a leading '│').
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.nb.md`:
- Line 162: Endre teksten i linjen som inneholder "5. **Commit og push** til
hovedbranchen" ved å erstatte ordet "hovedbranchen" med det idiomatiske
bokmålsordet "hovedgrenen" slik at linjen blir "5. **Commit og push** til
hovedgrenen".
- Around line 83-91: The table under the "Felt | Type | Påkrevd | Beskrivelse"
header is misaligned and triggers MD060; fix it by ensuring each row uses the
same pipe placement and column spacing as the header row (align the vertical
bars for columns "Felt", "Type", "Påkrevd", "Beskrivelse"), adding or removing
spaces so every row has four pipe separators and matching column widths for
entries like "id", "owner", "name", "description", "remove", and
"packageReferences"; after aligning the pipes the markdownlint MD060 warning
should be resolved.
- Line 3: The frontmatter line for the guide contains a double space after the
key "description:"; remove the extra space so the line reads with a single space
after the colon (i.e., change "description: Hvordan ..." to "description:
Hvordan ...") to normalize spacing in the frontmatter.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@content/altinn-studio/v8/guides/development/custom-templates/_index.en.md`:
- Around line 176-181: The table's `type` field lists `codechange` but the
examples use `code-change`, causing inconsistency; update the `type` row in the
table to either use `code-change` (preferred) or list both variants (e.g.,
`code-change` / `codechange`) to match the examples, and make the same change
for the other occurrence of the `type` values later in the document so `type`
consistently documents `configuration`, `code-change` (or both), and
`documentation`.
🧹 Nitpick comments (1)
content/altinn-studio/v8/guides/development/custom-templates/_index.en.md (1)
226-236: Fix tree indentation underconfig/.After a
└──marker, the vertical bar should stop; keep only spaces so the child aligns correctly.🛠️ Proposed fix
-│ └── config/ -│ │ └── applicationmetadata.json +│ └── config/ +│ └── applicationmetadata.json
…nn-studio-docs into docs/custom-template
Summary by CodeRabbit
Documentation
New Features