Currently the logic to check if a parameter / node is required is done in the python part of the commands, if this was included in the schema definition instead it would allow for much easer development of tooling that can integrate with HTTP API, or via ssh.
For example if the checks to see if port was moved from the bcast_relay.py into the bcast-relay.xml.in it would mean that those that create tooling could more easily include those requirements without relying onthe API to respond with an error, or digging into the source code to understand how the API will behave.
I tried working on a terraform provider based on the schemas, but this issue combined with how the API did not always give the full error message back (missing the reason for the error) made it difficult to continue as the user would not understand why something went wrong as shown below:
cli:
[email protected]# set service broadcast-relay id 33 description "test" [edit] [email protected]# commit Port number mandatory for udp broadcast relay "33" [[service broadcast-relay]] failed Commit failed [edit]
api:
[email protected]:~$ curl -k --location --request POST 'https://localhost/configure' --form data='{"op": "set", "path": ["service", "broadcast-relay", "id", "33", "description", "test"]}' --form key='KEY' {"success": false, "error": "[[service broadcast-relay]] failed\nCommit failed\n", "data": null}