Mercurial > hgrepos > Python > libs > data-schema
comparison tests/schemata/test1.schema.yml @ 31:271ec3abdfa3
Use "$type" as the schema's type specifier instead of "type".
THIS IS BACKWARDS INCOMPATIBLE.
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Tue, 18 Jul 2023 14:28:52 +0200 |
| parents | 41efa38a39b1 |
| children |
comparison
equal
deleted
inserted
replaced
| 30:2e7c08c356ee | 31:271ec3abdfa3 |
|---|---|
| 3 # This is an sample schema definition file with most features | 3 # This is an sample schema definition file with most features |
| 4 # | 4 # |
| 5 %YAML 1.1 | 5 %YAML 1.1 |
| 6 --- | 6 --- |
| 7 | 7 |
| 8 type: dict | 8 $type: dict |
| 9 keys: | 9 keys: |
| 10 string-value: | 10 string-value: |
| 11 type: string | 11 $type: string |
| 12 min-length: 1 | 12 min-length: 1 |
| 13 max-length: 255 | 13 max-length: 255 |
| 14 pattern: | 14 pattern: |
| 15 any-of: | 15 any-of: |
| 16 - &NAMERE !!python/object/apply:re.compile ['\A[A-Za-z_][A-Za-z0-9_]*\Z'] | 16 - &NAMERE !!python/object/apply:re.compile ['\A[A-Za-z_][A-Za-z0-9_]*\Z'] |
| 17 - &CALLABLE !!python/name:test_schema._test_generic_validator_for_yaml | 17 - &CALLABLE !!python/name:test_schema._test_generic_validator_for_yaml |
| 18 | 18 |
| 19 binary-value: | 19 binary-value: |
| 20 type: binary | 20 $type: binary |
| 21 min-length: 20 | 21 min-length: 20 |
| 22 max-length: 256 | 22 max-length: 256 |
| 23 value: *CALLABLE | 23 value: *CALLABLE |
| 24 | 24 |
| 25 int-value: | 25 int-value: |
| 26 type: int | 26 $type: int |
| 27 min-value: 0 | 27 min-value: 0 |
| 28 max-value: 100 | 28 max-value: 100 |
| 29 value: *CALLABLE | 29 value: *CALLABLE |
| 30 | 30 |
| 31 float-value: | 31 float-value: |
| 32 type: float | 32 $type: float |
| 33 min-value: 0.0 | 33 min-value: 0.0 |
| 34 max-value: 50.0 | 34 max-value: 50.0 |
| 35 value: *CALLABLE | 35 value: *CALLABLE |
| 36 | 36 |
| 37 numeric-value: | 37 numeric-value: |
| 38 type: number | 38 $type: number |
| 39 min-value: 0 | 39 min-value: 0 |
| 40 max-value: 1000 | 40 max-value: 1000 |
| 41 value: *CALLABLE | 41 value: *CALLABLE |
| 42 | 42 |
| 43 scalar-value: | 43 scalar-value: |
| 44 type: scalar | 44 $type: scalar |
| 45 | 45 |
| 46 bool-value: | 46 bool-value: |
| 47 type: bool | 47 $type: bool |
| 48 value: *CALLABLE | 48 value: *CALLABLE |
| 49 | 49 |
| 50 timestamp-value: | 50 timestamp-value: |
| 51 type: timestamp | 51 $type: timestamp |
| 52 value: *CALLABLE | 52 value: *CALLABLE |
| 53 | 53 |
| 54 null-value: | 54 null-value: |
| 55 type: null | 55 $type: null |
| 56 | 56 |
| 57 empty-value: | 57 empty-value: |
| 58 type: empty | 58 $type: empty |
| 59 | 59 |
| 60 any-value: | 60 any-value: |
| 61 type: accept | 61 $type: accept |
| 62 | 62 |
| 63 not-any-value-allowed: | 63 not-any-value-allowed: |
| 64 type: deny | 64 $type: deny |
| 65 | 65 |
| 66 custom-value: | 66 custom-value: |
| 67 type: *CALLABLE | 67 $type: *CALLABLE |
| 68 | 68 |
| 69 dict-value: | 69 dict-value: |
| 70 type: dict | 70 $type: dict |
| 71 keys: | 71 keys: |
| 72 key1: | 72 key1: |
| 73 type: accept | 73 $type: accept |
| 74 0: | 74 0: |
| 75 type: accept | 75 $type: accept |
| 76 1: | 76 1: |
| 77 type: accept | 77 $type: accept |
| 78 key-names: | 78 key-names: |
| 79 one-of: | 79 one-of: |
| 80 - type: string | 80 - $type: string |
| 81 - type: integer | 81 - $type: integer |
| 82 min-value: 0 | 82 min-value: 0 |
| 83 additional-keys: | 83 additional-keys: |
| 84 type: accept # equivalent to the simpler: additional-keys: true | 84 $type: accept # equivalent to the simpler: additional-keys: true |
| 85 required: | 85 required: |
| 86 - key1 | 86 - key1 |
| 87 - 0 | 87 - 0 |
| 88 | 88 |
| 89 list-value: | 89 list-value: |
| 90 type: list | 90 $type: list |
| 91 min-length: 1 | 91 min-length: 1 |
| 92 max-length: 10 | 92 max-length: 10 |
| 93 items: | 93 items: |
| 94 any-of: | 94 any-of: |
| 95 - type: scalar | 95 - $type: scalar |
| 96 - type: *CALLABLE | 96 - $type: *CALLABLE |
| 97 | 97 |
| 98 record-value: | 98 record-value: |
| 99 type: record | 99 $type: record |
| 100 items: | 100 items: |
| 101 - type: string | 101 - $type: string |
| 102 - type: number | 102 - $type: number |
| 103 min-length: 2 | 103 min-length: 2 |
| 104 max-length: 2 | 104 max-length: 2 |
| 105 additional-items: false | 105 additional-items: false |
| 106 | 106 |
| 107 combinator-one-of: | 107 combinator-one-of: |
| 108 one-of: | 108 one-of: |
| 109 - type: int | 109 - $type: int |
| 110 - type: float | 110 - $type: float |
| 111 - type: null | 111 - $type: null |
| 112 | 112 |
| 113 combinator-all-of: | 113 combinator-all-of: |
| 114 all-of: | 114 all-of: |
| 115 - &NAME | 115 - &NAME |
| 116 type: string | 116 $type: string |
| 117 max-length: 255 | 117 max-length: 255 |
| 118 pattern: *NAMERE | 118 pattern: *NAMERE |
| 119 - type: *CALLABLE | 119 - $type: *CALLABLE |
| 120 | 120 |
| 121 combinator-any-of: | 121 combinator-any-of: |
| 122 any-of: | 122 any-of: |
| 123 - *NAME | 123 - *NAME |
| 124 - type: *CALLABLE | 124 - $type: *CALLABLE |
| 125 - null | 125 - null |
| 126 | 126 |
| 127 additional-keys: false | 127 additional-keys: false |
| 128 required: [] | 128 required: [] |
