Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
A brief history in time of our major releases
In this section, you will find the release notes for each version we release under this major version. If you are looking for the release notes of previous major versions, use the version switcher at the top left of this documentation book. Here is a breakdown of our major version releases.
Major release adding full BoxLang support, modern HTML themes with dark mode, enhanced UI/UX with real-time search, complete relationship documentation, and comprehensive developer experience improvements.
This major bump was to deprecate some CFML engines
Added a JSON strategy in preparation for multiple output strategies we will support. Updated build processes and a new outlook for the future of the project.
The migration from ColdDoc into DocBox.
DocBox is a JavaDoc-style documentation generator for your BoxLang and CFML Applications.
📚 DocBox reads class metadata and structured comments and outputs documentation in an HTML, JSON, or UML (diagram) format. You can see our live docs here: https://s3.amazonaws.com/apidocs.ortussolutions.com/docbox/5.0.0/index.html
BoxLang 1.8+
Lucee 5+ / Adobe ColdFusion 2023+ (CFML Support)
DocBox is maintained under the Semantic Versioning guidelines as much as possible. Releases will be numbered in the following format:
<major>.<minor>.<patch>And constructed with the following guidelines:
Breaking backward compatibility bumps the major (and resets the minor and patch)
New additions without breaking backward compatibility bumps the minor (and resets the patch)
Bug fixes and misc changes bumps the patch
Apache 2 License:
💻 Code:
🐛 Issues:
💬 Community:
DocBox is professional open source software backed by offering services like:
🛠️ Custom Development
🎯 Professional Support & Mentoring
📖 Training
⚡ Server Tuning
Because of His grace, this project exists. If you don't like this, don't read it; it's not for you.
"Therefore being justified by faith, we have peace with God through our Lord Jesus Christ: By whom also we have access by faith into this grace wherein we stand, and rejoice in hope of the glory of God." Romans 5:5
🔒 Security Hardening
👀 Code Reviews
🚀

