Skip to content

Commit c1482f9

Browse files
README additions
1 parent ebc5907 commit c1482f9

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

README.md

+34-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
[![Documentation Status](https://readthedocs.org/projects/jsnac/badge/?version=latest)](https://jsnac.readthedocs.io/en/latest/?badge=latest)
21
![Build Status](https://github.com/commitconfirmed/jsnac/workflows/JSNAC%20TOX%20Suite/badge.svg)
2+
[![Documentation Status](https://readthedocs.org/projects/jsnac/badge/?version=latest)](https://jsnac.readthedocs.io/en/latest/?badge=latest)
3+
34

45
# JSNAC
5-
JSON Schema (for) Network as Code
6+
JSON Schema (for) Network Automation Creator
7+
8+
- [Overview](#overview)
9+
- [Brief Example](#brief-example)
10+
- [YAML Validation](#yaml-validation)
11+
- [Detailed Example](#detailed-example)
12+
- [Usage](#usage)
613

714
## Overview
815

@@ -81,6 +88,30 @@ schema:
8188
kind: { name: "ipv6_cidr" }
8289
```
8390
91+
```bash
92+
(.venv) user@server:~/jsnac$ jsnac -f data/example-jsnac.yml
93+
[INFO] - jsnac - Starting JSNAC CLI
94+
[INFO] - jsnac - Schema built in 0.0006 seconds
95+
[INFO] - jsnac - Schema written to: jsnac.schema.json
96+
[INFO] - jsnac - JSNAC CLI complete
97+
```
98+
99+
## YAML Validation
100+
101+
To be able to validate the orginal YAML file or any new YAML file you create using this schema you first need to reference your JSON schema using the yaml-language-server comment at the top of your YAML file
102+
103+
```yaml
104+
# yaml-language-server: $schema=jsnac.schema.json
105+
---
106+
chassis:
107+
hostname: "hostname"
108+
```
109+
110+
Which language server you use is specific to your environment and editor that you use. For Visual Studio Code I recommend that you use the [Red Hat YAML Language Server](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) extension. Once installed you will now see that you will have automatic code completion, syntax highlighting, schema validation etc. while editing your YAML file.
111+
112+
113+
## Detailed Example
114+
84115
We also have full support for writing your own titles, descriptions, kinds (sub-schemas), objects that are required, etc. A more fleshed out example of the same schema is below:
85116
86117
```yaml
@@ -161,7 +192,7 @@ schema:
161192
required: [ "if" ]
162193
```
163194
164-
A full list of kinds are available in the ![documentation](https://jsnac.readthedocs.io/en/latest/)
195+
A full list of kinds are available in the [documentation](https://jsnac.readthedocs.io/en/latest/)
165196
166197
## Usage
167198

0 commit comments

Comments
 (0)