From f1f06c40d27c4ec0aacc049ca7f879bd5d369780 Mon Sep 17 00:00:00 2001 From: Alex Quinn <227241865+alexquincy@users.noreply.github.com> Date: Fri, 22 May 2026 18:32:31 -0500 Subject: [PATCH] fix(json): emit canonical camelCase JSON wire keys Flips snake_case JSON output keys to camelCase across the three remaining templates that still emit snake form, completing the canonical wire-tag contract for the academy JSON view files. Hard prerequisite for the meshery-cloud v1beta3 academy migration: - learning-path.json.html line 23 emits 'org_id', which populates AcademyCurricula.OrgId. v1beta2 had json:'org_id', v1beta3 (released in schemas v1.2.12) has json:'orgId' and no UnmarshalJSON fallback. Without this change, cloud reading curriculum on v1beta3 would silently write nil-OrgId rows and break org-scoped curriculum lookups. Adjacent canonical-casing alignment (same theme PR, consistent wire form): - learning-path.json.html: total_courses/total_tests/total_modules/ total_pages -> totalCourses/totalTests/totalModules/totalPages; prerequisite_knowledge/related_resources/additional_attributes -> prerequisiteKnowledge/relatedResources/additionalAttributes. - common-curricula-properties.html: reading_time/prerequisite_knowledge/ related_resources -> readingTime/prerequisiteKnowledge/relatedResources. - lab/single.json.json: starter_catalog_link/starter_embed_link/ answer_catalog_link/answer_embed_link -> starterCatalogLink/ starterEmbedLink/answerCatalogLink/answerEmbedLink. The Hugo source-side reads (.Params.) are left unchanged: they match the existing frontmatter keys in the content repos (layer5-academy, exoscale-academy, meshery-academy, academy-example), so no content-repo change is required. The transformation is purely on the JSON output side. Theme partials test/single.html (quiz) was already camelCase; this PR brings the remaining three to parity. Post-merge, every JSON wire key the theme emits is canonical camelCase (verified: grep for snake-cased JSON keys across layouts/ returns empty). Signed-off-by: Alex Quinn <227241865+alexquincy@users.noreply.github.com> --- layouts/lab/single.json.json | 8 ++++---- .../partials/common-curricula-properties.html | 6 +++--- layouts/partials/learning-path.json.html | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/layouts/lab/single.json.json b/layouts/lab/single.json.json index affaeeb..2222e0c 100644 --- a/layouts/lab/single.json.json +++ b/layouts/lab/single.json.json @@ -5,13 +5,13 @@ "description": {{ .Content | plainify | jsonify }}, "weight": {{ $p.weight | jsonify }}, "type": "lab", - "starter_catalog_link": {{ $p.starter_catalog_link | jsonify }}, - "starter_embed_link": { + "starterCatalogLink": {{ $p.starter_catalog_link | jsonify }}, + "starterEmbedLink": { "src": {{ $p.starter_embed_link.src | jsonify }}, "id": {{ $p.starter_embed_link.id | jsonify }} }, - "answer_catalog_link": {{ $p.answer_catalog_link | jsonify }}, - "answer_embed_link": { + "answerCatalogLink": {{ $p.answer_catalog_link | jsonify }}, + "answerEmbedLink": { "src": {{ $p.answer_embed_link.src | jsonify }}, "id": {{ $p.answer_embed_link.id | jsonify }} } diff --git a/layouts/partials/common-curricula-properties.html b/layouts/partials/common-curricula-properties.html index b254d51..f0b054a 100644 --- a/layouts/partials/common-curricula-properties.html +++ b/layouts/partials/common-curricula-properties.html @@ -14,10 +14,10 @@ "permalink": {{ $page.RelPermalink | jsonify }}, "type": {{ $type | jsonify }}, "prerequisites": {{ partial "test/collect-prerequisites.html" $page | jsonify }}, -"reading_time": {{ $page.ReadingTime | jsonify }}, +"readingTime": {{ $page.ReadingTime | jsonify }}, "competencies": {{ $page.Params.competencies | jsonify }}, "objectives": {{ $page.Params.objectives | jsonify }}, "audience": {{ $page.Params.audience | jsonify }}, -"prerequisite_knowledge": {{ $page.Params.prerequisite_knowledge | jsonify }}, -"related_resources": {{ $page.Params.related_resources | jsonify }} +"prerequisiteKnowledge": {{ $page.Params.prerequisite_knowledge | jsonify }}, +"relatedResources": {{ $page.Params.related_resources | jsonify }} diff --git a/layouts/partials/learning-path.json.html b/layouts/partials/learning-path.json.html index 20cf40e..112d06d 100644 --- a/layouts/partials/learning-path.json.html +++ b/layouts/partials/learning-path.json.html @@ -20,7 +20,7 @@ "id": {{ $id | jsonify }}, "level": {{ (trim $level " \n\r\t") | jsonify }}, "slug": {{ $slug | jsonify }}, - "org_id": {{ $uuid | jsonify }}, + "orgId": {{ $uuid | jsonify }}, "type": {{ .Params.Type | jsonify }}, "visibility": {{ or .Params.Visibility "public" | jsonify }}, "status": {{ or .Params.Status "ready" | jsonify }}, @@ -52,16 +52,16 @@ "permalink": {{ .RelPermalink | jsonify }}, "categories": {{ .Params.Categories | jsonify }}, "tags": {{ .Params.Tags | jsonify }}, - "total_courses": {{ len (where .Pages "Type" "course") }}, - "total_tests": {{ len (where .Pages "Type" "test") }}, - "total_modules": {{ len (where .Pages "Type" "module") }}, - "total_pages": {{ len (where .Pages "Type" "page") }}, + "totalCourses": {{ len (where .Pages "Type" "course") }}, + "totalTests": {{ len (where .Pages "Type" "test") }}, + "totalModules": {{ len (where .Pages "Type" "module") }}, + "totalPages": {{ len (where .Pages "Type" "page") }}, "competencies": {{ .Params.competencies | jsonify }}, "objectives": {{ .Params.objectives | jsonify }}, "audience": {{ .Params.audience | jsonify }}, - "prerequisite_knowledge": {{ .Params.prerequisite_knowledge | jsonify }}, - "related_resources": {{ .Params.related_resources | jsonify }}, - "additional_attributes": {{ .Params.additional_attributes | jsonify }}, + "prerequisiteKnowledge": {{ .Params.prerequisite_knowledge | jsonify }}, + "relatedResources": {{ .Params.related_resources | jsonify }}, + "additionalAttributes": {{ .Params.additional_attributes | jsonify }}, "children": [ {{- range $j, $c := .Pages }} {{- if $j }},{{ end }}