|
| 1 | +{ |
| 2 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | + "$id": "https://raw.githubusercontent.com/php-type-language/mapper/refs/heads/master/resources/config.schema.json", |
| 4 | + "title": "Config", |
| 5 | + "type": "object", |
| 6 | + "description": "A mapper configuration schema", |
| 7 | + "additionalProperties": false, |
| 8 | + "properties": { |
| 9 | + "normalize_as_array": { |
| 10 | + "type": "boolean", |
| 11 | + "description": "Responsible for enabling or disabling the conversion to an associative array" |
| 12 | + }, |
| 13 | + "discriminator": { |
| 14 | + "type": "object", |
| 15 | + "description": "Configuration of discriminator map", |
| 16 | + "additionalProperties": false, |
| 17 | + "required": ["field", "map"], |
| 18 | + "properties": { |
| 19 | + "field": { |
| 20 | + "type": "string", |
| 21 | + "description": "The name of the field with which the discriminator map values should be compared", |
| 22 | + "minLength": 1 |
| 23 | + }, |
| 24 | + "map": { |
| 25 | + "type": "object", |
| 26 | + "description": "List of values for discriminator map. Each key must contain a value for the configured field", |
| 27 | + "patternProperties": { |
| 28 | + "^.+?$": { |
| 29 | + "type": "string", |
| 30 | + "description": "Concrete type for discriminator map in case of key matches discriminator field", |
| 31 | + "minLength": 1 |
| 32 | + } |
| 33 | + }, |
| 34 | + "additionalProperties": false |
| 35 | + }, |
| 36 | + "otherwise": { |
| 37 | + "type": "string", |
| 38 | + "description": "An optional type in case the field's value is not found in the discriminator map", |
| 39 | + "minLength": 1 |
| 40 | + } |
| 41 | + } |
| 42 | + }, |
| 43 | + "properties": { |
| 44 | + "type": "object", |
| 45 | + "description": "List of properties for the specified class. Each key must contain the actual name of the class property", |
| 46 | + "patternProperties": { |
| 47 | + "^[a-zA-Z_\\x80-\\xff][a-zA-Z0-9_\\x80-\\xff]*$": { |
| 48 | + "anyOf": [ |
| 49 | + { |
| 50 | + "type": "object", |
| 51 | + "description": "Configuration of a specific class property", |
| 52 | + "additionalProperties": false, |
| 53 | + "properties": { |
| 54 | + "name": { |
| 55 | + "type": "string", |
| 56 | + "description": "Public name of the property", |
| 57 | + "minLength": 1 |
| 58 | + }, |
| 59 | + "type": { |
| 60 | + "type": "string", |
| 61 | + "description": "Specific property type", |
| 62 | + "minLength": 1 |
| 63 | + }, |
| 64 | + "skip": { |
| 65 | + "description": "Rules according to which a property should be excluded during normalization", |
| 66 | + "anyOf": [ |
| 67 | + { |
| 68 | + "type": "string", |
| 69 | + "description": "A specific rule to exclude: Can contain 'null' (if a field should be excluded when it contains null), 'empty' (if a field should be excluded when it empty), or an expression (if a complex expression is required for exclusion)", |
| 70 | + "minLength": 1 |
| 71 | + }, |
| 72 | + { |
| 73 | + "type": "array", |
| 74 | + "description": "List of multiple rules to exclude. Only one of the rules is taken into account (logical disjunction)", |
| 75 | + "minItems": 1, |
| 76 | + "items": { |
| 77 | + "type": "string", |
| 78 | + "description": "A specific rule to exclude: Can contain 'null' (if a field should be excluded when it contains null), 'empty' (if a field should be excluded when it empty), or an expression (if a complex expression is required for exclusion)", |
| 79 | + "minLength": 1 |
| 80 | + } |
| 81 | + } |
| 82 | + ] |
| 83 | + } |
| 84 | + } |
| 85 | + }, |
| 86 | + { |
| 87 | + "type": "string", |
| 88 | + "description": "Specific property type", |
| 89 | + "minLength": 1 |
| 90 | + } |
| 91 | + ] |
| 92 | + } |
| 93 | + }, |
| 94 | + "additionalProperties": false |
| 95 | + } |
| 96 | + } |
| 97 | +} |
0 commit comments