JSON Configuration
Shows how to use a JSON configuration file for declarative setup. JSON configs support auto-detected plugins, scan patterns, path mappings, and metadata validation via JSON Schema.
meta-yml9 FILESconfigurationjsonschema-validation
JSON Configuration Example
This example demonstrates using a JSON configuration file (functional-examples.config.json) instead of TypeScript for declarative setup.
Usage
bash
1# From the example directory
2npx functional-examples scanConfiguration File
The JSON config supports plugins, scan patterns, path mappings, and metadata schemas:
{
"$schema": "./.functional-examples/schema.json",
"scan": {
"include": ["snippets/**/*"],
"exclude": ["**/*.test.*", "**/*.spec.*"]
},
"pathMappings": [
{
"pattern": "**/legacy/**",
"extractor": "meta-yml"
}
],
"metadata": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the example"
},
"title": {
"type": "string",
"description": "Human-readable title"
},
"description": {
"type": "string",
"description": "What this example demonstrates"
},
"category": {
"type": "string",
"enum": ["tutorial", "recipe", "reference", "advanced"],
"description": "Example category for filtering"
},
"tags": {
"type": "array",
"items": { "type": "string" },
"description": "Tags for search and filtering"
}
},
"required": ["id", "title", "category"]
}
}
Features
JSON configuration supports:
- Auto-detected plugins — Plugins are resolved automatically
- Scan patterns — Include/exclude patterns for file discovery
- Path mappings — Conflict resolution for multiple plugins
- JSON Schema validation — Metadata schema enforcement with IDE support
When to Use JSON Config
Choose JSON over TypeScript configuration when:
- No custom logic needed — Simple declarative setup
- Non-JS tooling — Other tools can easily read JSON
- Schema validation — IDE support via JSON Schema
All Example Files
FILE EXPLORER
README.md
1# JSON Configuration Example
2
3This example demonstrates using a JSON configuration file (`functional-examples.config.json`) instead of TypeScript for declarative setup.
4
5## Usage
6
7```bash
8# From the example directory
9npx functional-examples scan
10```
11
12## Configuration File
13
14The JSON config supports plugins, scan patterns, path mappings, and metadata schemas:
15
16<%= file('functional-examples.config.json') %>
17
18## Features
19
20JSON configuration supports:
21- **Auto-detected plugins** — Plugins are resolved automatically
22- **Scan patterns** — Include/exclude patterns for file discovery
23- **Path mappings** — Conflict resolution for multiple plugins
24- **JSON Schema validation** — Metadata schema enforcement with IDE support
25
26## When to Use JSON Config
27
28Choose JSON over TypeScript configuration when:
29- **No custom logic needed** — Simple declarative setup
30- **Non-JS tooling** — Other tools can easily read JSON
31- **Schema validation** — IDE support via JSON Schema
32