From 6f732cb16d988c57832aa6b5ab4db48ce7d69c66 Mon Sep 17 00:00:00 2001 From: Cristian Recoseanu Date: Wed, 4 Dec 2024 11:28:35 +0000 Subject: [PATCH] The smallest number of schema changes required to support transports extensibility --- APIs/schemas/constraints-schema.json | 15 ++++++++++++- APIs/schemas/receiver_transport_params.json | 20 +++++++++++++++++- APIs/schemas/sender_transport_params.json | 20 +++++++++++++++++- .../transporttype-response-schema.json | 21 +++++++++++++------ 4 files changed, 67 insertions(+), 9 deletions(-) diff --git a/APIs/schemas/constraints-schema.json b/APIs/schemas/constraints-schema.json index d43a11db..dfaa521d 100644 --- a/APIs/schemas/constraints-schema.json +++ b/APIs/schemas/constraints-schema.json @@ -2,7 +2,8 @@ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Used to express the dynamic constraints on transport parameters. These constraints may be set and changed at run time. Parameters must also conform with constraints inferred from the specification. Every transport parameter must have an entry, even if it is only an empty object.", "title": "Constraints", - "anyOf": [{ + "anyOf": [ + { "type": "array", "items": { "$ref": "constraints-schema-rtp.json" @@ -19,6 +20,18 @@ "items": { "$ref": "constraints-schema-mqtt.json" } + }, + { + "type": "array", + "items": { + "description": "Any other definition for transports registered in the parameter register", + "type": "object", + "patternProperties": { + "^[a-zA-Z0-9_]+$": { + "$ref": "constraint-schema.json#/definitions/constraint" + } + } + } } ] } diff --git a/APIs/schemas/receiver_transport_params.json b/APIs/schemas/receiver_transport_params.json index 3656ead3..ebbef4b7 100644 --- a/APIs/schemas/receiver_transport_params.json +++ b/APIs/schemas/receiver_transport_params.json @@ -2,7 +2,8 @@ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Transport-specific parameters. If this parameter is included in a client request it must include the same number of array elements (or 'legs') as specified in the constraints. If no changes are required to a specific leg it must be included as an empty object ({}).", "title": "Receiver Transport Parameters", - "anyOf": [{ + "anyOf": [ + { "type": "array", "items": { "$ref": "receiver_transport_params_rtp.json" @@ -25,6 +26,23 @@ "items": { "$ref": "receiver_transport_params_mqtt.json" } + }, + { + "type": "array", + "items": { + "description": "Any other definition for transports registered in the parameter register", + "type": "object", + "patternProperties": { + "^[a-zA-Z0-9_]+$": { + "type": [ + "string", + "boolean", + "null", + "number" + ] + } + } + } } ] } diff --git a/APIs/schemas/sender_transport_params.json b/APIs/schemas/sender_transport_params.json index 226ba4b5..dc993cd8 100644 --- a/APIs/schemas/sender_transport_params.json +++ b/APIs/schemas/sender_transport_params.json @@ -2,7 +2,8 @@ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Transport-specific parameters. If this parameter is included in a client request it must include the same number of array elements (or 'legs') as specified in the constraints. If no changes are required to a specific leg it must be included as an empty object ({}).", "title": "Sender Transport Parameters", - "anyOf": [{ + "anyOf": [ + { "type": "array", "items": { "$ref": "sender_transport_params_rtp.json" @@ -25,6 +26,23 @@ "items": { "$ref": "sender_transport_params_mqtt.json" } + }, + { + "type": "array", + "items": { + "description": "Any other definition for transports registered in the parameter register", + "type": "object", + "patternProperties": { + "^[a-zA-Z0-9_]+$": { + "type": [ + "string", + "boolean", + "null", + "number" + ] + } + } + } } ] } diff --git a/APIs/schemas/transporttype-response-schema.json b/APIs/schemas/transporttype-response-schema.json index 77ce38fd..9c6cd364 100644 --- a/APIs/schemas/transporttype-response-schema.json +++ b/APIs/schemas/transporttype-response-schema.json @@ -3,14 +3,23 @@ "title": "Transport Type", "description": "Transport type URN base used by the Sender or Receiver (i.e. with any subclassifications or versions removed)", "type": "string", - "oneOf": [ + "anyOf": [ { - "enum": [ - "urn:x-nmos:transport:rtp", - "urn:x-nmos:transport:dash", - "urn:x-nmos:transport:websocket", - "urn:x-nmos:transport:mqtt" + "oneOf": [ + { + "enum": [ + "urn:x-nmos:transport:rtp", + "urn:x-nmos:transport:dash", + "urn:x-nmos:transport:websocket", + "urn:x-nmos:transport:mqtt" + ] + } ] + }, + { + "description": "Any transport registered in the parameter register", + "type": "string", + "pattern": "^urn:x-nmos:transport:[a-zA-Z0-9_]+$" } ], "format": "uri"