From b66e5dfd8de52270c79fda1c9504c04d2149eccb Mon Sep 17 00:00:00 2001
From: Jakob Olsson <Jakob Olsson>
Date: Fri, 13 Dec 2019 14:53:50 +0100
Subject: [PATCH] remove definitions from schemas, depend on definitions.json

---
 ubus/wifi.ap.json    | 219 +++++++++++++------------------------------
 ubus/wifi.json       | 120 +++---------------------
 ubus/wifi.radio.json | 171 +++++++--------------------------
 ubus/wifi.wps.json   |  43 ++++-----
 4 files changed, 130 insertions(+), 423 deletions(-)

diff --git a/ubus/wifi.ap.json b/ubus/wifi.ap.json
index e87803b..7b21941 100644
--- a/ubus/wifi.ap.json
+++ b/ubus/wifi.ap.json
@@ -1,96 +1,9 @@
 {
-    "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]$"
-        },
-        "oui_t": {
-            "title": "Three byte oui",
-            "type": "string",
-            "minLength": 9,
-            "maxLength": 9,
-            "pattern": "^([0-9a-fA-F][0-9a-fA-F]){3}$"
-        },
-        "data_t": {
-            "title": "Hex String",
-            "type": "string",
-            "pattern": "^[0-9a-fA-F]+"
-        },
-        "rssi_t": {
-            "title": "RSSI",
-            "type": "integer",
-            "minimum": -128,
-            "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
-        },
-        "iface_t": {
-            "title": "Interface",
-            "type": "string",
-            "minLength": 1,
-            "maxLength": 16
-        },
-        "band_t": {
-            "title": "WiFi Band",
-            "type": "string",
-            "enum": [
-                "2.4GHz",
-                "5GHz"
-            ]
-        },
-        "bandwidth_2_t": {
-            "title": "Bandwidth",
-            "type": "integer",
-            "enum": [
-                20,
-                40
-            ]
-        },
-        "bandwidth_5_t": {
-            "title": "Bandwidth",
-            "type": "integer",
-            "enum": [
-                20,
-                40,
-                80,
-                160
-            ]
-        },
-        "nstations_t": {
-            "title": "Number of stations",
-            "type": "integer",
-            "minimum": 0,
-            "maximum": 2007
-        },
-        "rxtx_t": {
-            "type": "integer",
-            "minimum": 0
-        },
-        "ssid_t": {
-            "title": "SSID",
-            "type": "string",
-            "minLength": 0,
-            "maxLength": 32
-        }
-    },
-    "title": "wifi.ap",
+    "title": "wifi.ap.<name>",
     "regex": true,
     "object": "^wifi\\.ap\\..*",
     "$schema": "http://json-schema.org/draft-07/schema#",
-    "$id": "https://www.iopsys.eu/wifi.ap",
+    "$id": "https://www.iopsys.eu/wifi.ap.json",
     "additionalProperties": false,
     "properties": {
         "add_neighbor": {
@@ -107,15 +20,15 @@
                     ],
                     "properties": {
                         "bssid": {
-                            "$ref": "#/definitions/macaddr_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                         },
                         "channel": {
                             "oneOf": [
                                 {
-                                    "$ref": "#/definitions/channel_2_t"
+                                    "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_2_t"
                                 },
                                 {
-                                    "$ref": "#/definitions/channel_5_t"
+                                    "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_5_t"
                                 }
                             ]
                         },
@@ -148,7 +61,7 @@
                     ],
                     "properties": {
                         "bssid": {
-                            "$ref": "#/definitions/macaddr_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                         }
                     }
                 },
@@ -168,10 +81,10 @@
                     ],
                     "properties": {
                         "ssid": {
-                            "$ref": "#/definitions/ssid_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/ssid_t"
                         },
                         "client": {
-                            "$ref": "#/definitions/macaddr_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                         }
                     }
                 },
@@ -192,12 +105,12 @@
                     ],
                     "properties": {
                         "client": {
-                            "$ref": "#/definitions/macaddr_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                         },
                         "bssid": {
                             "type": "array",
                             "items": {
-                                "$ref": "#/definitions/macaddr_t"
+                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                             }
                         },
                         "timeout": {
@@ -221,7 +134,7 @@
                     ],
                     "properties": {
                         "sta": {
-                            "$ref": "#/definitions/macaddr_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                         },
                         "get": {
                             "type": "integer"
@@ -249,10 +162,10 @@
                             "type": "integer"
                         },
                         "oui": {
-                            "$ref": "#/definitions/oui_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/oui_t"
                         },
                         "data": {
-                            "$ref": "#/definitions/data_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/data_t"
                         }
                     }
                 },
@@ -277,10 +190,10 @@
                             "type": "integer"
                         },
                         "oui": {
-                            "$ref": "#/definitions/oui_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/oui_t"
                         },
                         "data": {
-                            "$ref": "#/definitions/data_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/data_t"
                         }
                     }
                 },
@@ -300,7 +213,7 @@
                     ],
                     "properties": {
                         "sta": {
-                            "$ref": "#/definitions/macaddr_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                         }
                     }
                 },
@@ -336,16 +249,16 @@
                     ],
                     "properties": {
                         "ifname": {
-                            "$ref": "#/definitions/iface_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/iface_t"
                         },
                         "status": {
                             "type": "string"
                         },
                         "ssid": {
-                            "$ref": "#/definitions/ssid_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/ssid_t"
                         },
                         "bssid": {
-                            "$ref": "#/definitions/macaddr_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                         },
                         "encryption": {
                             "type": "string"
@@ -353,10 +266,10 @@
                         "bandwidth": {
                             "oneOf": [
                                 {
-                                    "$ref": "#/definitions/bandwidth_2_t"
+                                    "$ref": "https://www.iopsys.eu/definitions.json#/definitions/bandwidth_2_t"
                                 },
                                 {
-                                    "$ref": "#/definitions/bandwidth_5_t"
+                                    "$ref": "https://www.iopsys.eu/definitions.json#/definitions/bandwidth_5_t"
                                 }
                             ]
                         },
@@ -364,7 +277,7 @@
                             "type": "string"
                         },
                         "num_stations": {
-                            "$ref": "#/definitions/nstations_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/nstations_t"
                         },
                         "utilization": {
                             "type": "integer",
@@ -378,7 +291,7 @@
                             "type": "boolean"
                         },
                         "max_stations": {
-                            "$ref": "#/definitions/nstations_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/nstations_t"
                         },
                         "capabilities": {
                             "type": "object",
@@ -543,67 +456,67 @@
                     ],
                     "properties": {
                         "tx_bytes": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_unicast_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_multicast_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_broadcast_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_error_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_retrans_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_retrans_fail_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_retry_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_multi_retry_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_dropped_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "ack_fail_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "aggregate_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_bytes": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_unicast_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_multicast_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_broadcast_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_error_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_dropped_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_unknown_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         }
                     }
                 }
@@ -616,7 +529,7 @@
                     "type": "object",
                     "properties": {
                         "sta": {
-                            "$ref": "#/definitions/macaddr_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                         }
                     }
                 },
@@ -649,16 +562,16 @@
                                 ],
                                 "properties": {
                                     "macaddr": {
-                                        "$ref": "#/definitions/macaddr_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                                     },
                                     "wdev": {
-                                        "$ref": "#/definitions/iface_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/iface_t"
                                     },
                                     "frequency": {
-                                        "$ref": "#/definitions/band_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/band_t"
                                     },
                                     "rssi": {
-                                        "$ref": "#/definitions/rssi_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rssi_t"
                                     },
                                     "snr": {
                                         "type": "integer",
@@ -891,38 +804,38 @@
                                         ],
                                         "properties": {
                                             "tx_total_pkts": {
-                                                "$ref": "#/definitions/rxtx_t"
+                                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                                             },
                                             "tx_total_bytes": {
-                                                "$ref": "#/definitions/rxtx_t"
+                                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                                             },
                                             "tx_failures": {
-                                                "$ref": "#/definitions/rxtx_t"
+                                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                                             },
                                             "tx_pkts_retries": {
-                                                "$ref": "#/definitions/rxtx_t"
+                                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                                             },
                                             "rx_data_pkts": {
-                                                "$ref": "#/definitions/rxtx_t"
+                                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                                             },
                                             "rx_data_bytes": {
-                                                "$ref": "#/definitions/rxtx_t"
+                                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                                             },
                                             "rx_failures": {
-                                                "$ref": "#/definitions/rxtx_t"
+                                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                                             },
                                             "rate_of_last_tx_pkt": {
-                                                "$ref": "#/definitions/rxtx_t"
+                                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                                             },
                                             "rate_of_last_rx_pkt": {
-                                                "$ref": "#/definitions/rxtx_t"
+                                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                                             }
                                         }
                                     },
                                     "rssi_per_antenna": {
                                         "type": "array",
                                         "items": {
-                                            "$ref": "#/definitions/rssi_t"
+                                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rssi_t"
                                         }
                                     }
                                 }
@@ -939,10 +852,10 @@
                     "type": "object",
                     "properties": {
                         "ssid": {
-                            "$ref": "#/definitions/ssid_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/ssid_t"
                         },
                         "client": {
-                            "$ref": "#/definitions/macaddr_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                         }
                     }
                 },
@@ -965,7 +878,7 @@
                                 ],
                                 "properties": {
                                     "bssid": {
-                                        "$ref": "#/definitions/macaddr_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                                     },
                                     "bss_info": {
                                         "type": "integer",
@@ -978,10 +891,10 @@
                                     "channel": {
                                         "oneOf": [
                                             {
-                                                "$ref": "#/definitions/channel_2_t"
+                                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_2_t"
                                             },
                                             {
-                                                "$ref": "#/definitions/channel_5_t"
+                                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_5_t"
                                             }
                                         ]
                                     },
@@ -1020,10 +933,10 @@
                                 ],
                                 "properties": {
                                     "wdev": {
-                                        "$ref": "#/definitions/iface_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/iface_t"
                                     },
                                     "macaddr": {
-                                        "$ref": "#/definitions/macaddr_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                                     }
                                 }
                             }
diff --git a/ubus/wifi.json b/ubus/wifi.json
index 00a87ed..362bc0a 100644
--- a/ubus/wifi.json
+++ b/ubus/wifi.json
@@ -1,101 +1,7 @@
 {
-    "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",
+    "$id": "https://www.iopsys.eu/wifi.json",
     "type": "object",
     "title": "wifi",
     "object": "wifi",
@@ -142,26 +48,26 @@
                                 "then": {
                                     "properties": {
                                         "channel": {
-                                            "$ref": "#/definitions/channel_2_t"
+                                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_2_t"
                                         },
                                         "channels": {
-                                            "$ref": "#/definitions/channels_2_t"
+                                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channels_2_t"
                                         }
                                     }
                                 },
                                 "else": {
                                     "properties": {
                                         "channel": {
-                                            "$ref": "#/definitions/channel_5_t"
+                                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_5_t"
                                         },
                                         "channels": {
-                                            "$ref": "#/definitions/channels_5_t"
+                                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channels_5_t"
                                         }
                                     }
                                 },
                                 "properties": {
                                     "name": {
-                                        "$ref": "#/definitions/iface_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/iface_t"
                                     },
                                     "isup": {
                                         "type": "boolean"
@@ -175,23 +81,23 @@
                                         "maxLength": 3
                                     },
                                     "band": {
-                                        "$ref": "#/definitions/band_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/band_t"
                                     },
                                     "bandwidth": {
-                                        "$ref": "#/definitions/bandwidth_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/bandwidth_t"
                                     },
                                     "noise": {
-                                        "$ref": "#/definitions/noisepower_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/noisepower_t"
                                     },
                                     "rate": {
                                         "type": "integer",
                                         "minimum": 0
                                     },
                                     "accesspoints": {
-                                        "$ref": "#/definitions/aps_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/aps_t"
                                     },
                                     "backhauls": {
-                                        "$ref": "#/definitions/aps_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/aps_t"
                                     }
                                 }
                             }
@@ -201,4 +107,4 @@
             }
         }
     }