Adobe 2023 Testing and Support
New Github Actions
New supporting files
New build/Docs.cfc task for building the documentation using itself, before we where getting away with it because there was a previous DocBox version. Now we need to build the docs with the current version of DocBox.
Build Versions and changelog
Removal of box.zip in root from old scripts
Learn how to contribute to the DocBox project by submitting pull requests, reporting issues, and writing tests.
🤝 There are several ways you can help in the development of DocBox!
🔧
🐛 Submit a bug or feature request to our
✅
Minimum CFML engine requirements updated:
Lucee 5.x minimum (dropped Lucee 4.x)
Adobe ColdFusion 2023+ (dropped ACF 2016, 2018, 2021)
Dropped support for Adobe 2016. Adobe doesn't support ACF 16 anymore, so neither do we.
Added support for Adobe 2021
Added support for @myCustomTag custom docblock tags on methods. (Already supported on components and properties, but missing on methods).
Fork DocBox or the DocBox documentation repo
Clone the repository fork to your machine - git clone git@github.com:ME/DocBox.git
Create a feature/ or patch/ branch: git checkout -b patch/syntax-error-in-html-output
Make your changes, commit as normal, and use git push to sync your commits to Github.
Please target all PRs at the development branch.
DocBox has a suite of Testbox specs validating that it works as expected. New features and bug fix PRs should (ideally) contain accompanying tests. Here's how to do that via CommandBox:
After cloning the repo, run box install to install development dependencies
Run box start to boot a test server
Run box testbox run to run the suite of DocBox tests.
Edit test specs in tests/specs as necessary, and run box testbox run again to validate tests pass.
Added GitHub Actions CI for automated testing, format checking, releases and more
Fixes support for Adobe 2018. (Mainly in the CommandBox strategy.)
Default theme structure reorganized with new Alpine.js-based SPA architecture
Full BoxLang 1.0+ Runtime Support - DocBox now runs natively on BoxLang
BoxLang CLI Module - New boxlang module:docbox command for generating docs from BoxLang CLI
boxlang module:docbox --source=/path --mapping=app --output-dir=/docs
Support for multiple source mappings
JSON array format support for complex project structures
Built-in help system with --help and --version flags
Dual Format Metadata Handling - Automatically detects and handles both BoxLang array format and CFML struct format for implements metadata
ModuleConfig.bx - Native BoxLang module configuration for seamless integration
Two Professional Themes:
Default Theme - Modern Alpine.js SPA with client-side routing and dynamic filtering
Frames Theme - Traditional frameset-based layout with Bootstrap 5
Theme Selection - Choose themes via theme property:
Dark Mode Support - Full dark/light theme toggle with localStorage persistence
Responsive Design - Mobile-friendly layouts with proper breakpoints
Modern Color Scheme - Purple gradient accents (#5e72e4), softer colors, reduced blue overload
Visual Indicators - Emoji badges throughout:
📚 Packages, 📁 Folders, 🔌 Interfaces, 📦 Classes
🟢 Public, 🔒 Private, ⚡ Static, 📝 Abstract
Real-time Method Search - Live filtering with keyboard navigation
Search methods by name or signature
Navigate results with Enter/Shift+Enter
Visual highlighting and auto-scroll
Method Tabs - Tabbed interface for filtering methods (All/Public/Private/Static/Abstract)
Bootstrap Tooltips - Contextual help on visibility badges and deprecated methods
Smooth Scrolling - Enhanced navigation with smooth scroll behavior
Auto-expanding Navigation - jstree automatically expands first 2 levels for better UX
All Known Implementing Classes - Interfaces now show all classes that implement them
All Known Subclasses/Subinterfaces - Display complete inheritance hierarchy
Fixed Inheritance Queries - Properly handles both current class and ancestor interfaces
Improved Package Highlighting - Subtle left border instead of full background
Enhanced JavaDoc Support - Comprehensive documentation with <br> tags for BoxLang compatibility
50+ Updated Code Examples - All strategy files updated with proper line breaks
Improved Error Messages - Better validation and user-friendly CLI output
Modern JavaScript - ES6+ features with proper spacing conventions
CSS Custom Properties - Comprehensive theming system with CSS variables
CommandBox Strategy - Enhanced CLI command documentation with namespace support
JSON Strategy - Machine-readable JSON with hierarchical package structure
XMI/UML Strategy - Enhanced property inference and generic type support
Abstract Template Strategy - Improved helper methods for all strategies
Build System - Updated build process with BoxLang support
Testing - Multi-engine testing (Lucee 5/6, Adobe 2023/2025, BoxLang 1.0/BE)
Documentation - Comprehensive updates for all new features
Code Formatting - Consistent CFFormat rules across entire codebase
Performance - Optimized query operations and template rendering
Metadata Format Handling - getImplements() now properly handles both array and struct formats
Interface Implementation Display - Fixed empty queries for implementing classes
Package Navigation - Improved CSS styling for better UX
Line Break Handling - Workaround for BoxLang metadata line break stripping
Inheritance Detection - Properly checks current class before ancestors
Bootstrap 5.3.2 - Modern component syntax and data-bs-* attributes
Bootstrap Icons 1.11.2 - Comprehensive icon set for UI elements
Alpine.js - Lightweight reactive framework for SPA theme
CSS Architecture - CSS custom properties for theming with light/dark mode
JavaScript Conventions - Proper spacing in all control structures and function calls
Minimum Requirements: Ensure you're running Lucee 5+, Adobe 2018+, or BoxLang 1.0+
HTML Output: The default theme now uses Bootstrap 5. If you have custom CSS, review for compatibility
Theme Selection: Explicitly set theme="frames" if you prefer the traditional frameset layout
BoxLang Users: Use the new boxlang module:docbox CLI command for native BoxLang integration
If you extended the HTML strategy:
Update Bootstrap 3 classes to Bootstrap 5 equivalents
Review custom CSS for CSS custom property compatibility
Test dark mode if you have custom themes
GitHub Issues: https://github.com/Ortus-Solutions/DocBox/issues
Documentation: https://docbox.ortusbooks.com
Community Forum: https://community.ortussolutions.com
# CommandBox users
box update docbox
# BoxLang users
boxlang install docbox
# Verify installation
box package show versionGenerate JSON output for easy documentation imports into other documentation tools and platforms.
📋 Generate machine-readable JSON documentation for easy imports into other documentation tools and platforms.
Begin by creating an instance of DocBox:
docbox = new DocBox();The following are the properties for this strategy:
projectTitle : Used in the top-level overview-summary.json file
outputDir : The output directory absolute path
Just pass them in the docbox.addStrategy() call:
Now that you have an instance of DocBox configured with your strategy and its properties, just execute the generate() method with its appropriate arguments:
Get started with installing DocBox in your BoxLang or CFML application.
DocBox can be installed and used in multiple ways, depending on your needs. The recommended method for most users is to install DocBox as a BoxLang module, which provides access to the powerful CLI tool for generating documentation. However, you can also use it as a CommandBox module or a standalone CFML application.
DocBox 5.0+ can be installed as a native BoxLang core module, providing access to the powerful CLI tool.
Once installed, you can use the boxlang module:docbox CLI command to generate documentation. See the page for complete usage details and examples.
DocBox includes a native BoxLang CLI module for generating documentation:
We also have a CommandBox module called , which enables generating documentation from the CLI as a CommandBox command.
Create your own custom output format by extending DocBox's strategy system.
🛠️ In addition to the mainstream output formats, you can extend DocBox's AbstractTemplateStrategy class to generate your own which implements the IStrategy class.
/**
* Strategy Interface for DocBox Documentation Generation
* <br>
* This interface defines the contract that all DocBox documentation strategies must implement.
* Strategies are responsible for generating documentation output in various formats (HTML, JSON, XMI, etc.)
* from the component metadata collected by DocBox.
* <br>
* <small><em>Copyright 2015 Ortus Solutions, Corp <a href="www.ortussolutions.com">www.ortussolutions.com</a></em></small>
*/
interface {
/**
* Execute the documentation generation strategy
*
* This method receives the complete metadata query from DocBox and is responsible for:
* - Processing the component metadata
* - Generating the appropriate output format
* - Writing files to the configured output location
*
* @metadata Query object containing all component metadata with columns:
* - package: The package name
* - name: The component name
* - metadata: The complete component metadata structure
* - type: The component type (component, interface, etc.)
* - extends: The extended component name (if any)
* - implements: The implemented interfaces (if any)
*
* @return The strategy instance for method chaining
*/
IStrategy function run( required query metadata );
}new docbox.DocBox()
.addStrategy( "HTML", {
outputDir : "/docs",
theme : "default" // or "frames"
} )docbox = new DocBox();
docbox.addStrategy( "JSON",
{
projectTitle = "DocBox API",
outputDir = expandPath( "/resources/tmp" )
} );docbox.generate(
source = "#expandPath( '/docbox' )",
mapping = "coldbox",
excludes = "tests"
);box install commandbox-docbox to install the docbox command namespaceRun docbox help to get a list of commands
Run docbox generate help to show help for the docbox generate command
Please see the for more info.
Installing and using DocBox consists of three main steps:
For best results, use to run box install docbox --saveDev in your app root.
Alternatively, you can download the DocBox source code and drop it into a docbox folder in your application.
If DocBox is not installed in the root of your application, you will need to create a docbox mapping that points to the DocBox source code location:
Then you can access DocBox via the mapping you created.
box install bx-docboxinstall-bx-module bx-docbox# Basic usage
boxlang module:docbox --source=/path/to/code --mapping=myapp --output-dir=/docs
# With project title and excludes
boxlang module:docbox --source=/src --mapping=myapp \
--excludes="(tests|build)" \
--output-dir=/docs \
--project-title="My API"
# Multiple source mappings
boxlang module:docbox --mappings:v1=/src/v1/models \
--mappings:v2=/src/v2/models \
--output-dir=/docs
# Using frames theme
boxlang module:docbox --source=/src --mapping=app \
--output-dir=/docs \
--theme=frames
# Show help
boxlang module:docbox --help
# Show version
boxlang module:docbox --versionthis.mappings[ "docbox" ] = expandPath( "./libraries/doctorBox" );<cfscript>
new docbox.DocBox().generate(
source = expandPath( "./src" ),
mapping = "myapp",
outputDir = expandPath( "./docs" )
)
</cfscript>Configure DocBox output formats and generation options
DocBox offers several built-in output formats as well as enabling you to create your own:
🌐 HTML - Modern HTML documentation with two theme options
📋 JSON - Machine-readable JSON format
📐 UML - XMI/UML diagram generation
Each format is configured by its alias name, such as "JSON", "HTML", or "XMI".
You can call the .addStrategy() method multiple times to generate multiple output formats:
The HTML strategy now supports theme selection:
Default Theme:
⚡ Alpine.js SPA architecture
🌓 Dark mode toggle with persistence
🔍 Real-time method search
📑 Tabbed method summaries
Frames Theme:
📱 Traditional three-panel frameset
🗂️ Left sidebar navigation
🎨 Bootstrap 5 styling
🌓 Dark mode support
The generate() method accepts the following parameters:
source : A path to the source location or an array of structs of locations that must have a dir and mapping key
mapping : The base mapping for the folder source (used only if source is a path)
DocBox 5.0 includes a native BoxLang CLI module:
See boxlang module:docbox --help for complete CLI documentation.
For backwards compatibility, specifying the full class path is still supported, as is specifying a single strategy when initializing DocBox:
Generate an XML file for graphing your application via Eclipse UML2Tools
📐 Generate an XML file for graphing your application via Eclipse UML2Tools
UML2 Tools hasn't been developed for Eclipse since 2008. This strategy is now more for reference than anything else.
This is a documentation strategy that ultimately lets you generate UML diagrams from the CFCs that you have written. That being said, it does not actually generate diagrams.
What this template startegy does is generate the XML file the Eclipse UML2 Tools that stores the information about your domain - the classes, the associations, the inheritence hierarchy, etc. From there it is very easy with UML2 Tools to generate UML diagrams like Class Diagrams, Sequence Diagrams, etc.
To get started, you need to download and install the Eclipe plugin UML2 Tools in your Eclipse install.
We are actually going to use the 0.9.1 Integration Builds plugin, simply because it is more stable, and has several key bug fixes.
Download the All-In-One Update Site and save the .zip file
In Eclipse, go to Help > Install New Software
Click Add
Enter the name UML2 Tools in Name
Click Archive and select the .zip file you downloaded.
1 . Click OK, and continue through the installation process
Once that process is complete, the Eclipse UML2 Tools plugin should now be installed and working.
To get DocBox to generate the .uml file that UML2Tools needs, we use the UMLstrategy. For example:
This will generate the .uml (in this case docbox.uml) file which we can then use.
To view and edit the UML diagrams from here:
Browse to the .uml file that you generated in the Navigator Pane
Right click on the .uml file
Select Initialise Class Diagram
Select the root package that you wish to model
You will now be presented with a UML Class diagram of your CFC model.
There are other types of UML2 diagrams that can be created. Have a look at the UML2 Tools documentation for more options.
There are some assumptions that are made by this strategy, when converting from CFCs to UML diagrams, as some meta data on CFCS are not provided and/or cannot be specified.
A property/field is determined for a class when a get and set function exist with the same name (or set and is for boolean values) and the argument type of the set function matches the return type of the get/is function.
The scope for the property/field is selected by highest level of exposure between the get and set functions. I.e. if getFoo() is public, and setFoo() is private, then the property foo is marked as public.
💜 Modern purple gradient design
🎯 Bootstrap 5 components
excludes : A regular expression that will be evaluated against all classes. If the regex matches the class name and path, the class will be excludedvar docbox = new docbox.DocBox();
docbox.addStrategy( "UML", { outputFile : "./tmp/docs/app-diagram.uml" })new docbox.DocBox()
.addStrategy( "HTML", {
projectTitle : "My API Documentation",
outputDir : expandPath( './docs' ),
theme : "default" // or "frames"
} )
.generate(
source = expandPath( "/app" ),
mapping = "app",
excludes = "(tests|build)"
);new docbox.DocBox()
.addStrategy( "HTML", {
projectTitle : "My Docs",
outputDir : expandPath( '/docs/html' ),
theme : "default"
} )
.addStrategy( "JSON", {
projectTitle : "My Docs",
outputDir : expandPath( '/docs/json' )
} )
.addStrategy( "XMI", {
outputFile : expandPath( '/docs/diagram.uml' )
} )
.generate(
source = expandPath( "/app" ),
mapping = "app",
excludes = "(tests|build)"
);// Use the modern SPA theme (default)
docbox.addStrategy( "HTML", {
projectTitle : "My API",
outputDir : expandPath( './docs' ),
theme : "default"
} );
// Use the traditional frames theme
docbox.addStrategy( "HTML", {
projectTitle : "My API",
outputDir : expandPath( './docs' ),
theme : "frames"
} );docbox.generate(
source = expandPath( '/myapp' ),
mapping = 'myapp',
excludes = '(tests|build)'
);docbox.generate(
source = [
{ dir: expandPath( '/app/models' ), mapping: 'app.models' },
{ dir: expandPath( '/app/handlers' ), mapping: 'app.handlers' },
{ dir: expandPath( '/plugins' ), mapping: 'plugins' }
],
excludes = '(tests|specs)'
);# Basic usage
boxlang module:docbox --source=/path/to/code \
--mapping=myapp \
--output-dir=/docs
# With options
boxlang module:docbox --source=/app \
--mapping=myapp \
--output-dir=/docs \
--project-title="My API" \
--theme=frames \
--excludes="(tests|build)"
# Multiple sources
boxlang module:docbox --mappings:models=/app/models \
--mappings:handlers=/app/handlers \
--output-dir=/docsvariables.docbox = new docbox.DocBox(
strategy = "docbox.strategy.uml2tools.XMIStrategy",
properties = {
projectTitle : "DocBox Tests",
outputFile : variables.testOutputFile
}
);Click OK
docBox = new DocBox();
docBox.addStrategy( "UML", { projectFile = expandPath( "./uml/docbox.uml" ) });
docbox.generate( expandPath("/docbox"), "docbox" );
Understanding the output format of the DocBox JSON strategy
The JSON strategy outputs three types of files:
DocBox's JSON strategy outputs a single overview-summary.json file in the root of the configured outputDir directory that documents all packages (component directories) and classes in the configured source.
This overview-summary.json file will match the following schema:
See an example at
DocBox's JSON strategy outputs a package-summary.json file for every directory found in the configured source directory that contains at least one ColdFusion component.
source/autos/autoBuilder.cfc will generate a docs/source/autos/package-summary.json
This package-summary.json file will match the following schema:
See an example at
DocBox's JSON strategy outputs a single class.json file for every .cfc component found in the configured source directory.
The name of the file will reflect the component name, and the location will match the source directory hierarchy:
source/app/autos/autoBuilder.cfc becomes docs/source/app/autos/autoBuilder.json
source/main.cfc becomes docs/source/main.json
Each component documentation file will match the following schema:
See an example at
Generate CommandBox CLI command documentation with namespace organization
🎯 The CommandBox Strategy is a specialized output format designed specifically for documenting CommandBox CLI commands and namespaces. It extends the HTML API Strategy with CLI-focused terminology and navigation.
The CommandBox Strategy transforms CommandBox command components into searchable, navigable HTML documentation with command-specific features:
Command-Centric Navigation - Organizes by command namespaces (not packages)
CLI Terminology - Uses "commands" and "namespaces" instead of "classes" and "packages"
Qualified Names - Displays full command paths (e.g., server start, package show)
Namespace Hierarchy - Visualizes command organization and nesting
Frames Theme - Uses traditional frameset layout for CLI documentation
The CommandBox Strategy accepts the following configuration properties:
The CommandBox Strategy generates the following file structure:
Unlike standard class documentation, CommandBox Strategy shows the full command path:
Commands are grouped by their namespace hierarchy:
server namespace
start command
stop command
The strategy uses specialized templates that:
Display command syntax and usage
Show command examples in CLI format
Highlight command parameters and flags
Use CLI-appropriate terminology
Generate documentation for CommandBox's built-in commands:
Document your own CommandBox module commands:
Document multiple CommandBox modules together:
The CommandBox Strategy:
Extends: docbox.strategy.api.HTMLAPIStrategy
Template Path: /docbox/strategy/CommandBox/resources/templates
Assets Path: /docbox/strategy/api/themes/frames/resources/static
The strategy augments the standard metadata query with additional columns:
command - The command name extracted from the component
namespace - The namespace path for the command
CommandBox Strategy overrides specific templates:
class.cfm - Modified to show command syntax
package-summary.cfm - Shows namespace commands
overview-summary.cfm - Lists all namespaces
Theme Locked: CommandBox Strategy always uses the frames theme for consistency
Command Components: Expects CommandBox command component structure
Namespace Detection: Automatically extracts namespace from component metadata
Asset Sharing: Reuses frames theme assets for stability
- Parent strategy documentation
- Creating your own strategies
- Strategy configuration options
Use consistent naming conventions for command components
Add comprehensive JavaDoc comments to commands
Document command parameters with @hint attributes
Include usage examples in command descriptions
Generate browsable HTML documentation for your application Classes
🌐 The HTML API Strategy is used to create class documentation based on Javadoc.
DocBox 5.0 introduces a completely redesigned HTML output with two professional themes:
The default theme features:
Alpine.js-based SPA - Client-side routing and dynamic filtering
🌓 Dark Mode Support - Toggle between light and dark themes with persistence
🔍 Real-time Search - Live method filtering with keyboard navigation (Enter/Shift+Enter)
🎨 Modern UI - Bootstrap 5, purple gradient accents, emoji indicators
📱 Responsive Design - Mobile-friendly layouts
📑 Method Tabs - Filter by All/Public/Private/Static/Abstract
✨ Smooth Scrolling - Enhanced navigation experience
The frames theme provides:
Frameset-based Layout - Classic three-panel documentation view
Bootstrap 5 Styling - Modern component design
Package Navigation - Left sidebar with hierarchical tree
Dark Mode Support - Consistent theming across all panels
Begin by creating an instance of DocBox:
The following are the properties for this strategy:
projectTitle : The HTML title used in the documentation
projectDescription : The HTML project description
outputDir : The output directory absolute path
Just pass them in the docbox.addStrategy() call:
To use the traditional frameset layout:
Now that you have an instance of DocBox configured with your strategy and its properties, just execute the generate() method with its appropriate arguments:
Get started with the BoxLang CLI tool for generating documentation
🦤 DocBox 5.0+ includes a native BoxLang module with a powerful CLI tool for generating documentation directly from the command line.
DocBox can be installed as a BoxLang core module using the bx-docbox slug:
Once installed, the boxlang module:docbox command becomes available for generating documentation.
string
No
HTML title for documentation (default: "Untitled")
restart command
package namespace
show command
set command
install command
Group related commands under the same namespace
outputDir
string
Yes
Output directory absolute path
projectTitle
Traditional UX - Familiar navigation pattern
theme : (Optional) Theme name - "default" or "frames" (defaults to "default")


{
"$id": "point-to-public-json-schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Package documentation index",
"description": "This class index links to each generated class documentation JSON file.",
"required": [],
"type": "object",
"properties": {
"title": {
"type": "string"
},
"classes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"path": {
"type": "string"
}
}
}
},
"packages": {
"type": "object",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"path": {
"type": "string"
}
}
}
}
}
}{
"$id": "point-to-public-json-schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Package documentation index",
"description": "Index file documenting each coldfusion component inside a package level - i.e. per directory.",
"required": [],
"type": "object",
"properties": {
"title": {
"type": "string"
},
"classes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"path": {
"type": "string"
}
}
}
}
}
}{
"$id": "point-to-public-json-schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Class documentation",
"description": "Documents a single class in a ColdFusion package.",
"required": [],
"definitions": {
"function" : {
"type" : "object",
"properties": {
"name" : { "type" : "string" },
"hint" : { "type" : "string" },
"description" : { "type" : "string" },
"access" : { "type" : "string" },
"parameters" : {
"type" : "array",
"items": { "$ref" : "#/definitions/parameter" }
},
"returnType" : { "type" : "string" },
"returnFormat" : { "type" : "string" },
"position" : {
"type" : "object",
"properties" : {
"start" : { "type" : "integer" },
"end" : { "type" : "integer" }
}
}
}
},
"parameter" : {
"type" : "object",
"properties": {
"type" : { "type" : "string" },
"name" : { "type" : "string" },
"required" : { "type" : "boolean" },
"default" : { "type" : "string" }
}
}
},
"type": "object",
"properties": {
"name" : { "type": "string" },
"package" : { "type": "string" },
"type" : { "type": "string" },
"extends" : { "type" : "string" },
"implements" : { "type" : "string" },
"hint" : { "type" : "string" },
"description" : { "type" : "string" },
"properties" : {
"description" : "Literally the component properties set via `property` or `cfproperty`.",
"type" : "object",
"properties": {
"type" : { "type" : "string" },
"name" : { "type" : "string" },
"access" : { "type" : "string" },
"hint" : { "type" : "string" },
"default" : { "type" : "string" },
"required" : { "type" : "boolean" }
}
},
"constructor" : { "$ref": "#/definitions/function" },
"functions" : {
"type" : "array",
"items" : { "$ref": "#/definitions/function" }
}
}
}new docbox.DocBox()
.addStrategy( "CommandBox", {
projectTitle : "My CommandBox Commands",
outputDir : expandPath( "/docs/commands" )
} )
.generate(
source = expandPath( "/modules/my-commands/commands/" ),
mapping = "my-commands"
);new docbox.DocBox()
.addStrategy(
new docbox.strategy.CommandBox.CommandBoxStrategy(
outputDir = expandPath( "/docs/commandbox" ),
projectTitle = "CommandBox CLI Reference"
)
)
.generate(
source = "/commandbox/cfml/system/modules_app/",
mapping = "commandbox.commands"
);outputDir/
├── index.html - Main entry point (frameset)
├── overview-summary.html - Namespace overview
├── overview-frame.html - Navigation sidebar
├── css/ - CSS stylesheets
├── js/ - JavaScript files
├── bootstrap/ - Bootstrap assets
└── {namespace}/
├── package-summary.html - Namespace detail page
└── {command}.html - Individual command documentationserver start
server stop
package show
package setnew docbox.DocBox()
.addStrategy( "CommandBox", {
projectTitle : "CommandBox CLI Reference",
outputDir : expandPath( "/docs/commandbox-core" )
} )
.generate(
source = "/commandbox/cfml/system/modules_app/",
mapping = "commandbox.commands",
excludes = "(tests|build)"
);new docbox.DocBox()
.addStrategy( "CommandBox", {
projectTitle : "My CLI Module",
outputDir : expandPath( "/docs/my-module" )
} )
.generate(
source = expandPath( "/modules/my-module/commands/" ),
mapping = "my-module.commands"
);var docbox = new docbox.DocBox()
.addStrategy( "CommandBox", {
projectTitle : "All Command Modules",
outputDir : expandPath( "/docs/all-commands" )
} );
docbox.generate(
source = [
{ dir: expandPath( "/modules/module1/commands/" ), mapping: "module1" },
{ dir: expandPath( "/modules/module2/commands/" ), mapping: "module2" }
]
);docbox = new DocBox();docbox = new DocBox();
docbox.addStrategy( "HTML", {
projectTitle : "My Docs",
outputDir : expandPath( "/mydocs" ),
theme : "default" // or "frames"
} );docbox = new DocBox();
docbox.addStrategy( "HTML", {
projectTitle : "My API Docs",
outputDir : expandPath( "/mydocs" ),
theme : "frames"
} );docbox.generate(
source = "#expandPath( '/docbox' )",
mapping = "coldbox",
excludes = "tests"
);--output-dir=<path>
-o=<path>
📁 Output directory for generated docs
--source=<path>
Source directory to document
--mapping=<name>
Base mapping for the source folder
--mappings:<name>=<path>
--help
-h
Show help information
--version
-v
Generate documentation for a single source directory:
Document multiple source directories with different mappings:
Generate documentation with the traditional frameset layout:
Specify multiple sources using JSON array notation:
When you run the CLI tool, you'll see output like this:
This displays comprehensive usage information including:
Command syntax
All available options
Multiple examples
Links to documentation
Displays:
DocBox version
Author information
Website URL
Error:
Solution: Ensure you provide either:
--source and --mapping together
One or more --mappings:<name>=<path> options
JSON array via --source
Error:
Solution: Always specify where to generate documentation:
Warning:
Solution: Verify the source path exists and is accessible. Use absolute paths or paths relative to your current working directory.
DocBox 5.0+ includes two modern themes:
Features:
⚡ Alpine.js-based SPA
🌓 Dark mode support
🔍 Real-time search
📑 Method tabs
💜 Modern purple design
Features:
🗂️ Traditional frameset layout
📚 jstree navigation
📱 Left sidebar for packages
🎯 Bootstrap 5 styling
Create a task.cfc to generate documentation:
Run with: box task run
Add to your GitHub Actions, GitLab CI, or other CI/CD pipeline:
Configuration Options - Learn about strategy properties and advanced configuration
HTML Output - Explore HTML theme features
Annotating Your Code - Write effective JavaDoc comments
box install bx-docboxinstall-bx-module bx-docboxboxlang module:docbox [options]boxlang module:docbox --source=/src/models \
--mapping=models \
--output-dir=/docsboxlang module:docbox --source=/src \
--mapping=myapp \
--excludes="(tests|build)" \
--output-dir=/docs \
--project-title="My API"boxlang module:docbox --source=/src \
--mapping=app \
-o=/docsboxlang module:docbox --mappings:v1=/src/v1/models \
--mappings:v2=/src/v2/models \
--output-dir=/docs \
--project-title="API Docs"boxlang module:docbox --source=/src \
--mapping=app \
--output-dir=/docs \
--theme=framesboxlang module:docbox --source="[{'dir':'/src/models', 'mapping':'models'}, {'dir':'/src/services', 'mapping':'services'}]" \
--output-dir=/docs \
--project-title="My API"boxlang module:docbox --source=tests/resources/coldbox \
--mapping=coldbox \
--excludes="(tests|build)" \
--output-dir=tests/apidocs \
--project-title="ColdBox Framework" \
--theme=default═══════════════════════════════════════════════════════════════════
📚 DocBox Documentation Generator
═══════════════════════════════════════════════════════════════════
📂 Source: /Users/myapp/src/models
🔗 Mapping: models
📁 Output: /Users/myapp/docs
⏳ Starting generation, please wait...
🥊 Generation complete!
Documentation available at: /Users/myapp/docsboxlang module:docbox --helpboxlang module:docbox --version❌ ERROR: No valid source mappings found.❌ ERROR: --output-dir is requiredboxlang module:docbox --source=/src --mapping=app --output-dir=/docs⚠️ Warning: '/path/to/source' does not exist.boxlang module:docbox --source=/src --mapping=app \
--output-dir=/docs \
--theme=defaultboxlang module:docbox --source=/src --mapping=app \
--output-dir=/docs \
--theme=framescomponent {
function run() {
command( "boxlang" )
.params(
"module:docbox",
"--source=#getCWD()#/models",
"--mapping=models",
"--output-dir=#getCWD()#/docs",
"--project-title=My Project",
"--theme=default"
)
.run();
}
}- name: Generate API Documentation
run: |
boxlang module:docbox \
--source=./src \
--mapping=myapp \
--output-dir=./build/docs \
--project-title="My Application" \
--theme=defaultDefine multiple source mappings
Show version information
--excludes=<regex>
Regex pattern to exclude files/folders
--project-title=<title>
📖 Project title for documentation
--theme=<name>
🎨 Theme name (default or frames)
--strategy=<class>
Documentation strategy class (default: docbox.strategy.api.HTMLAPIStrategy)
Common issues and solutions when using DocBox
This guide covers common issues you might encounter when using DocBox and their solutions.
Error Message:
The output directory [/path/to/docs] does not existCause: The specified output directory doesn't exist on the filesystem.
Solution: Create the output directory before running DocBox, or ensure that the path is correct. You can create it manually or programmatically:
// Option 1: Create the directory first
directoryCreate( expandPath( "/docs" ), true );
// Option 2: Use an existing directory
new docbox.DocBox()
.addStrategy( "HTML", {
outputDir: expandPath( "/existing/path" )
} )
.generate( source: "/src", mapping: "app" );Error Message:
❌ ERROR: No valid source mappings found.Cause: The BoxLang CLI command wasn't provided with source directory information.
Solution: Ensure you provide either:
--source and --mapping together
One or more --mappings:<name>=<path> options
JSON array via --source
Cause: JavaScript error in HTML templates when filtering methods with missing properties.
Solution: This was fixed in DocBox 5.0. Update to the latest version:
Error Message:
Cause: The mapping specified doesn't match the actual package structure.
Solution: Ensure your mapping matches your component path structure:
Problem: Files are still being documented despite exclusion pattern.
Cause: Exclusion patterns are applied to relative file paths, not absolute paths.
Solution: Use patterns that match the relative path structure:
Problem: Generated docs show components but no methods/properties.
Cause: Components lack JavaDoc comments or metadata.
Solution: Add proper documentation to your components:
Problem: Generic type annotations like Array<User> not appearing in docs.
Cause: Using standard @returntype instead of @doc.type.
Solution: Use the @doc.type annotation:
Problem: Interface implementations not showing in documentation.
Cause: Engine-specific metadata format differences.
Solution: DocBox 5.0+ handles both formats automatically. If using older versions, update:
Problem: Dark mode preference resets on page reload.
Cause: Browser localStorage might be disabled or cleared.
Solution:
Check browser console for localStorage errors
Enable localStorage in browser settings
Clear site data and try again
Problem: Method search doesn't filter results.
Cause: JavaScript not loading or Alpine.js initialization issue.
Solution:
Check browser console for errors
Ensure you're using a modern browser (Chrome, Firefox, Edge, Safari)
Clear browser cache and reload
Check network tab for failed asset loads
Problem: Documentation appears unstyled or broken.
Cause: Asset paths incorrect or theme not specified properly.
Solution:
Error Message:
Cause: bx-docbox module not installed.
Solution:
Problem: DocBox runs out of memory when processing large projects.
Solution:
Increase JVM heap size
Process in smaller chunks:
Use more aggressive exclusion patterns:
Problem: Documentation generation appears to hang.
Cause: Processing too many files or infinite recursion in inheritance.
Solution:
Add verbose logging to see progress
Check for circular dependencies in your code
Exclude unnecessary directories
Run in smaller batches
Problem: Module loads but CLI command errors out.
Cause: Module registration issue or conflicts.
Solution:
Problem: Documentation differs between CFML and BoxLang engines.
Cause: BoxLang uses different metadata structure for some properties.
Solution: DocBox 5.0+ automatically handles both formats. If you're on an older version:
Problem: JSON files generated but contain no data.
Cause: Source directory or mapping incorrect.
Solution: Verify your paths and mappings:
Problem: XMI strategy throws errors.
Cause: Missing or invalid output file path.
Solution:
Add debugging output to your generation script:
Verify your component metadata is readable:
Ensure DocBox can write to the output directory:
If you're still experiencing issues:
Check Documentation:
Search Issues:
Community Forums:
CFML Slack: #box-products channel at
When reporting issues, please include:
DocBox version (box info docbox or boxlang module:docbox --version)
CFML engine and version
Operating system

