Skip to content

Fix HTML rendering of relationship variables in CiceroMark#637

Open
Aradhana2803 wants to merge 3 commits into
accordproject:mainfrom
Aradhana2803:fix/relationship-variable-html
Open

Fix HTML rendering of relationship variables in CiceroMark#637
Aradhana2803 wants to merge 3 commits into
accordproject:mainfrom
Aradhana2803:fix/relationship-variable-html

Conversation

@Aradhana2803
Copy link
Copy Markdown

@Aradhana2803 Aradhana2803 commented Dec 25, 2025

Fix HTML rendering of relationship variables in CiceroMark

Related to accordproject/template-playground#13

Summary

Relationship-typed CiceroMark variables were rendered in HTML as quoted
resource: strings instead of a readable identifier. This PR fixes the
HTML rendering logic so relationship variables display correctly.[TemplateMark not rendering relationships "resource" data #13]

Changes

  • Update ToHtmlStringVisitor to detect relationship variables via elementType
  • Render a clean relationship identifier instead of the raw serialized value
  • Preserve existing rendering behavior for primitive variable types

Flags

  • No breaking changes
  • Change is limited to HTML rendering only (CiceroMark JSON unchanged)

Screenshots or Video

Not applicable — behavior verified via existing HtmlTransformer test suite.

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

Signed-off-by: aradhana2803 <aradhanasingh2803@gmail.com>

git push --force origin fix/relationship-variable-html
@Aradhana2803 Aradhana2803 force-pushed the fix/relationship-variable-html branch from 154e571 to 7c5caf5 Compare December 25, 2025 17:22
@Aradhana2803
Copy link
Copy Markdown
Author

This PR fixes the issue reported in template-playground#13 where relationship-typed CiceroMark variables were rendered as quoted resource: strings instead of a readable identifier. HTML rendering now preserves the identifier cleanly, while keeping other variable types unchanged.Verified that Party relationship variables now render clean identifiers in HTML
without quotes. All existing HtmlTransformer tests pass.

Copy link
Copy Markdown
Member

@sanketshevkar sanketshevkar left a comment

Choose a reason for hiding this comment

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

Can you please add unit tests covering this case?

Replace hardcoded namespace prefix check with identifiedBy, which is the
canonical Concerto marker for relationship/reference types. Only strip the
resource URI (resource:namespace#identifier) scheme when the value actually
carries that prefix, leaving primitive quoted values unchanged so existing
tests are unaffected.

Add unit tests covering quoted resource URI, bare resource URI, and
primitive variable rendering.

Signed-off-by: Matt Roberts <matt@rbrts.uk>
Signed-off-by: Matt Roberts <code@rbrts.uk>
@mttrbrts mttrbrts requested a review from sanketshevkar May 9, 2026 20:57
@mttrbrts
Copy link
Copy Markdown
Member

mttrbrts commented May 9, 2026

@sanketshevkar I've pushed an updated commit on top of this branch that addresses your review.

renderVariableValue — more robust relationship detection

The original check used thing.elementType.startsWith('org.accordproject.party@'), which only handled one hardcoded namespace. I've replaced it with a check on thing.identifiedBy, which is the canonical Concerto marker for relationship/reference types regardless of namespace. The logic now only rewrites the display value when it's a full resource URI (resource:namespace#identifier), extracting the identifier after #. Plain quoted values like "Party A" are passed through unchanged, so existing roundtrip tests are unaffected.

Unit tests added

Three cases in a new describe block in HtmlTransformer.test.js:

  1. Quoted resource URI value → renders as clean identifier, no resource: prefix
  2. Bare (unquoted) resource URI value → same
  3. Primitive variable (no identifiedBy) → value unchanged

All 65 existing tests still pass.

…c lint rule

Signed-off-by: Matt Roberts <matt@rbrts.uk>
Signed-off-by: Matt Roberts <code@rbrts.uk>
@github-actions github-actions Bot added the maintainer-engaged A maintainer has commented or reviewed this item label May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer-engaged A maintainer has commented or reviewed this item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants