From 46ca4e249f1b61523e705e3e09adf5d514afe969 Mon Sep 17 00:00:00 2001
From: Jakob Olsson <Jakob Olsson>
Date: Mon, 9 Dec 2019 16:17:06 +0100
Subject: [PATCH] add invalid schema files to git
---
test/files/invalid_schemas/incomplete.json | 203 ++++++++++++++++++
.../files/invalid_schemas/missing_object.json | 203 ++++++++++++++++++
2 files changed, 406 insertions(+)
create mode 100644 test/files/invalid_schemas/incomplete.json
create mode 100644 test/files/invalid_schemas/missing_object.json
diff --git a/test/files/invalid_schemas/incomplete.json b/test/files/invalid_schemas/incomplete.json
new file mode 100644
index 0000000..1bd5275
--- /dev/null
+++ b/test/files/invalid_schemas/incomplete.json
@@ -0,0 +1,203 @@
+{
+ "definitions": {
+ "macaddr_t": {
+ "title": "MAC Address",
+ "type": "string",
+ "minLength": 17,
+ "maxLength": 17,
+ "pattern": "^([0-9a-fA-F][0-9a-fA-F]:){5}[0-9a-fA-F][0-9a-fA-F]$"
+ },
+ "noisepower_t": {
+ "title": "Noise",
+ "type": "integer",
+ "minimum": -127,
+ "maximum": 0
+ },
+ "channel_2_t": {
+ "title": "2.4GHz Channel",
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 14
+ },
+ "channel_5_t": {
+ "title": "5GHz Channel",
+ "type": "integer",
+ "minimum": 32,
+ "maximum": 200
+ },
+ "channels_2_t": {
+ "title": "2.4GHz Channels",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/channel_2_t"
+ }
+ },
+ "channels_5_t": {
+ "title": "5GHz Channels",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/channel_5_t"
+ }
+ },
+ "iface_t": {
+ "title": "Interface",
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 16
+ },
+ "band_t": {
+ "title": "WiFi Band",
+ "type": "string",
+ "enum": [
+ "2.4GHz",
+ "5GHz"
+ ]
+ },
+ "bandwidth_t": {
+ "title": "Bandwidth",
+ "type": "integer",
+ "enum": [
+ 20,
+ 40,
+ 80,
+ 160
+ ]
+ },
+ "aps_t": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "required": [
+ "ifname",
+ "status",
+ "ssid",
+ "bssid"
+ ],
+ "properties": {
+ "ifname": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 16
+ },
+ "status": {
+ "type": "string"
+ },
+ "ssid": {
+ "type": "string",
+ "minLength": 0,
+ "maxLength": 32
+ },
+ "bssid": {
+ "$ref": "#/definitions/macaddr_t"
+ }
+ }
+ }
+ }
+ },
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "https://www.iopsys.eu/wifi",
+ "type": "object",
+ "title": "wifi",
+ "object": "wifi",
+ "additionalProperties": false,
+ "properties": {
+ "status": {
+ "type": "object",
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {}
+ },
+ "output": {
+ "type": "object",
+ "required": [
+ "radios"
+ ],
+ "properties": {
+ "radios": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "required": [
+ "name",
+ "isup",
+ "standard",
+ "country",
+ "band",
+ "channel",
+ "bandwidth",
+ "noise",
+ "rate",
+ "channels",
+ "accesspoints",
+ "backhauls"
+ ],
+ "if": {
+ "properties": {
+ "band": {
+ "const": "2.4GHz"
+ }
+ }
+ },
+ "then": {
+ "properties": {
+ "channel": {
+ "$ref": "#/definitions/channel_2_t"
+ },
+ "channels": {
+ "$ref": "#/definitions/channels_2_t"
+ }
+ }
+ },
+ "else": {
+ "properties": {
+ "channel": {
+ "$ref": "#/definitions/channel_5_t"
+ },
+ "channels": {
+ "$ref": "#/definitions/channels_5_t"
+ }
+ }
+ },
+ "properties": {
+ "name": {
+ "$ref": "#/definitions/iface_t"
+ },
+ "isup": {
+ "type": "boolean"
+ },
+ "standard": {
+ "type": "string"
+ },
+ "country": {
+ "type": "string",
+ "minLength": 2,
+ "maxLength": 3
+ },
+ "band": {
+ "$ref": "#/definitions/band_t"
+ },
+ "bandwidth": {
+ "$ref": "#/definitions/bandwidth_t"
+ },
+ "noise": {
+ "$ref": "#/definitions/noisepower_t"
+ },
+ "rate": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "accesspoints": {
+ "$ref": "#/definitions/aps_t"
+ },
+ "backhauls": {
+ "$ref": "#/definitions/aps_t"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
diff --git a/test/files/invalid_schemas/missing_object.json b/test/files/invalid_schemas/missing_object.json
new file mode 100644
index 0000000..ca16e91
--- /dev/null
+++ b/test/files/invalid_schemas/missing_object.json
@@ -0,0 +1,203 @@
+{
+ "definitions": {
+ "macaddr_t": {
+ "title": "MAC Address",
+ "type": "string",
+ "minLength": 17,
+ "maxLength": 17,
+ "pattern": "^([0-9a-fA-F][0-9a-fA-F]:){5}[0-9a-fA-F][0-9a-fA-F]$"
+ },
+ "noisepower_t": {
+ "title": "Noise",
+ "type": "integer",
+ "minimum": -127,
+ "maximum": 0
+ },
+ "channel_2_t": {
+ "title": "2.4GHz Channel",
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 14
+ },
+ "channel_5_t": {
+ "title": "5GHz Channel",
+ "type": "integer",
+ "minimum": 32,
+ "maximum": 200
+ },
+ "channels_2_t": {
+ "title": "2.4GHz Channels",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/channel_2_t"
+ }
+ },
+ "channels_5_t": {
+ "title": "5GHz Channels",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/channel_5_t"
+ }
+ },
+ "iface_t": {
+ "title": "Interface",
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 16
+ },
+ "band_t": {
+ "title": "WiFi Band",
+ "type": "string",
+ "enum": [
+ "2.4GHz",
+ "5GHz"
+ ]
+ },
+ "bandwidth_t": {
+ "title": "Bandwidth",
+ "type": "integer",
+ "enum": [
+ 20,
+ 40,
+ 80,
+ 160
+ ]
+ },
+ "aps_t": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "required": [
+ "ifname",
+ "status",
+ "ssid",
+ "bssid"
+ ],
+ "properties": {
+ "ifname": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 16
+ },
+ "status": {
+ "type": "string"
+ },
+ "ssid": {
+ "type": "string",
+ "minLength": 0,
+ "maxLength": 32
+ },
+ "bssid": {
+ "$ref": "#/definitions/macaddr_t"
+ }
+ }
+ }
+ }
+ },
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$id": "https://www.iopsys.eu/wifi",
+ "type": "object",
+ "title": "wifi",
+ "additionalProperties": false,
+ "properties": {
+ "status": {
+ "type": "object",
+ "properties": {
+ "input": {
+ "type": "object",
+ "properties": {}
+ },
+ "output": {
+ "type": "object",
+ "required": [
+ "radios"
+ ],
+ "properties": {
+ "radios": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "required": [
+ "name",
+ "isup",
+ "standard",
+ "country",
+ "band",
+ "channel",
+ "bandwidth",
+ "noise",
+ "rate",
+ "channels",
+ "accesspoints",
+ "backhauls"
+ ],
+ "if": {
+ "properties": {
+ "band": {
+ "const": "2.4GHz"
+ }
+ }
+ },
+ "then": {
+ "properties": {
+ "channel": {
+ "$ref": "#/definitions/channel_2_t"
+ },
+ "channels": {
+ "$ref": "#/definitions/channels_2_t"
+ }
+ }
+ },
+ "else": {
+ "properties": {
+ "channel": {
+ "$ref": "#/definitions/channel_5_t"
+ },
+ "channels": {
+ "$ref": "#/definitions/channels_5_t"
+ }
+ }
+ },
+ "properties": {
+ "name": {
+ "$ref": "#/definitions/iface_t"
+ },
+ "isup": {
+ "type": "boolean"
+ },
+ "standard": {
+ "type": "string"
+ },
+ "country": {
+ "type": "string",
+ "minLength": 2,
+ "maxLength": 3
+ },
+ "band": {
+ "$ref": "#/definitions/band_t"
+ },
+ "bandwidth": {
+ "$ref": "#/definitions/bandwidth_t"
+ },
+ "noise": {
+ "$ref": "#/definitions/noisepower_t"
+ },
+ "rate": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "accesspoints": {
+ "$ref": "#/definitions/aps_t"
+ },
+ "backhauls": {
+ "$ref": "#/definitions/aps_t"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
--
GitLab