Skip to content

bug(markdown): MarkdownVisitor omits map and scalar declarations and mislabels declaration types #321

Open

Description

@chaitijain593-prog

Expected Behavior

When generating Markdown documentation using MarkdownVisitor:

  1. Map Declarations should be rendered with their name, key type, value type, and any description decorators.
  2. Scalar Declarations should be rendered with their name, underlying primitive type, default value, validation constraints (e.g., regex, length bounds, range bounds), and description decorators.
  3. Declaration Stereotypes in section headings should accurately reflect the declaration kind: (Asset), (Participant), (Transaction), (Event), and (Concept).
  4. Table column headers should be spelled correctly (Constraints instead of Contraints).

Actual Behavior

  1. Maps and scalars are completely omitted: In lib/codegen/fromcto/markdown/markdownvisitor.js, visitModelFile writes ## Overview reporting map and scalar counts (- 6 maps, - 2 scalars), but the visitor never implements visitMapDeclaration or visitScalarDeclaration. The fallback no-op methods from BaseVisitor run, resulting in zero documentation generated for maps or scalars.
  2. All non-enum classes are labeled (Concept): visitClassDeclaration hardcodes ### ${classDeclaration.getName()} (Concept). Because visitAssetDeclaration, visitParticipantDeclaration, visitTransactionDeclaration, and visitEventDeclaration are not overridden, all assets, participants, transactions, and events are documented as concepts (e.g., ### Equipment (Concept) instead of ### Equipment (Asset)).
  3. Column header typo: Line 143 writes | Contraints | instead of | Constraints |.
  4. No dedicated unit tests: test/codegen/fromcto/markdown/ currently does not exist.

Steps to Reproduce

  1. Load a model file containing maps, scalars, assets, transactions, and events (such as test/codegen/fromcto/data/model/hr_base.cto + hr.cto).
  2. Run MarkdownVisitor on the ModelManager.
  3. Inspect models.md:
    • ## Overview reports counts for maps and scalars, but neither appears in the document.
    • Assets and participants (like Equipment and Person) appear under ### Equipment (Concept) and ### Person (Concept).
    • The field table has the header | Contraints |.

Context

  • Target: markdown
  • File: lib/codegen/fromcto/markdown/markdownvisitor.js

Pull Request

A fix with comprehensive unit tests and snapshot updates is ready to be submitted.

Activity

  1. mira-accord-project commented on Nov 13, 2026

    @mira-accord-project

    Thank you for the clear report, including the reproduction steps and the pointers to the code.

    This issue is linked to pull request #322, which implements the fix: rendering map and scalar declarations, the Asset, Participant, Transaction and Event stereotypes, and the Constraints header. A maintainer will review #322 against this issue. Nothing more is needed from you here for now.

    We searched merged pull requests for an existing fix and found none, so #322 is the one to review.

    Drafted by an Accord Project agent, reviewed by a maintainer.

  2. mira-accord-project commented on Nov 13, 2026

    @mira-accord-project

    Thank you for the detailed report. Pull request #322 covers the points raised here: it adds the missing map and scalar sections, uses the correct stereotype for each declaration kind, corrects the Constraints header, and adds unit tests.

    We have requested reviews from the codegen maintainers.

    Drafted by an Accord Project agent, reviewed by a maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions