Mercurial > hgrepos > Python > libs > data-schema
comparison tests/schemata/test1.schema.yml @ 5:84dfd1a94926
Add the existing implementation.
All tests work.
The documentation as text file is included also.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 06 Jul 2023 23:41:41 +0200 |
| parents | |
| children | 41efa38a39b1 |
comparison
equal
deleted
inserted
replaced
| 4:d715f0c13c60 | 5:84dfd1a94926 |
|---|---|
| 1 # -*- coding: utf-8; mode: yaml; indent-tabs-mode: nil; -*- | |
| 2 # | |
| 3 # This is an sample schema definition file with most feature | |
| 4 # | |
| 5 %YAML 1.1 | |
| 6 --- | |
| 7 | |
| 8 type: dict | |
| 9 keys: | |
| 10 string-value: | |
| 11 type: string | |
| 12 minLength: 1 | |
| 13 maxLength: 255 | |
| 14 pattern: | |
| 15 anyOf: | |
| 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 | |
| 18 | |
| 19 binary-value: | |
| 20 type: binary | |
| 21 minLength: 20 | |
| 22 maxLength: 256 | |
| 23 value: *CALLABLE | |
| 24 | |
| 25 int-value: | |
| 26 type: int | |
| 27 minValue: 0 | |
| 28 maxValue: 100 | |
| 29 value: *CALLABLE | |
| 30 | |
| 31 float-value: | |
| 32 type: float | |
| 33 minValue: 0.0 | |
| 34 maxValue: 50.0 | |
| 35 value: *CALLABLE | |
| 36 | |
| 37 numeric-value: | |
| 38 type: number | |
| 39 minValue: 0 | |
| 40 maxValue: 1000 | |
| 41 value: *CALLABLE | |
| 42 | |
| 43 scalar-value: | |
| 44 type: scalar | |
| 45 | |
| 46 bool-value: | |
| 47 type: bool | |
| 48 value: *CALLABLE | |
| 49 | |
| 50 timestamp-value: | |
| 51 type: timestamp | |
| 52 value: *CALLABLE | |
| 53 | |
| 54 null-value: | |
| 55 type: null | |
| 56 | |
| 57 empty-value: | |
| 58 type: empty | |
| 59 | |
| 60 any-value: | |
| 61 type: accept | |
| 62 | |
| 63 not-any-value-allowed: | |
| 64 type: deny | |
| 65 | |
| 66 custom-value: | |
| 67 type: *CALLABLE | |
| 68 | |
| 69 dict-value: | |
| 70 type: dict | |
| 71 keys: | |
| 72 key1: | |
| 73 type: accept | |
| 74 0: | |
| 75 type: accept | |
| 76 1: | |
| 77 type: accept | |
| 78 keyNames: | |
| 79 oneOf: | |
| 80 - type: string | |
| 81 - type: integer | |
| 82 minValue: 0 | |
| 83 additionalKeys: | |
| 84 type: accept # equivalent to the simpler: additionalKeys: true | |
| 85 required: | |
| 86 - key1 | |
| 87 - 0 | |
| 88 | |
| 89 list-value: | |
| 90 type: list | |
| 91 minLength: 1 | |
| 92 maxLength: 10 | |
| 93 items: | |
| 94 anyOf: | |
| 95 - type: scalar | |
| 96 - type: *CALLABLE | |
| 97 | |
| 98 record-value: | |
| 99 type: record | |
| 100 items: | |
| 101 - type: string | |
| 102 - type: number | |
| 103 minLength: 2 | |
| 104 maxLength: 2 | |
| 105 additionalItems: false | |
| 106 | |
| 107 combinator-oneOf: | |
| 108 oneOf: | |
| 109 - type: int | |
| 110 - type: float | |
| 111 - type: null | |
| 112 | |
| 113 combinator-allOf: | |
| 114 allOf: | |
| 115 - &NAME | |
| 116 type: string | |
| 117 maxLength: 255 | |
| 118 pattern: *NAMERE | |
| 119 - type: *CALLABLE | |
| 120 | |
| 121 combinator-anyOf: | |
| 122 anyOf: | |
| 123 - *NAME | |
| 124 - type: *CALLABLE | |
| 125 - null | |
| 126 | |
| 127 additionalKeys: false | |
| 128 required: [] |
