|
| 1 | +YAVL-CPP is a C++ library to help validate YAML files |
| 2 | +against a user-provided specification. |
| 3 | + |
| 4 | +The specification file is also written in YAML. |
| 5 | + |
| 6 | +I hesitate to say that this tool checks an input |
| 7 | +YAML against a "grammar". I do not think the specification |
| 8 | +format I've defined is general enough to be called a |
| 9 | +"grammar". |
| 10 | + |
| 11 | +Note: this is not check if the input file is a valid |
| 12 | +YAML; any YAML parser will do that. This library can be |
| 13 | +used to check if the input YAML has the structure |
| 14 | +(i.e., structure, keys, values, types) that your |
| 15 | +application expects. See example below. |
| 16 | + |
| 17 | +The idea is that generation of error messages about |
| 18 | +what is wrong with a YAML file can be automated through |
| 19 | +this library, so that your processing functions can be |
| 20 | +written assuming that the tree generated from the YAML |
| 21 | +file conforms to your code's assumptions. |
| 22 | + |
| 23 | +Example specification |
| 24 | +===================== |
| 25 | + |
| 26 | +map: |
| 27 | + HEADER: |
| 28 | + map: |
| 29 | + name: [string: ] |
| 30 | + version: [string: ] |
| 31 | + sizeKB: [uint: ] |
| 32 | + |
| 33 | +Valid YAML |
| 34 | +========== |
| 35 | + |
| 36 | +HEADER: |
| 37 | + name: myname |
| 38 | + version: 1.02 |
| 39 | + sizeKB: 100 |
| 40 | + |
| 41 | +Invalid YAML |
| 42 | +============ |
| 43 | + |
| 44 | +HEADER: |
| 45 | + name: myname |
| 46 | + version: 1.02 |
| 47 | + sizeKB: 100 KB |
| 48 | + # bug: KB should be absent |
| 49 | + |
| 50 | +With the invalid YAML, you'll get an error that "100 |
| 51 | +KB" couldn't be converted to an int. |
| 52 | + |
| 53 | +PREREQUISITES |
| 54 | +============= |
| 55 | + |
| 56 | +Yavl-cpp uses the excellent yaml-cpp library. Go check |
| 57 | +out yaml-cpp just for the heck of it. It's one of the |
| 58 | +best designed libraries out there. Simple, and to the |
| 59 | +point implementation and documentaion. |
| 60 | + |
| 61 | +eof |
0 commit comments