Skip to content

Commit 2012942

Browse files
Tidying up
1 parent 1ac5d9c commit 2012942

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ Take a basic Ansible host_vars YAML file for a host below:
2121

2222
```yaml
2323
chassis:
24-
hostname: "ceos-spine1"
25-
model: "ceos"
26-
type: "router"
24+
hostname: "ceos-spine1"
25+
model: "ceos"
26+
type: "router"
2727

2828
system:
29-
domain_name: "example.com"
30-
ntp_servers: [ "10.0.0.1", "10.0.0.2" ]
29+
domain_name: "example.com"
30+
ntp_servers: [ "10.0.0.1", "10.0.0.2" ]
3131

3232
interfaces:
33-
- if: "Loopback0"
34-
desc: "Underlay Loopback"
35-
ipv4: "10.0.0.101/32"
36-
ipv6: "2001:2:a1::1/128"
37-
- if: "Ethernet0"
38-
desc: "Management Interface"
39-
ipv4: "10.1.0.20/24"
33+
- if: "Loopback0"
34+
desc: "Underlay Loopback"
35+
ipv4: "10.0.0.101/32"
36+
ipv6: "2001:2:a1::1/128"
37+
- if: "Ethernet0"
38+
desc: "Management Interface"
39+
ipv4: "10.1.0.20/24"
4040
```
4141
4242
You can simply write out how you would like to validate this data, and this program will write out a JSON schema you can use. You can just also keep your existing data if you just want some basic type validation (string, integer, float, array, etc.).

data/example.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1+
# yaml-language-server: $schema=example.schema.json
2+
13
chassis:
2-
hostname: "ceos-spine1"
3-
model: "ceos"
4-
type: "router"
4+
hostname: "ceos-spine1"
5+
model: "ceos"
6+
type: "router"
57

68
system:
7-
domain_name: "example.com"
8-
ntp_servers: [ "10.0.0.1", "10.0.0.2" ]
9+
domain_name: "example.com"
10+
ntp_servers: [ "10.0.0.1", "10.0.0.2" ]
911

1012
interfaces:
11-
- if: "Loopback0"
12-
desc: "Underlay Loopback"
13-
ipv4: "10.0.0.101/32"
14-
ipv6: "2001:2:a1::1/128"
15-
- if: "Ethernet0"
16-
desc: "Management Interface"
17-
ipv4: "10.1.0.20/24"
13+
- if: "Loopback0"
14+
desc: "Underlay Loopback"
15+
ipv4: "10.0.0.101/32"
16+
ipv6: "2001:2:a1::1/128"
17+
- if: "Ethernet0"
18+
desc: "Management Interface"
19+
ipv4: "10.1.0.20/24"

0 commit comments

Comments
 (0)