Skip to main content

Integration & Migration Examples

RFC Status: This section contains proposed examples for the OpenDocs Specification RFC.These examples are provided to illustrate how the specification could be implemented. Provide feedback to help refine these examples.

Template Integration Examples

OpenDocs supports multiple templating engines to generate documentation from DocItems. Here are examples using Liquid and Handlebars.

Liquid Template Usage

Handlebars Template Usage

Testing Examples

Unit Test for Extractor

Example of testing a TypeScript OpenDocs extractor:

Integration Test for Documentation Set

Example of testing a complete documentation set build:

Migration Examples

From JSDoc to OpenDocs

Migrating from traditional JSDoc comments to OpenDocs format:

From Rust Doc to OpenDocs

Migrating from Rust documentation comments to OpenDocs format:

Migration Best Practices

  1. Preserve Semantics: Ensure all documentation content is preserved during migration
  2. Map Tags Correctly: Convert language-specific doc tags to OpenDocs standard tags
  3. Test Thoroughly: Verify that all examples, parameters, and return types are correctly extracted
  4. Automate When Possible: Build migration scripts for large codebases
  5. Validate Output: Use JSON Schema validation to ensure generated DocItems are valid

Testing Best Practices

  1. Test Extractors: Write unit tests for each language extractor
  2. Integration Tests: Test the complete pipeline from source to documentation
  3. Snapshot Testing: Use snapshot tests to catch unintended changes in output
  4. Performance Tests: Test with large codebases to ensure acceptable performance
  5. Validation Tests: Ensure all output conforms to the OpenDocs schema

See Also


This example is part of the OpenDocs Specification RFC. Provide feedback to help improve it.