-}
+}
\ No newline at end of file
diff --git a/ubus/wifi.radio.json b/ubus/wifi.radio.json
index ec7deac..e264f43 100644
--- a/ubus/wifi.radio.json
+++ b/ubus/wifi.radio.json
@@ -1,111 +1,10 @@
 {
-    "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]$"
-        },
-        "rssi_t": {
-            "title": "RSSI",
-            "type": "integer",
-            "minimum": -128,
-            "maximum": 0
-        },
-        "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
-        },
-        "iface_t": {
-            "title": "Interface",
-            "type": "string",
-            "minLength": 1,
-            "maxLength": 16
-        },
-        "band_t": {
-            "title": "WiFi Band",
-            "type": "string",
-            "enum": [
-                "2.4GHz",
-                "5GHz"
-            ]
-        },
-        "standards_2_t": {
-            "title": "2.4GHz WiFi Standards",
-            "type": "array",
-            "items": {
-                "type": "string",
-                "enum": [
-                    "b",
-                    "g",
-                    "n",
-                    "ax"
-                ]
-            }
-        },
-        "standards_5_t": {
-            "title": "5GHz WiFi Standards",
-            "type": "array",
-            "items": {
-                "type": "string",
-                "enum": [
-                    "a",
-                    "n",
-                    "ac",
-                    "ax"
-                ]
-            }
-        },
-        "bandwidth_2_t": {
-            "title": "Bandwidth",
-            "type": "integer",
-            "enum": [
-                20,
-                40
-            ]
-        },
-        "bandwidth_5_t": {
-            "title": "Bandwidth",
-            "type": "integer",
-            "enum": [
-                20,
-                40,
-                80,
-                160
-            ]
-        },
-        "rxtx_t": {
-            "type": "integer",
-            "minimum": 0
-        },
-        "ssid_t": {
-            "title": "SSID",
-            "type": "string",
-            "minLength": 0,
-            "maxLength": 32
-        }
-    },
     "object": "^wifi\\.radio\\..+",
-    "rege": true,
-    "title": "wifi.radio.*",
+    "regex": true,
+    "title": "wifi.radio.<name>",
     "description": "WiFi Radio Object",
     "$schema": "http://json-schema.org/draft-07/schema#",
