Skip to content

Commit 35ec611

Browse files
0.2.1 release
1 parent 0e6d93f commit 35ec611

File tree

7 files changed

+157
-20
lines changed

7 files changed

+157
-20
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ htmlcov/
1818
docs/build/
1919

2020
# JSNAC default output file
21-
jsnac.schema.json
21+
jsnac.schema.json
22+
23+
# Release notes
24+
release.txt

dist/jsnac-0.2.1-py3-none-any.whl

382 Bytes
Binary file not shown.

dist/jsnac-0.2.1.tar.gz

337 Bytes
Binary file not shown.

docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
project = "JSNAC"
1010
copyright = "2024, Andrew Jones"
1111
author = "Andrew Jones"
12-
release = "0.2.0"
12+
release = "0.2.1"
1313

1414
# -- General configuration ---------------------------------------------------
1515
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

docs/source/intro.rst

+1-11
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Take a basic Ansible host_vars YAML file for a host below:
2121
chassis:
2222
hostname: "ceos-spine1"
2323
model: "ceos"
24-
type: "router"
24+
device_type: "router"
2525
2626
system:
2727
domain_name: "example.com"
@@ -46,7 +46,6 @@ You can simply write out how you would like to validate this data, and this prog
4646
schema:
4747
chassis:
4848
title: "Chassis"
49-
type: "object"
5049
properties:
5150
hostname:
5251
js_kind: { name: "string" }
@@ -55,18 +54,14 @@ You can simply write out how you would like to validate this data, and this prog
5554
device_type:
5655
js_kind: { name: "choice", choices: [ "router", "switch", "firewall", "load-balancer" ] }
5756
system:
58-
type: "object"
5957
properties:
6058
domain_name:
6159
js_kind: { name: "string" }
6260
ntp_servers:
63-
type: "array"
6461
items:
6562
js_kind: { name: "ipv4" }
6663
interfaces:
67-
type: "array"
6864
items:
69-
type: "object"
7065
properties:
7166
if:
7267
js_kind: { name: "string" }
@@ -105,7 +100,6 @@ We also have full support for writing your own titles, descriptions, js_kinds (s
105100
hostname [required]: hostname
106101
model [required]: string
107102
device_type [required]: choice (router, switch, firewall, load-balancer)
108-
type: "object"
109103
properties:
110104
hostname:
111105
js_kind: { name: "hostname" }
@@ -124,14 +118,12 @@ We also have full support for writing your own titles, descriptions, js_kinds (s
124118
Object containing System information. Has the below properties:
125119
domain_name [required]: string
126120
ntp_servers [required]: list of ipv4 addresses
127-
type: "object"
128121
properties:
129122
domain_name:
130123
js_kind: { name: "string" }
131124
ntp_servers:
132125
title: "NTP Servers"
133126
description: "List of NTP servers"
134-
type: "array"
135127
items:
136128
js_kind: { name: "ipv4" }
137129
required: [ "domain_name", "ntp_servers" ]
@@ -143,9 +135,7 @@ We also have full support for writing your own titles, descriptions, js_kinds (s
143135
desc: string
144136
ipv4: ipv4_cidr
145137
ipv6: ipv6_cidr
146-
type: "array"
147138
items:
148-
type: "object"
149139
properties:
150140
if:
151141
js_kind: { name: "string" }
File renamed without changes.

docs/source/types.rst

+151-7
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,124 @@ The string will be validated against the below IPv6 CIDR address regex pattern.
8181
8282
^(([a-fA-F0-9]{1,4}|):){1,7}([a-fA-F0-9]{1,4}|:)/(32|36|40|44|48|52|56|60|64|128)$
8383
84+
**Example**
85+
86+
.. code-block:: yaml
87+
88+
system:
89+
ip_address:
90+
js_kind: { name: "ipv6_cidr" }
91+
92+
js_kind: domain
93+
******************
94+
95+
This type is used to validate a string against a domain name.
96+
The string will be validated against the below domain name regex pattern.
97+
98+
.. code-block:: text
99+
100+
^([a-zA-Z0-9-]{1,63}\\.)+[a-zA-Z]{2,63}$
101+
102+
**Example**
103+
104+
.. code-block:: yaml
105+
106+
system:
107+
domain_name:
108+
js_kind: { name: "domain" }
109+
110+
js_kind: email
111+
******************
112+
113+
This type is used to validate a string against an email address.
114+
The string will be validated against the below email address regex pattern.
115+
116+
.. code-block:: text
117+
118+
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$
119+
120+
**Example**
121+
122+
.. code-block:: yaml
123+
124+
system:
125+
email_address:
126+
js_kind: { name: "email" }
127+
128+
js_kind: http_url
129+
******************
130+
131+
This type is used to validate a string against an HTTP URL.
132+
The string will be validated against the below HTTP URL regex pattern.
133+
134+
.. code-block:: text
135+
136+
^(https?://)?([\\da-z.-]+)\\.([a-z.]{2,6})([/\\w .-]*)*\\??([^#\\s]*)?(#.*)?$
137+
138+
**Example**
139+
140+
.. code-block:: yaml
141+
142+
system:
143+
sftp_server:
144+
js_kind: { name: "http_url" }
145+
146+
js_kind: uint16
147+
******************
148+
149+
This type is used to validate a string against a 16-bit unsigned integer (0 to 65535).
150+
151+
**Example**
152+
153+
.. code-block:: yaml
154+
155+
bgp:
156+
as_number:
157+
js_kind: { name: "uint16" }
158+
159+
js_kind: uint32
160+
******************
161+
162+
This type is used to validate a string against a 32-bit unsigned integer (0 to 4294967295).
163+
164+
**Example**
165+
166+
.. code-block:: yaml
167+
168+
bgp:
169+
as_number:
170+
js_kind: { name: "uint32" }
171+
172+
js_kind: uint64
173+
******************
174+
175+
This type is used to validate a string against a 64-bit unsigned integer (0 to 18446744073709551615).
176+
177+
**Example**
178+
179+
.. code-block:: yaml
180+
181+
interface:
182+
statistics:
183+
in_octets: { name: "uint64" }
184+
185+
js_kind: mtu
186+
******************
187+
188+
This type is used to validate a string against a maximum transmission unit (MTU) value (68 to 9192).
189+
190+
**Example**
191+
192+
.. code-block:: yaml
193+
194+
interface:
195+
mtu:
196+
js_kind: { name: "mtu" }
84197
85198
js_kind: mac
86199
******************
87200

88-
This type is used to validate a string against a MAC address.
201+
This type is used to validate a string against a MAC address (i.e ff:ff:ff:ff:ff:ff).
89202
The string will be validated against the below MAC address regex pattern.
90203

91204
.. code-block:: text
@@ -100,20 +213,51 @@ The string will be validated against the below MAC address regex pattern.
100213
mac_address:
101214
js_kind: { name: "mac" }
102215
103-
js_kind: domain
216+
js_kind: mac_dot
104217
******************
105218

106-
This type is used to validate a string against a domain name.
107-
The string will be validated against the below domain name regex pattern.
219+
This type is used to validate a string against a MAC address with dot separator (i.e ffff.ffff.ffff).
220+
The string will be validated against the below MAC address regex pattern.
108221

109222
.. code-block:: text
110223
111-
^([a-zA-Z0-9-]{1,63}\\.)+[a-zA-Z]{2,63}$
224+
^([0-9A-Fa-f]{4}[.]){2}([0-9A-Fa-f]{4})$
112225
113226
**Example**
114227

115228
.. code-block:: yaml
116229
117230
system:
118-
domain_name:
119-
js_kind: { name: "domain" }
231+
mac_address:
232+
js_kind: { name: "mac_dot" }
233+
234+
js_kind: vlan
235+
******************
236+
237+
This type is used to validate a string against a VLAN ID (1 to 4094).
238+
239+
**Example**
240+
241+
.. code-block:: yaml
242+
243+
interface:
244+
vlan_id:
245+
js_kind: { name: "vlan" }
246+
247+
js_kind: docker_image
248+
*********************
249+
250+
This type is used to validate a string against a Docker image name.
251+
The string will be validated against the below Docker image name regex pattern.
252+
253+
.. code-block:: text
254+
255+
^[a-z0-9]+(?:[._-][a-z0-9]+)*$
256+
257+
**Example**
258+
259+
.. code-block:: yaml
260+
261+
system:
262+
docker_image:
263+
js_kind: { name: "docker_image" }

0 commit comments

Comments
 (0)