| 1 |
{ |
| 2 |
"$schema": "http://json-schema.org/draft-07/schema#", |
| 3 |
"title": "Symfony Serializer Mapping Schema", |
| 4 |
"description": "JSON schema for Symfony's serialization mapping", |
| 5 |
"type": "object", |
| 6 |
"additionalProperties": false, |
| 7 |
"patternProperties": { |
| 8 |
"^[A-Za-z0-9\\\\_]+$": { |
| 9 |
"type": "object", |
| 10 |
"description": "Class metadata configuration", |
| 11 |
"additionalProperties": false, |
| 12 |
"properties": { |
| 13 |
"attributes": { |
| 14 |
"type": "object", |
| 15 |
"description": "Attribute metadata configurations", |
| 16 |
"additionalProperties": { |
| 17 |
"oneOf": [ |
| 18 |
{ |
| 19 |
"type": "object", |
| 20 |
"description": "Attribute metadata configuration", |
| 21 |
"additionalProperties": false, |
| 22 |
"properties": { |
| 23 |
"groups": { |
| 24 |
"type": "array", |
| 25 |
"items": { |
| 26 |
"type": "string" |
| 27 |
}, |
| 28 |
"description": "Serialization groups for this attribute" |
| 29 |
}, |
| 30 |
"max_depth": { |
| 31 |
"type": "integer", |
| 32 |
"minimum": 0, |
| 33 |
"description": "Maximum serialization depth for this attribute" |
| 34 |
}, |
| 35 |
"serialized_name": { |
| 36 |
"type": "string", |
| 37 |
"minLength": 1, |
| 38 |
"description": "Custom name for serialization" |
| 39 |
}, |
| 40 |
"serialized_path": { |
| 41 |
"type": "string", |
| 42 |
"description": "Property path for serialization (e.g., '[one][two]')" |
| 43 |
}, |
| 44 |
"ignore": { |
| 45 |
"type": "boolean", |
| 46 |
"description": "Whether to ignore this attribute during serialization" |
| 47 |
}, |
| 48 |
"contexts": { |
| 49 |
"type": "array", |
| 50 |
"items": { |
| 51 |
"type": "object", |
| 52 |
"description": "Context entry with optional groups", |
| 53 |
"additionalProperties": false, |
| 54 |
"properties": { |
| 55 |
"context": { |
| 56 |
"$ref": "#/definitions/contextObject" |
| 57 |
}, |
| 58 |
"normalization_context": { |
| 59 |
"$ref": "#/definitions/contextObject" |
| 60 |
}, |
| 61 |
"denormalization_context": { |
| 62 |
"$ref": "#/definitions/contextObject" |
| 63 |
}, |
| 64 |
"groups": { |
| 65 |
"type": "array", |
| 66 |
"items": { |
| 67 |
"type": "string" |
| 68 |
}, |
| 69 |
"description": "Groups this context applies to" |
| 70 |
} |
| 71 |
}, |
| 72 |
"anyOf": [ |
| 73 |
{ |
| 74 |
"required": ["context"] |
| 75 |
}, |
| 76 |
{ |
| 77 |
"required": ["normalization_context"] |
| 78 |
}, |
| 79 |
{ |
| 80 |
"required": ["denormalization_context"] |
| 81 |
} |
| 82 |
] |
| 83 |
}, |
| 84 |
"description": "Context configurations for this attribute" |
| 85 |
} |
| 86 |
} |
| 87 |
}, |
| 88 |
{ |
| 89 |
"type": "null", |
| 90 |
"description": "Empty attribute metadata" |
| 91 |
} |
| 92 |
] |
| 93 |
} |
| 94 |
}, |
| 95 |
"discriminator_map": { |
| 96 |
"type": "object", |
| 97 |
"description": "Class discriminator mapping configuration", |
| 98 |
"additionalProperties": false, |
| 99 |
"required": ["type_property", "mapping"], |
| 100 |
"properties": { |
| 101 |
"type_property": { |
| 102 |
"type": "string", |
| 103 |
"description": "Property name used to determine the class type" |
| 104 |
}, |
| 105 |
"mapping": { |
| 106 |
"type": "object", |
| 107 |
"description": "Mapping from type values to class names", |
| 108 |
"additionalProperties": { |
| 109 |
"type": "string" |
| 110 |
} |
| 111 |
}, |
| 112 |
"default_type": { |
| 113 |
"type": "string", |
| 114 |
"description": "Default type when no mapping is found" |
| 115 |
} |
| 116 |
} |
| 117 |
} |
| 118 |
} |
| 119 |
} |
| 120 |
}, |
| 121 |
"definitions": { |
| 122 |
"contextObject": { |
| 123 |
"type": "object", |
| 124 |
"description": "Context object with key-value pairs", |
| 125 |
"properties": { |
| 126 |
"circular_reference_limit": { |
| 127 |
"type": "integer", |
| 128 |
"minimum": 1, |
| 129 |
"description": "How many loops of circular reference to allow while normalizing" |
| 130 |
}, |
| 131 |
"object_to_populate": { |
| 132 |
"type": "object", |
| 133 |
"description": "Object to be updated instead of creating a new instance" |
| 134 |
}, |
| 135 |
"groups": { |
| 136 |
"oneOf": [ |
| 137 |
{ |
| 138 |
"type": "array", |
| 139 |
"items": { |
| 140 |
"type": "string" |
| 141 |
} |
| 142 |
}, |
| 143 |
{ |
| 144 |
"type": "string" |
| 145 |
} |
| 146 |
], |
| 147 |
"description": "Groups containing attributes to (de)normalize" |
| 148 |
}, |
| 149 |
"attributes": { |
| 150 |
"type": "object", |
| 151 |
"description": "Attributes to (de)normalize" |
| 152 |
}, |
| 153 |
"allow_extra_attributes": { |
| 154 |
"type": "boolean", |
| 155 |
"description": "Whether to ignore extra attributes or throw an exception" |
| 156 |
}, |
| 157 |
"default_constructor_arguments": { |
| 158 |
"type": "object", |
| 159 |
"description": "Hashmap of classes containing hashmaps of constructor argument => default value" |
| 160 |
}, |
| 161 |
"callbacks": { |
| 162 |
"type": "object", |
| 163 |
"description": "Hashmap of field name => callable to normalize this field" |
| 164 |
}, |
| 165 |
"circular_reference_handler": { |
| 166 |
"type": "object", |
| 167 |
"description": "Handler to call when a circular reference has been detected" |
| 168 |
}, |
| 169 |
"ignored_attributes": { |
| 170 |
"type": "array", |
| 171 |
"items": { |
| 172 |
"type": "string" |
| 173 |
}, |
| 174 |
"description": "Attributes to be skipped when normalizing an object tree" |
| 175 |
}, |
| 176 |
"require_all_properties": { |
| 177 |
"type": "boolean", |
| 178 |
"description": "Whether to require all properties to be listed in the input" |
| 179 |
}, |
| 180 |
"enable_max_depth": { |
| 181 |
"type": "boolean", |
| 182 |
"description": "Whether to respect the max depth metadata on fields" |
| 183 |
}, |
| 184 |
"depth_key_pattern": { |
| 185 |
"type": "string", |
| 186 |
"description": "Pattern to keep track of the current depth (must contain exactly two string placeholders)" |
| 187 |
}, |
| 188 |
"disable_type_enforcement": { |
| 189 |
"type": "boolean", |
| 190 |
"description": "Whether verifying types match during denormalization" |
| 191 |
}, |
| 192 |
"skip_null_values": { |
| 193 |
"type": "boolean", |
| 194 |
"description": "Whether fields with the value null should be output during normalization" |
| 195 |
}, |
| 196 |
"skip_uninitialized_values": { |
| 197 |
"type": "boolean", |
| 198 |
"description": "Whether uninitialized typed class properties should be excluded during normalization" |
| 199 |
}, |
| 200 |
"max_depth_handler": { |
| 201 |
"type": "object", |
| 202 |
"description": "Callback to allow to set a value for an attribute when the max depth has been reached" |
| 203 |
}, |
| 204 |
"exclude_from_cache_keys": { |
| 205 |
"type": "array", |
| 206 |
"items": { |
| 207 |
"type": "string" |
| 208 |
}, |
| 209 |
"description": "Context keys not relevant to determine which attributes to (de)normalize" |
| 210 |
}, |
| 211 |
"deep_object_to_populate": { |
| 212 |
"type": "boolean", |
| 213 |
"description": "Whether to tell the denormalizer to also populate existing objects on attributes" |
| 214 |
}, |
| 215 |
"preserve_empty_objects": { |
| 216 |
"type": "boolean", |
| 217 |
"description": "Whether an empty object should be kept as an object or converted to a list" |
| 218 |
}, |
| 219 |
"normalize_visibility": { |
| 220 |
"type": "integer", |
| 221 |
"description": "Whether fields should be output based on visibility (PropertyNormalizer)" |
| 222 |
}, |
| 223 |
"format": { |
| 224 |
"type": "string", |
| 225 |
"description": "Format of the date (DateTimeNormalizer)" |
| 226 |
}, |
| 227 |
"timezone": { |
| 228 |
"oneOf": [ |
| 229 |
{ |
| 230 |
"type": "string" |
| 231 |
}, |
| 232 |
{ |
| 233 |
"type": "object" |
| 234 |
} |
| 235 |
], |
| 236 |
"description": "Timezone of the date (DateTimeNormalizer)" |
| 237 |
}, |
| 238 |
"forceTimezone": { |
| 239 |
"type": "boolean", |
| 240 |
"description": "Whether to enforce the timezone during denormalization (DateTimeNormalizer)" |
| 241 |
}, |
| 242 |
"cast": { |
| 243 |
"enum": ["int", "float"], |
| 244 |
"description": "Cast type for DateTime (DateTimeNormalizer)" |
| 245 |
}, |
| 246 |
"encode_options": { |
| 247 |
"type": "integer", |
| 248 |
"minimum": 1, |
| 249 |
"description": "json_encode flags bitmask (JsonEncoder)" |
| 250 |
}, |
| 251 |
"decode_options": { |
| 252 |
"type": "integer", |
| 253 |
"minimum": 1, |
| 254 |
"description": "json_decode flags bitmask (JsonEncoder)" |
| 255 |
}, |
| 256 |
"associative": { |
| 257 |
"type": "boolean", |
| 258 |
"description": "Whether decoded objects will be given as associative arrays (JsonEncoder)" |
| 259 |
}, |
| 260 |
"recursion_depth": { |
| 261 |
"type": "integer", |
| 262 |
"minimum": 1, |
| 263 |
"description": "Maximum recursion depth (JsonEncoder)" |
| 264 |
}, |
| 265 |
"as_collection": { |
| 266 |
"type": "boolean", |
| 267 |
"description": "Whether the decoded result should be considered as a collection (XmlEncoder/CsvEncoder)" |
| 268 |
}, |
| 269 |
"decoder_ignored_node_types": { |
| 270 |
"type": "array", |
| 271 |
"items": { |
| 272 |
"type": "integer" |
| 273 |
}, |
| 274 |
"description": "Node types to ignore while decoding (XmlEncoder)" |
| 275 |
}, |
| 276 |
"encoder_ignored_node_types": { |
| 277 |
"type": "array", |
| 278 |
"items": { |
| 279 |
"type": "integer" |
| 280 |
}, |
| 281 |
"description": "Node types to ignore while encoding (XmlEncoder)" |
| 282 |
}, |
| 283 |
"encoding": { |
| 284 |
"type": "string", |
| 285 |
"description": "DOMDocument encoding (XmlEncoder)" |
| 286 |
}, |
| 287 |
"format_output": { |
| 288 |
"type": "boolean", |
| 289 |
"description": "Whether to encode with indentation and extra space (XmlEncoder)" |
| 290 |
}, |
| 291 |
"load_options": { |
| 292 |
"type": "integer", |
| 293 |
"minimum": 1, |
| 294 |
"description": "DOMDocument::loadXml options bitmask (XmlEncoder)" |
| 295 |
}, |
| 296 |
"save_options": { |
| 297 |
"type": "integer", |
| 298 |
"minimum": 1, |
| 299 |
"description": "DOMDocument::saveXml options bitmask (XmlEncoder)" |
| 300 |
}, |
| 301 |
"remove_empty_tags": { |
| 302 |
"type": "boolean", |
| 303 |
"description": "Whether to keep empty nodes (XmlEncoder)" |
| 304 |
}, |
| 305 |
"root_node_name": { |
| 306 |
"type": "string", |
| 307 |
"description": "Name of the root node (XmlEncoder)" |
| 308 |
}, |
| 309 |
"standalone": { |
| 310 |
"type": "boolean", |
| 311 |
"description": "Whether the document will be standalone (XmlEncoder)" |
| 312 |
}, |
| 313 |
"type_cast_attributes": { |
| 314 |
"type": "boolean", |
| 315 |
"description": "Whether casting numeric string attributes to integers or floats (XmlEncoder)" |
| 316 |
}, |
| 317 |
"version": { |
| 318 |
"type": "string", |
| 319 |
"description": "Version number of the document (XmlEncoder)" |
| 320 |
}, |
| 321 |
"cdata_wrapping": { |
| 322 |
"type": "boolean", |
| 323 |
"description": "Whether to wrap strings within CDATA sections (XmlEncoder)" |
| 324 |
}, |
| 325 |
"cdata_wrapping_pattern": { |
| 326 |
"type": "string", |
| 327 |
"description": "Pattern used to evaluate if a CDATA section should be added (XmlEncoder)" |
| 328 |
}, |
| 329 |
"ignore_empty_attributes": { |
| 330 |
"type": "boolean", |
| 331 |
"description": "Whether to ignore empty attributes (XmlEncoder)" |
| 332 |
}, |
| 333 |
"preserve_numeric_keys": { |
| 334 |
"type": "boolean", |
| 335 |
"description": "Whether to preserve numeric keys in array (XmlEncoder)" |
| 336 |
}, |
| 337 |
"inline_threshold": { |
| 338 |
"type": "integer", |
| 339 |
"description": "Threshold to switch to inline YAML (YamlEncoder)" |
| 340 |
}, |
| 341 |
"indent_level": { |
| 342 |
"type": "integer", |
| 343 |
"minimum": 0, |
| 344 |
"description": "Indentation level (YamlEncoder)" |
| 345 |
}, |
| 346 |
"flags": { |
| 347 |
"type": "integer", |
| 348 |
"description": "Yaml::dump flags bitmask (YamlEncoder)" |
| 349 |
}, |
| 350 |
"preserved_empty_objects": { |
| 351 |
"type": "boolean", |
| 352 |
"description": "Whether to preserve empty objects or convert them to null (YamlEncoder)" |
| 353 |
}, |
| 354 |
"delimiter": { |
| 355 |
"type": "string", |
| 356 |
"maxLength": 1, |
| 357 |
"description": "Column delimiter character (CsvEncoder)" |
| 358 |
}, |
| 359 |
"enclosure": { |
| 360 |
"type": "string", |
| 361 |
"maxLength": 1, |
| 362 |
"description": "Field enclosure character (CsvEncoder)" |
| 363 |
}, |
| 364 |
"escape_char": { |
| 365 |
"type": "string", |
| 366 |
"maxLength": 1, |
| 367 |
"description": "Escape character (CsvEncoder, deprecated)" |
| 368 |
}, |
| 369 |
"key_separator": { |
| 370 |
"type": "string", |
| 371 |
"description": "Key separator when (un)flattening arrays (CsvEncoder)" |
| 372 |
}, |
| 373 |
"headers": { |
| 374 |
"type": "array", |
| 375 |
"description": "Headers (CsvEncoder)" |
| 376 |
}, |
| 377 |
"escaped_formulas": { |
| 378 |
"type": "boolean", |
| 379 |
"description": "Whether formulas should be escaped (CsvEncoder)" |
| 380 |
}, |
| 381 |
"no_headers": { |
| 382 |
"type": "boolean", |
| 383 |
"description": "Whether the input/output is containing headers (CsvEncoder)" |
| 384 |
}, |
| 385 |
"end_of_line": { |
| 386 |
"type": "string", |
| 387 |
"description": "End of line characters (CsvEncoder)" |
| 388 |
}, |
| 389 |
"output_utf8_bom": { |
| 390 |
"type": "boolean", |
| 391 |
"description": "Whether to add the UTF-8 Byte Order Mark (CsvEncoder)" |
| 392 |
} |
| 393 |
}, |
| 394 |
"additionalProperties": { |
| 395 |
"oneOf": [ |
| 396 |
{ |
| 397 |
"type": "string" |
| 398 |
}, |
| 399 |
{ |
| 400 |
"type": "number" |
| 401 |
}, |
| 402 |
{ |
| 403 |
"type": "boolean" |
| 404 |
}, |
| 405 |
{ |
| 406 |
"type": "null" |
| 407 |
}, |
| 408 |
{ |
| 409 |
"type": "array" |
| 410 |
}, |
| 411 |
{ |
| 412 |
"type": "object" |
| 413 |
} |
| 414 |
] |
| 415 |
} |
| 416 |
} |
| 417 |
} |
| 418 |
} |