Professional Support:
Minimal code example to reproduce
Expected vs actual behavior
# Correct usage
boxlang module:docbox --source=/src --mapping=app --output-dir=/docs
# Or with mappings
boxlang module:docbox --mappings:app=/src --output-dir=/docsbox update docboxClass [myapp.MyClass] not found// If your component is at: /src/models/User.cfc
// And its component declaration is: component { }
// And you access it via: new models.User()
new docbox.DocBox()
.addStrategy( "HTML", { outputDir: "/docs" } )
.generate(
source = expandPath( "/src" ), // Source directory
mapping = "models" // Base mapping
);// Correct - matches relative paths
excludes = "(tests|build|\.git)"
// Incorrect - won't match absolute paths
excludes = "/full/path/to/tests"/**
* User management service
*
* @author Your Name
*/
component {
/**
* Gets a user by ID
*
* @id The user ID
* @return User object or null
*/
public function getUser( required numeric id ) {
// implementation
}
}/**
* Gets all active users
*
* @return Array of User objects
* @doc.type Array<User>
*/
public array function getUsers() {
return [];
}box update docbox// Explicitly specify theme
new docbox.DocBox()
.addStrategy( "HTML", {
outputDir: "/docs",
theme: "default" // or "frames"
} )
.generate( source: "/src", mapping: "app" );Command [module:docbox] not found# For CommandBox web runtimes
box install bx-docbox
# For BoxLang OS runtime
install-bx-module bx-docbox
# Verify installation
boxlang module:docbox --versionbox config set server.jvm.heapSize=1024// Document modules separately
new docbox.DocBox()
.addStrategy( "HTML", { outputDir: "/docs/module1" } )
.generate( source: "/src/module1", mapping: "module1" );
new docbox.DocBox()
.addStrategy( "HTML", { outputDir: "/docs/module2" } )
.generate( source: "/src/module2", mapping: "module2" );excludes = "(tests|specs|build|node_modules|\.git|vendor)"# Reinstall the module
box uninstall bx-docbox
box install bx-docbox
# Or force module reload
box reloadbox update docboxnew docbox.DocBox()
.addStrategy( "JSON", {
projectTitle: "My API",
outputDir: expandPath( "/docs/json" )
} )
.generate(
source: expandPath( "/src" ), // Use expandPath()
mapping: "app"
);new docbox.DocBox()
.addStrategy( "XMI", {
outputFile: expandPath( "/docs/diagram.uml" ) // Not outputDir!
} )
.generate( source: "/src", mapping: "app" );try {
var docbox = new docbox.DocBox()
.addStrategy( "HTML", {
outputDir: expandPath( "/docs" )
} );
writeDump( "Starting documentation generation..." );
docbox.generate(
source: expandPath( "/src" ),
mapping: "app"
);
writeDump( "Generation complete!" );
} catch ( any e ) {
writeDump( var=e, label="DocBox Error" );
rethrow;
}component = createObject( "component", "myapp.MyClass" );
metadata = getComponentMetadata( component );
writeDump( metadata );testFile = expandPath( "/docs/test.txt" );
fileWrite( testFile, "test" );
fileDelete( testFile );
writeDump( "Output directory is writable" );Complete API reference for DocBox classes and methods
This page provides detailed API documentation for DocBox's core classes and methods.
The main entry point for DocBox documentation generation.
DocBox function init(
any strategy,
struct properties = {}
)Creates a new DocBox instance with optional initial strategy.
Parameters:
strategy - (Optional) Strategy name ("HTML", "JSON", "XMI", "CommandBox") or instance
properties - (Optional) Strategy configuration properties
Returns: DocBox instance
Examples:
Adds a documentation generation strategy to the collection.
Parameters:
strategy - Strategy alias ("HTML", "JSON", "XMI", "CommandBox") or instance
properties - Strategy configuration properties (if using alias)
Returns: DocBox instance (for chaining)
Examples:
Deprecated: Use addStrategy() instead. Kept for backward compatibility.
Generates documentation for the specified source code.
Parameters:
source - Source directory path(s). Can be:
String: Single directory path
Array: Multiple source definitions
mapping
Returns: DocBox instance
Examples:
Returns the array of registered strategies.
Returns: Array
Base class for all documentation strategies. Provides common functionality for HTML, JSON, XMI, and custom strategies.
Executes the documentation generation strategy. Must be implemented by child classes.
Parameters:
qMetaData - Query object containing component metadata
Returns: Strategy instance
Returns components for a specific package.
Parameters:
qMetaData - Full metadata query
package - Package name
Returns: Filtered query
Returns methods from component metadata.
Parameters:
metadata - Component metadata structure
access - Filter by access level ("public", "private", "remote", "package")
Returns: Query of methods
Returns properties from component metadata.
Parameters:
metadata - Component metadata structure
Returns: Query of properties
Converts flat package list into hierarchical tree structure.
Parameters:
packageNames - Array of package names
Returns: Nested struct representing package hierarchy
Example:
Traverses package tree and calls visitor function for each node.
Parameters:
tree - Package tree structure
visitor - Function to call for each package
prefix - Current package prefix (used in recursion)
Generates HTML documentation with modern themes.
Parameters:
outputDir - Output directory for HTML files
projectTitle - Title for documentation
theme - Theme name ("default" or "frames")
Example:
Generates HTML documentation using the selected theme.
Generates machine-readable JSON documentation.
Parameters:
outputDir - Output directory for JSON files
projectTitle - Project title
Generates UML/XMI diagrams.
Parameters:
outputFile - Output file path for XMI file (not a directory!)
Example:
Specialized strategy for CommandBox CLI commands.
Parameters:
outputDir - Output directory for HTML files
projectTitle - Title for documentation
Example:
Interface that all strategies must implement.
Executes the documentation generation strategy.
Parameters:
metadata - Query object containing component metadata with columns:
package - Package name
name - Component name
Returns: Strategy instance
All strategies receive a query object with the following columns:
Column Descriptions:
package - Package name (e.g., "coldbox.system.web")
name - Component name (e.g., "Controller")
extends - Direct parent component
To create a custom strategy:
Extend AbstractTemplateStrategy
Implement the run() method
Process the metadata query and generate your output format.
Use helper methods
Leverage AbstractTemplateStrategy's helper methods:
getPackageQuery() - Filter by package
getFunctionQuery() - Get methods
getPropertyQuery() - Get properties
Register your strategy
DocBox supports fluent method chaining:
Generate multiple output formats in one pass:
Learn how to annotate your BoxLang or CFML code for DocBox documentation generation
📝 DocBox reads your classes and creates documentation according to your objects, inheritance, implementations, functions, arguments, comments and metadata. We try to follow the style of annotations even though it is not 100% compatible yet.
DocBox comments may be placed above any class declaration, property, function, or argument which we want to document.
These comments are commonly made up of two sections:
The description of what we're commenting on
excludes - Regex pattern to exclude files/folders (applied to relative paths)
throwOnError - Whether to throw exceptions for invalid components
metadata - Complete component metadata structure
type - Component type (component, interface, etc.)
extends - Extended component name
implements - Implemented interfaces
fullextends - Full inheritance chain
currentMapping - Base mapping
metadata - Full component metadata structuretype - Component type ("component" or "interface")
implements - Comma-separated list of interfaces
fullextends - Full inheritance chain
currentMapping - Base mapping used for generation
buildPackageTree() - Create package hierarchy// No initial strategy
docbox = new docbox.DocBox();
// With strategy alias
docbox = new docbox.DocBox( strategy: "HTML", properties: {
outputDir: "/docs",
projectTitle: "My API"
} );
// With strategy instance
docbox = new docbox.DocBox(
strategy: new docbox.strategy.api.HTMLAPIStrategy(
outputDir: "/docs",
projectTitle: "My API"
)
);DocBox function addStrategy(
required any strategy,
struct properties = {}
)// Single strategy
docbox.addStrategy( "HTML", {
outputDir: "/docs",
projectTitle: "My Docs"
} );
// Multiple strategies
docbox
.addStrategy( "HTML", { outputDir: "/docs/html" } )
.addStrategy( "JSON", { outputDir: "/docs/json" } );
// Strategy instance
docbox.addStrategy(
new docbox.strategy.api.HTMLAPIStrategy(
outputDir: "/docs"
)
);DocBox function setStrategy(
required any strategy,
struct properties = {}
)DocBox function generate(
required any source,
required string mapping,
string excludes = "",
boolean throwOnError = false
)// Basic usage
docbox.generate(
source: expandPath( "/src" ),
mapping: "myapp"
);
// With exclusions
docbox.generate(
source: expandPath( "/src" ),
mapping: "myapp",
excludes: "(tests|build|\.git)"
);
// Multiple sources
docbox.generate(
source: [
{ dir: expandPath( "/src/models" ), mapping: "models" },
{ dir: expandPath( "/src/services" ), mapping: "services" }
]
);array function getStrategies()property name="outputDir" type="string";
property name="projectTitle" type="string" default="Untitled";IStrategy function run( required query qMetaData )query function getPackageQuery( required query qMetaData, required string package )query function getFunctionQuery(
required struct metadata,
string access = ""
)query function getPropertyQuery( required struct metadata )struct function buildPackageTree( required array packageNames )// Input: [ "coldbox.system.web", "coldbox.system.cache" ]
// Output: { coldbox: { system: { web: {}, cache: {} } } }void function visitPackageTree(
required struct tree,
required any visitor,
string prefix = ""
)HTMLAPIStrategy function init(
required string outputDir,
string projectTitle = "Untitled",
string theme = "default"
)strategy = new docbox.strategy.api.HTMLAPIStrategy(
outputDir: expandPath( "/docs" ),
projectTitle: "My API",
theme: "default"
);property name="outputDir" type="string";
property name="projectTitle" type="string" default="Untitled";
property name="theme" type="string" default="default";IStrategy function run( required query qMetaData )JSONAPIStrategy function init(
required string outputDir,
string projectTitle = "Untitled"
)property name="outputDir" type="string";
property name="projectTitle" type="string" default="Untitled";XMIStrategy function init( required string outputFile )strategy = new docbox.strategy.uml2tools.XMIStrategy(
outputFile: expandPath( "/docs/diagram.uml" )
);property name="outputFile" type="string";CommandBoxStrategy function init(
required string outputDir,
string projectTitle = "Untitled"
)strategy = new docbox.strategy.CommandBox.CommandBoxStrategy(
outputDir: expandPath( "/docs/commands" ),
projectTitle: "My CLI Commands"
);IStrategy function run( required query metadata )qMetaData = queryNew(
"package,name,extends,metadata,type,implements,fullextends,currentMapping",
"varchar,varchar,varchar,any,varchar,varchar,varchar,varchar"
);component extends="docbox.strategy.AbstractTemplateStrategy" {
property name="outputDir" type="string";
function init( required string outputDir ) {
variables.outputDir = arguments.outputDir;
return this;
}
function run( required query qMetaData ) {
// Your implementation here
return this;
}
}new docbox.DocBox()
.addStrategy( new path.to.MyCustomStrategy(
outputDir: "/docs"
) )
.generate( source: "/src", mapping: "app" );new docbox.DocBox()
.addStrategy( "HTML", { outputDir: "/docs/html" } )
.addStrategy( "JSON", { outputDir: "/docs/json" } )
.generate( source: "/src", mapping: "app" );var docbox = new docbox.DocBox();
docbox.addStrategy( "HTML", {
outputDir: "/docs/html",
projectTitle: "My API",
theme: "default"
} );
docbox.addStrategy( "JSON", {
outputDir: "/docs/json",
projectTitle: "My API"
} );
docbox.addStrategy( "XMI", {
outputFile: "/docs/diagram.uml"
} );
docbox.generate(
source: expandPath( "/src" ),
mapping: "myapp",
excludes: "(tests|build)"
);try {
new docbox.DocBox()
.addStrategy( "HTML", { outputDir: "/docs" } )
.generate(
source: "/src",
mapping: "app",
throwOnError: true // Throw on invalid components
);
} catch ( any e ) {
// Handle errors
writeLog( e.message );
rethrow;
}@ symbol) which describe specific meta-dataAlso all core engine attributes to components, properties, functions and arguments will be documented automatically for you.
For the full JavaDoc spec click here: https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html
Please note that BoxLang allows you to use both documentation annotation and code annotation styles.
/**
* Hero is the main entity we'll be using to create awesome stuff
*
*
/**
* Hero is the main entity we'll be using to create awesome stuff
*
*
This is a simple component declaration where we define the hint for the component and add block tags like @author . All attributes to the component will be documented for you as name-value pairs on the final output.
/**
* Hero is the main entity we'll be using to create awesome stuff
*
* @author Captain America
*
*/
@name( "SuperHero" )
@transient
class{
/**
* A collection of aliases this superhero is known as
*/
property name="alias" type="array";
/**
* Internal alias name
*
* @deprecated true
*/
@propertyCodeAnnotation
@serialize( false )
property name="_alias" type="array";
}/**
* Hero is the main entity we'll be using to create awesome stuff
*
* @author Captain America
*
*/
component name="SuperHero" accessors="true" transient{
/**
* A collection of aliases this superhero is known as
*/
property name="alias" type="array";
/**
* Internal alias name
* @deprecated true
*/
property name="_alias" type="array";
}Properties also have comments and you can add @ blocks as well.
Functions can have a variety of block tags alongside the main description of the function. Also notice that each argument can also be documented via the @argName block tag.
Arguments can also have multiple annotations for documentation or semantic usage purposes.
This is done by using a . period delimiter and then adding another block name or semantic name to use.
Here are some of the core blocks that can be used in DocBox:
@author
Provides information about the author, typically the author’s name, e-mail address, website information, and so on.
@version
Indicates the version number.
@since
Here are some blocks that ONLY DocBox can read:
@doc.type
This is an annotation that can be placed on either a function or argument declaration. This annotation is used to specify what generic type is being used, which is particularly useful when a return or argument type is an array or a struct or any. The value can be a single type or a list.
DocBox supports standard JavaDoc tags and recognizes custom annotations for enhanced documentation.
The @doc.type annotation allows you to specify generic types for complex return types and arguments. This is especially useful for documenting collections and typed data structures.
Syntax:
Examples:
Document arrays with specific element types:
Document structs with key/value types:
Document typed parameters:
Document complex struct parameters:
BoxLang also supports inline doc.type attributes:
For nested or complex types:
Be Specific: Use concrete types instead of generic "Any" when possible
Consistency: Use the same naming convention throughout your codebase
Documentation: Combine with @return or parameter hints for full context
Complex Types: Break down complex nested types into multiple lines for clarity
/**
* This is a Javadoc compliant comment for DocBox
*//**
* get Java FileInputStream for resource bundle
*
* @rbFilePath path + filename for resource, including locale + .properties
*
* @return java.io.FileInputStream
*
* @throws ResourceBundle.InvalidBundlePath
*/
public function getResourceFileInputStream( required string rbFilePath ){
}/**
* get Java FileInputStream for resource bundle
*
* @rbFilePath path + filename for resource, including locale + .properties
* @rbFilePath.deprecated true
*
* @return java.io.FileInputStream
* @throws ResourceBundle.InvalidBundlePath
*/
public function getResourceFileInputStream( required string rbFilePath ){
}/**
* Get foo array
*
* @doc.type com.Foo
*/
private array function getFooArray(){
return variables.foo;
}
// Inline
private array function getFooArray() doc.type="com.Foo"{
return variables.foo;
}
/**
* Set my struct
*
* @myStruct.doc.type uuid,string
*/
private void function setMyStruct( required struct myStruct ){
instance.myStruct = arguments.myStruct;
}
// Inline
private void function setMyStruct(
required struct myStruct doc.type="uuid,string"
){
instance.myStruct = arguments.myStruct;
}@doc.type TypeName
@doc.type KeyType,ValueType/**
* Gets all active users from the database
*
* @return Array of User objects
* @doc.type Array<User>
*/
public array function getActiveUsers() {
return queryExecute( "SELECT * FROM users WHERE active = 1" )
.map( function( row ) {
return new User( row );
} );
}/**
* Gets user preferences as a configuration map
*
* @return Struct mapping setting names to values
* @doc.type Struct<String,Any>
*/
public struct function getUserPreferences() {
return {
"theme": "dark",
"fontSize": 14,
"autoSave": true
};
}/**
* Processes a batch of user records
*
* @users Array of User objects to process
* @users.doc.type Array<User>
*/
public void function processBatch( required array users ) {
for ( var user in arguments.users ) {
user.process();
}
}/**
* Updates user settings with validation
*
* @settings Map of setting names to their values
* @settings.doc.type Struct<String,Any>
*/
public void function updateSettings( required struct settings ) {
validateSettings( arguments.settings );
saveSettings( arguments.settings );
}// Return type with inline generic
public array function getUsers() doc.type="Array<User>" {
return entityLoad( "User" );
}
// Parameter with inline generic
public void function setCache(
required struct cache doc.type="String,Any"
) {
variables.cache = arguments.cache;
}/**
* Gets a map of user IDs to their roles
*
* @return Map of numeric user IDs to arrays of role names
* @doc.type Struct<Numeric,Array<String>>
*/
public struct function getUserRoles() {
return {
1: [ "admin", "editor" ],
2: [ "viewer" ],
3: [ "editor", "contributor" ]
};
}/**
* Gets a complex data structure for reporting
*
* @return Nested structure containing report data
* - Outer struct: Department name -> Department data
* - Department data: Struct with "users" (Array<User>) and "metrics" (Struct<String,Numeric>)
* @doc.type Struct<String,Struct>
*/Used to indicate the version with which this class, field, or method was added.
@return
Provides a description of a method’s return value.
@throws
Indicates exceptions that are thrown by a method or constructor. You can add multiple @throws in a function declaration.
@deprecated
Indicates that the class, field, or method is deprecated and shouldn’t be used.
@{anything}
Anything you like. That's right, DocBox will document any block pairs for you in a simple output manner.
@see
Not implemented yet