DictConst 1.0.0¶
Overview¶
Description¶
Creates a constant dictionary object that can be used throughout your workflow. This block allows you to define static key-value pairs as configuration and outputs them as a dictionary for use by other blocks.
Configuration Options¶
| Name | Data Type | Description | Default Value |
|---|---|---|---|
| output | dict | The dictionary to output as a constant value. Can contain any valid key-value pairs including nested objects, lists, strings, numbers, and booleans. | N/A |
Inputs¶
No inputs available.
Outputs¶
| Name | Data Type | Description |
|---|---|---|
| output | dict | The configured dictionary object exactly as specified in the configuration. Contains all key-value pairs defined in the output parameter. |
Examples¶
# Simple configuration object
- id: app_config
uses: DictConst@1.0.0
with:
output:
api_url: "https://api.example.com"
timeout: 30
retry_attempts: 3
debug_mode: false
outputs:
output: config_object
# User profile data
- id: user_profile
uses: DictConst@1.0.0
with:
output:
user_id: 12345
name: "John Doe"
email: "john.doe@example.com"
preferences:
theme: "dark"
language: "en-US"
notifications: true
outputs:
output: profile_data
Error Handling¶
ConfigurationValidationError
- Error Code
invalid_dictionary_config- Common Cause
- Invalid YAML syntax or structure in the output dictionary configuration
- Solution
- Verify YAML syntax, ensure proper indentation, check for missing colons or quote marks in dictionary keys and values
SerializationError
- Error Code
dictionary_serialization_failed- Common Cause
- Dictionary contains non-serializable objects or circular references
- Solution
- Use only basic data types (strings, numbers, booleans, lists, dicts), avoid complex objects or functions in the configuration
MemoryLimitError
- Error Code
dictionary_size_limit_exceeded- Common Cause
- Dictionary configuration is too large and exceeds memory limits
- Solution
- Reduce dictionary size, split large configurations into multiple DictConst blocks, or store large data externally
FAQ¶
What data types can I include in the dictionary?
DictConst supports all JSON-serializable data types: strings, numbers (integers and floats), booleans, null values, nested dictionaries (objects), and lists (arrays). Avoid Python-specific objects like functions or classes.
How deep can I nest objects and arrays?
There's no explicit limit on nesting depth, but very deep structures may impact performance and readability. For practical purposes, 3-5 levels of nesting are generally sufficient and maintainable.
Can I reference other blocks' outputs in the dictionary?
No, DictConst creates static configuration data only. The dictionary is defined at workflow design time, not runtime. Use CreateObject or BuildObject blocks if you need to construct dictionaries from dynamic data.
How do I handle special characters or multiline strings?
Use YAML string formatting: quote strings with special characters ("key": "value with spaces"), use | for multiline strings preserving line breaks, or use > for multiline strings with folded line breaks.
What's the difference between DictConst and other object creation blocks?
DictConst creates static dictionaries from configuration, CreateObject builds dictionaries from inputs dynamically, and BuildObject merges multiple dictionaries. Use DictConst for fixed configuration data that doesn't change during workflow execution.