|
1 | 1 | { |
| 2 | + "$schema": "http://json-schema.org/draft-07/schema#", |
2 | 3 | "$ref": "#/definitions/FlowSetup", |
3 | 4 | "definitions": { |
4 | | - "FlowConfig": { |
| 5 | + "Primitive": { |
| 6 | + "type": ["string", "number", "boolean"], |
| 7 | + "description": "Primitive value: string, number, or boolean" |
| 8 | + }, |
| 9 | + "Variables": { |
| 10 | + "type": "object", |
| 11 | + "additionalProperties": { |
| 12 | + "$ref": "#/definitions/Primitive" |
| 13 | + }, |
| 14 | + "description": "Variables for interpolation" |
| 15 | + }, |
| 16 | + "Definitions": { |
| 17 | + "type": "object", |
| 18 | + "additionalProperties": {}, |
| 19 | + "description": "Reusable configuration definitions" |
| 20 | + }, |
| 21 | + "PackageConfig": { |
5 | 22 | "type": "object", |
6 | 23 | "properties": { |
7 | | - "platform": { |
| 24 | + "version": { |
8 | 25 | "type": "string", |
9 | | - "enum": ["web", "server"], |
10 | | - "description": "Target platform: \"web\" for browser-based tracking, \"server\" for Node.js server-side collection" |
| 26 | + "description": "Package version to use" |
11 | 27 | }, |
12 | | - "sources": { |
13 | | - "type": "object", |
14 | | - "additionalProperties": { |
15 | | - "$ref": "#/definitions/SourceReference" |
16 | | - }, |
17 | | - "description": "Source configurations (data capture) keyed by unique identifier" |
18 | | - }, |
19 | | - "destinations": { |
20 | | - "type": "object", |
21 | | - "additionalProperties": { |
22 | | - "$ref": "#/definitions/DestinationReference" |
23 | | - }, |
24 | | - "description": "Destination configurations (data output) keyed by unique identifier" |
| 28 | + "imports": { |
| 29 | + "type": "array", |
| 30 | + "items": { "type": "string" }, |
| 31 | + "description": "Named exports to import from the package" |
25 | 32 | }, |
26 | | - "collector": { |
27 | | - "description": "Collector configuration for event processing (uses Collector.InitConfig)" |
| 33 | + "path": { |
| 34 | + "type": "string", |
| 35 | + "description": "Local path (takes precedence over version)" |
| 36 | + } |
| 37 | + }, |
| 38 | + "additionalProperties": false |
| 39 | + }, |
| 40 | + "Packages": { |
| 41 | + "type": "object", |
| 42 | + "additionalProperties": { |
| 43 | + "$ref": "#/definitions/PackageConfig" |
| 44 | + }, |
| 45 | + "description": "NPM packages to bundle" |
| 46 | + }, |
| 47 | + "WebConfig": { |
| 48 | + "type": "object", |
| 49 | + "properties": { |
| 50 | + "windowCollector": { |
| 51 | + "type": "string", |
| 52 | + "description": "Window property name for collector instance (default: \"collector\")" |
28 | 53 | }, |
29 | | - "env": { |
30 | | - "type": "object", |
31 | | - "additionalProperties": { |
32 | | - "type": "string" |
33 | | - }, |
34 | | - "description": "Environment-specific variables (override root-level variables)" |
| 54 | + "windowElb": { |
| 55 | + "type": "string", |
| 56 | + "description": "Window property name for elb function (default: \"elb\")" |
35 | 57 | } |
36 | 58 | }, |
37 | | - "required": ["platform"], |
| 59 | + "additionalProperties": false, |
| 60 | + "description": "Web platform configuration" |
| 61 | + }, |
| 62 | + "ServerConfig": { |
| 63 | + "type": "object", |
38 | 64 | "additionalProperties": true, |
39 | | - "description": "Single flow configuration for one deployment target" |
| 65 | + "description": "Server platform configuration (reserved for future options)" |
40 | 66 | }, |
41 | 67 | "SourceReference": { |
42 | 68 | "type": "object", |
|
46 | 72 | "minLength": 1, |
47 | 73 | "description": "Package specifier with optional version (e.g., \"@walkeros/[email protected]\")" |
48 | 74 | }, |
| 75 | + "code": { |
| 76 | + "type": "string", |
| 77 | + "description": "Named export to use from the package (e.g., \"sourceExpress\"). If omitted, uses default export." |
| 78 | + }, |
49 | 79 | "config": { |
50 | 80 | "description": "Source-specific configuration object" |
51 | 81 | }, |
|
55 | 85 | "primary": { |
56 | 86 | "type": "boolean", |
57 | 87 | "description": "Mark as primary source (provides main elb). Only one source should be primary." |
| 88 | + }, |
| 89 | + "variables": { |
| 90 | + "$ref": "#/definitions/Variables", |
| 91 | + "description": "Source-level variables (highest priority in cascade)" |
| 92 | + }, |
| 93 | + "definitions": { |
| 94 | + "$ref": "#/definitions/Definitions", |
| 95 | + "description": "Source-level definitions (highest priority in cascade)" |
58 | 96 | } |
59 | 97 | }, |
60 | 98 | "required": ["package"], |
|
69 | 107 | "minLength": 1, |
70 | 108 | "description": "Package specifier with optional version (e.g., \"@walkeros/[email protected]\")" |
71 | 109 | }, |
| 110 | + "code": { |
| 111 | + "type": "string", |
| 112 | + "description": "Named export to use from the package (e.g., \"destinationAnalytics\"). If omitted, uses default export." |
| 113 | + }, |
72 | 114 | "config": { |
73 | 115 | "description": "Destination-specific configuration object" |
74 | 116 | }, |
75 | 117 | "env": { |
76 | 118 | "description": "Destination environment configuration" |
| 119 | + }, |
| 120 | + "variables": { |
| 121 | + "$ref": "#/definitions/Variables", |
| 122 | + "description": "Destination-level variables (highest priority in cascade)" |
| 123 | + }, |
| 124 | + "definitions": { |
| 125 | + "$ref": "#/definitions/Definitions", |
| 126 | + "description": "Destination-level definitions (highest priority in cascade)" |
77 | 127 | } |
78 | 128 | }, |
79 | 129 | "required": ["package"], |
80 | 130 | "additionalProperties": false, |
81 | 131 | "description": "Destination package reference with configuration" |
82 | 132 | }, |
83 | | - "Primitive": { |
84 | | - "type": ["string", "number", "boolean"], |
85 | | - "description": "Primitive value: string, number, or boolean" |
| 133 | + "FlowConfig": { |
| 134 | + "type": "object", |
| 135 | + "properties": { |
| 136 | + "web": { |
| 137 | + "$ref": "#/definitions/WebConfig", |
| 138 | + "description": "Web platform configuration (browser-based tracking). Mutually exclusive with server." |
| 139 | + }, |
| 140 | + "server": { |
| 141 | + "$ref": "#/definitions/ServerConfig", |
| 142 | + "description": "Server platform configuration (Node.js). Mutually exclusive with web." |
| 143 | + }, |
| 144 | + "sources": { |
| 145 | + "type": "object", |
| 146 | + "additionalProperties": { |
| 147 | + "$ref": "#/definitions/SourceReference" |
| 148 | + }, |
| 149 | + "description": "Source configurations (data capture) keyed by unique identifier" |
| 150 | + }, |
| 151 | + "destinations": { |
| 152 | + "type": "object", |
| 153 | + "additionalProperties": { |
| 154 | + "$ref": "#/definitions/DestinationReference" |
| 155 | + }, |
| 156 | + "description": "Destination configurations (data output) keyed by unique identifier" |
| 157 | + }, |
| 158 | + "collector": { |
| 159 | + "description": "Collector configuration for event processing (uses Collector.InitConfig)" |
| 160 | + }, |
| 161 | + "packages": { |
| 162 | + "$ref": "#/definitions/Packages", |
| 163 | + "description": "NPM packages to bundle" |
| 164 | + }, |
| 165 | + "variables": { |
| 166 | + "$ref": "#/definitions/Variables", |
| 167 | + "description": "Flow-level variables (override Setup.variables, overridden by source/destination variables)" |
| 168 | + }, |
| 169 | + "definitions": { |
| 170 | + "$ref": "#/definitions/Definitions", |
| 171 | + "description": "Flow-level definitions (extend Setup.definitions, overridden by source/destination definitions)" |
| 172 | + } |
| 173 | + }, |
| 174 | + "oneOf": [ |
| 175 | + { "required": ["web"], "not": { "required": ["server"] } }, |
| 176 | + { "required": ["server"], "not": { "required": ["web"] } } |
| 177 | + ], |
| 178 | + "additionalProperties": false, |
| 179 | + "description": "Single flow configuration for one deployment target. Exactly one of 'web' or 'server' must be present." |
86 | 180 | }, |
87 | 181 | "FlowSetup": { |
88 | 182 | "type": "object", |
89 | 183 | "properties": { |
90 | 184 | "version": { |
91 | | - "type": "number", |
| 185 | + "type": "integer", |
92 | 186 | "const": 1, |
93 | 187 | "description": "Configuration schema version (currently only 1 is supported)" |
94 | 188 | }, |
|
98 | 192 | "description": "JSON Schema reference for IDE validation (e.g., \"https://walkeros.io/schema/flow/v1.json\")" |
99 | 193 | }, |
100 | 194 | "variables": { |
101 | | - "type": "object", |
102 | | - "additionalProperties": { |
103 | | - "$ref": "#/definitions/Primitive" |
104 | | - }, |
105 | | - "description": "Shared variables for interpolation across all flows (use ${VAR_NAME:default} syntax)" |
| 195 | + "$ref": "#/definitions/Variables", |
| 196 | + "description": "Shared variables for interpolation across all flows (use ${VAR_NAME} or ${VAR_NAME:default} syntax)" |
106 | 197 | }, |
107 | 198 | "definitions": { |
108 | | - "type": "object", |
109 | | - "additionalProperties": {}, |
110 | | - "description": "Reusable configuration definitions (reference with JSON Schema $ref syntax)" |
| 199 | + "$ref": "#/definitions/Definitions", |
| 200 | + "description": "Reusable configuration definitions (reference with JSON Schema $ref syntax: { \"$ref\": \"#/definitions/name\" })" |
111 | 201 | }, |
112 | 202 | "flows": { |
113 | 203 | "type": "object", |
114 | 204 | "additionalProperties": { |
115 | 205 | "$ref": "#/definitions/FlowConfig" |
116 | 206 | }, |
117 | | - "description": "Named flow configurations (e.g., web_prod, server_stage)" |
| 207 | + "minProperties": 1, |
| 208 | + "description": "Named flow configurations (e.g., production, staging, development)" |
118 | 209 | } |
119 | 210 | }, |
120 | 211 | "required": ["version", "flows"], |
121 | 212 | "additionalProperties": false, |
122 | 213 | "description": "Complete multi-flow walkerOS configuration (walkeros.config.json)" |
123 | 214 | } |
124 | | - }, |
125 | | - "$schema": "http://json-schema.org/draft-07/schema#" |
| 215 | + } |
126 | 216 | } |
0 commit comments