Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion layouts/partials/learning-path.json.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,25 @@
"detailed_description": {{ .Content | safeHTML | jsonify }},
"banner": {{ $banner_url | jsonify }},
"badge": {{ partial "badge.html" (dict "page" . "badge" .Params.badge "curriculaId" $id ) | jsonify }},
"certificate": {{ .Params.certificate | jsonify }},
{{- $certificate := .Params.certificate -}}
{{- if $certificate }}
{{- $authorities := slice -}}
{{- range or (index $certificate "issuingAuthorities") (index $certificate "issuingauthorities") (index $certificate "issuing_authorities") }}
{{- $authorities = $authorities | append (dict
"name" (index . "name")
"role" (index . "role")
"signatureUrl" (or (index . "signatureUrl") (index . "signatureurl") (index . "signature_url"))
) -}}
{{- end }}
{{- $certificateJSON := dict
"title" (index $certificate "title")
"expiresIn" (or (index $certificate "expiresIn") (index $certificate "expiresin") (index $certificate "expires_in"))
"issuingAuthorities" $authorities
-}}
"certificate": {{ $certificateJSON | jsonify }},
{{- else }}
"certificate": null,
{{- end }}
Comment on lines +33 to +51
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.

medium

While this change correctly implements camelCase for the certificate object's internal fields, the rest of the JSON contract in this file still uses snake_case for several top-level and nested fields (e.g., org_id on line 23, detailed_description on line 30, total_courses on line 55, etc.). To maintain consistency and align with the project's canonical schema as per the general rules, all field names in the emitted JSON should be converted to camelCase (e.g., orgId, detailedDescription, totalCourses). Since the PR objective is to "Pass camelCase fields in json", addressing these remaining fields would ensure a complete fix for downstream consumers.

References
  1. Maintain consistency in emitted JSON contracts by using camelCase for all field names (e.g., 'orgId' instead of 'org_id') to align with the project's canonical schema.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The detailed_description have a schema drift - In downstream contract a camelCase is expected in schemas, this caused the description to be dropped in the consumer (Meshery-Cloud). I have updated it to camelCase to as per the canonical contract.

Other fields like org_id, still uses snake case in the schema contract (v1beta2), and is correctly parsed by the consumer. This would be updated when we increment meshery-cloud to use v1beta3

"permalink": {{ .RelPermalink | jsonify }},
"categories": {{ .Params.Categories | jsonify }},
"tags": {{ .Params.Tags | jsonify }},
Expand Down
Loading