yaml-validator-typescript
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/Milihhard/yaml-validator-typescript#readme", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "yaml", |
@@ -21,2 +21,35 @@ # yaml-validator-typescript | ||
## Define your modele | ||
You can set you model as you want. You just need to have properties initialized | ||
If you don't want some property to be tested, you can implement `Yaml` | ||
```javascript | ||
class TestOnlyKeys implements Yaml { | ||
keysToTest: (keyof TestOnlyKeys)[] = ['key1', 'key2']; | ||
key1: string = ''; | ||
key2: number = 0; | ||
keyNotToTest: boolean = false; | ||
} | ||
``` | ||
> Here only `key1` and `key2` are tested | ||
> You can also set some properties optionals: | ||
```javascript | ||
class Optional implements Yaml { | ||
keysToTest: string[] = ['valueToHave', 'valueOptional', 'arrayOptional']; | ||
optionals: Set<string> = new Set(['valueOptional', 'arrayOptional']); | ||
valueToHave: string = ''; | ||
valueOptional: string = ''; | ||
arrayOptional: {valueYouNeed1: string, valueYouNeed2: boolean}[] = [ | ||
{valueYouNeed1: '', valueYouNeed2: true}, | ||
]; | ||
} | ||
``` | ||
> Here `valueOptional` and `arrayOptional` are optionals | ||
> But if `arrayOptional` is defined, he has to be right | ||
### As a command | ||
@@ -23,0 +56,0 @@ |
19635
124