-    "$id": "https://www.iopsys.eu/wifi.radio",
+    "$id": "https://www.iopsys.eu/wifi.radio.json",
     "additionalProperties": false,
     "properties": {
         "autochannel": {
@@ -141,10 +40,10 @@
                         "new_channel": {
                             "oneOf": [
                                 {
-                                    "$ref": "#/definitions/channel_2_t"
+                                    "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_2_t"
                                 },
                                 {
-                                    "$ref": "#/definitions/channel_5_t"
+                                    "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_5_t"
                                 }
                             ]
                         },
@@ -162,18 +61,18 @@
                     "type": "object",
                     "properties": {
                         "ssid": {
-                            "$ref": "#/definitions/ssid_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/ssid_t"
                         },
                         "bssid": {
-                            "$ref": "#/definitions/macaddr_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                         },
                         "channel": {
                             "oneOf": [
                                 {
-                                    "$ref": "#/definitions/channel_2_t"
+                                    "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_2_t"
                                 },
                                 {
-                                    "$ref": "#/definitions/channel_5_t"
+                                    "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_5_t"
                                 }
                             ]
                         }
@@ -228,44 +127,44 @@
                                 "then": {
                                     "properties": {
                                         "standard": {
-                                            "$ref": "#/definitions/standards_2_t"
+                                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/standards_2_t"
                                         },
                                         "bandwidth": {
-                                            "$ref": "#/definitions/bandwidth_2_t"
+                                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/bandwidth_2_t"
                                         },
                                         "channel": {
-                                            "$ref": "#/definitions/channel_2_t"
+                                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_2_t"
                                         }
                                     }
                                 },
                                 "else": {
                                     "properties": {
                                         "standard": {
-                                            "$ref": "#/definitions/standards_5_t"
+                                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/standards_5_t"
                                         },
                                         "bandwidth": {
-                                            "$ref": "#/definitions/bandwidth_5_t"
+                                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/bandwidth_5_t"
                                         },
                                         "channel": {
-                                            "$ref": "#/definitions/channel_5_t"
+                                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_5_t"
                                         }
                                     }
                                 },
                                 "properties": {
                                     "ssid": {
-                                        "$ref": "#/definitions/ssid_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/ssid_t"
                                     },
                                     "bssid": {
-                                        "$ref": "#/definitions/macaddr_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/macaddr_t"
                                     },
                                     "encryption": {
                                         "type": "string"
                                     },
                                     "band": {
-                                        "$ref": "#/definitions/band_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/band_t"
                                     },
                                     "rssi": {
-                                        "$ref": "#/definitions/rssi_t"
+                                        "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rssi_t"
                                     },
                                     "load_stas": {
                                         "type": "integer",
@@ -311,31 +210,31 @@
                     ],
                     "properties": {
                         "tx_bytes": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_error_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "tx_dropped_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_bytes": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_error_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_dropped_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         },
                         "rx_fcs_error_packets": {
-                            "$ref": "#/definitions/rxtx_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/rxtx_t"
                         }
                     }
                 }
@@ -377,35 +276,35 @@
                     "then": {
                         "properties": {
                             "bandwidth": {
-                                "$ref": "#/definitions/bandwidth_2_t"
+                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/bandwidth_2_t"
                             },
                             "channel": {
-                                "$ref": "#/definitions/channel_2_t"
+                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_2_t"
                             }
                         }
                     },
                     "else": {
                         "properties": {
                             "bandwidth": {
-                                "$ref": "#/definitions/bandwidth_5_t"
+                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/bandwidth_5_t"
                             },
                             "channel": {
-                                "$ref": "#/definitions/channel_5_t"
+                                "$ref": "https://www.iopsys.eu/definitions.json#/definitions/channel_5_t"
                             }
                         }
                     },
                     "properties": {
                         "radio": {
-                            "$ref": "#/definitions/iface_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/iface_t"
                         },
                         "isup": {
                             "type": "boolean"
                         },
                         "band": {
-                            "$ref": "#/definitions/band_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/band_t"
                         },
                         "noise": {
-                            "$ref": "#/definitions/noisepower_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/noisepower_t"
                         },
                         "rate": {
                             "type": "integer",
diff --git a/ubus/wifi.wps.json b/ubus/wifi.wps.json
index bd9f0ac..9919880 100644
--- a/ubus/wifi.wps.json
+++ b/ubus/wifi.wps.json
@@ -1,18 +1,4 @@
 {
-    "definitions": {
-        "pin_t": {
-            "type": "string",
-            "minLength": 8,
-            "maxLength": 8,
-            "pattern": "^[0-9]*$"
-        },
-        "iface_t": {
-            "title": "Interface",
-            "type": "string",
-            "minLength": 1,
-            "maxLength": 16
-        }
-    },
     "object": "wifi.wps",
     "title": "wifi.wps",
     "$schema": "http://json-schema.org/draft-07/schema#",
@@ -21,6 +7,7 @@
     "properties": {
         "generate_pin": {
             "type": "object",
+            "required": ["output"],
             "properties": {
                 "input": {
                     "type": "object",
@@ -33,7 +20,7 @@
                     ],
                     "properties": {
                         "pin": {
-                            "$ref": "#/definitions/pin_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/pin_t"
                         }
                     }
                 }
@@ -49,10 +36,10 @@
                     ],
                     "properties": {
                         "vif": {
-                            "$ref": "#/definitions/iface_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/iface_t"
                         },
                         "pin": {
-                            "$ref": "#/definitions/pin_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/pin_t"
                         }
                     }
                 },
@@ -67,8 +54,10 @@
             "properties": {
                 "input": {
                     "type": "object",
-                    "vif": {
-                        "$ref": "#/definitions/iface_t"
+                    "properties": {
+                        "vif": {
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/iface_t"
+                        }
                     }
                 },
                 "output": {
@@ -78,7 +67,7 @@
                     ],
                     "properties": {
                         "pin": {
-                            "$ref": "#/definitions/pin_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/pin_t"
                         }
                     }
                 }
@@ -91,16 +80,17 @@
                     "type": "object",
                     "properties": {
                         "vif": {
-                            "$ref": "#/definitions/iface_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/iface_t"
                         },
                         "mode": {
                             "type": "string"
                         },
                         "role": {
-                            "type": "string"
+                            "type": "string",
+                            "enum": ["registrar", "enrollee"]
                         },
                         "pin": {
-                            "$ref": "#/definitions/pin_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/pin_t"
                         }
                     }
                 },
@@ -114,11 +104,10 @@
             "type": "object",
             "properties": {
                 "input": {
-                    "addititionalProperties": false,
                     "type": "object",
                     "properties": {
                         "vif": {
-                            "$ref": "#/definitions/iface_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/iface_t"
                         }
                     }
                 },
@@ -163,7 +152,7 @@
                     ],
                     "properties": {
                         "pin": {
-                            "$ref": "#/definitions/pin_t"
+                            "$ref": "https://www.iopsys.eu/definitions.json#/definitions/pin_t"
                         }
                     }
                 },
@@ -181,4 +170,4 @@
             }
         }
     }
-}
+}
\ No newline at end of file
-- 
GitLab