Skip to content

Add Daml code-snippet modules for Canton Network documentation#1

Open
8bitpal wants to merge 1 commit intomainfrom
content/docs-cn-daml-snippets
Open

Add Daml code-snippet modules for Canton Network documentation#1
8bitpal wants to merge 1 commit intomainfrom
content/docs-cn-daml-snippets

Conversation

@8bitpal
Copy link
Copy Markdown

@8bitpal 8bitpal commented Apr 15, 2026

Summary

15 compilable Daml modules wrapping 29 code snippets from docs.canton.network. These ensure that Daml code examples shown in the documentation are compilation-checked by the existing daml_test infrastructure.

What's included

  • 15 .daml modules in sdk/docs/source/sdk/docs-canton-network/code-snippets/
  • 1 Bazel target (docs-canton-network-daml-test) added to sdk/docs/BUILD.bazel
  • 1 daml.yaml for local validation with dpm build

Module list

Module Snippets Source pages
DocsCN_AppdevDeepDivesCompositionMultiParty 1 Multi-party workflow composition
DocsCN_AppdevDeepDivesPrivacyModel 1 Privacy model deep dive
DocsCN_AppdevModulesM1MentalModels 1 Canton mental models
DocsCN_AppdevModulesM2MigrationChecklist 1 Migration checklist
DocsCN_AppdevModulesM2MultiPartyWorkflows 3 Multi-party workflow patterns
DocsCN_AppdevModulesM2SmartContractParadigm 2 Smart contract paradigm
DocsCN_AppdevModulesM3DesignPatterns 1 Composition and design patterns
DocsCN_AppdevModulesM3LanguageFundamentals 7 Language fundamentals
DocsCN_AppdevModulesM4BackendDev 1 Backend development (LicenseComment template)
DocsCN_AppdevModulesM7Performance 2 Performance best practices
DocsCN_AppdevReferenceDamlLanguageReference 2 Daml language reference
DocsCN_AppdevTroubleshootingGuideDevelopmentIssues 1 Troubleshooting
DocsCN_OverviewLearnLedgerModel 2 Ledger model overview
DocsCN_OverviewLearnPrivacyModel 1 Privacy model overview
DocsCN_SdksToolsCliToolsDamlScript 3 Daml Script CLI reference

How it works

The Bazel target uses the same pattern as existing doc snippet tests:

daml_test(
    name = "docs-canton-network-daml-test",
    timeout = "long",
    srcs = glob(["source/sdk/docs-canton-network/code-snippets/**/*.daml"]),
    deps = ["//daml-script/daml:daml-script.dar"],
)

New .daml files added to code-snippets/ are auto-discovered by the glob.

Validation

All modules compile successfully with dpm build (SDK 3.4.10). Fragment snippets (choice bodies, expressions) are included as comments within wrapper templates for documentation traceability.

29 Daml code snippets from docs.canton.network wrapped into 15
compilable modules in sdk/docs/source/sdk/docs-canton-network/code-snippets/.
Added daml_test Bazel target (docs-canton-network-daml-test) in BUILD.bazel.

All modules compile successfully with dpm build (SDK 3.4.10).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant