Open mattias-p opened 3 years ago
The central idea behind this proposal is to make zmb able to make any JSON request remove any specific knowledge from zmb about the particulars of the RPCAPI.
zmb [OPTION ...] METHOD [NAME=VALUE ...]
zmb --paramstype=omitted [OPTION ...] METHOD
OPTION
One of:
--help
--verbose
--server URL
The server to query.
Accepts a URL. Default: "http://localhost:5000/".
--paramstype PARAMSTYPE
The JSON value type to use for the JSON-RPC request "method" member.
Accepts either "object" or "omitted". Default: "object".
METHOD
Used as a string argument for the "method" member of the JSON-RPC request.
Accepts any string.
NAME
The name in a name/value pair in the JSON-RPC request "params" object.
Accepts any string that contains neither `"` nor `=`.
All names in a given call must be unique.
VALUE
The value in a name/value pair in the JSON-RPC request "params" object.
Accepts any JSON value.
Here are valid commands for calling job_create with domain arguments of each JSON value type. (The resulting JSON-RPC calls are not necessarily valid though, but that's the point.)
zmb job_create domain=null
zmb job_create domain=false
zmb job_create domain=true
zmb job_create domain=1
zmb job_create domain='[1,2]'
zmb job_create domain='{"foo":true}'
zmb job_create domain='"zonemaster.net"'
The following command should print a validation error and terminate without making an RPCAPI call. Because "zonemaster.net"
is valid JSON but zonemaster.net
isn't.
zmb job_create domain=zonemaster.net
"
. Such arguments could be used for escaping by interpreting them as JSON strings.--methodtype METHODTYPE
parameter, letting METHODTYPE accept just the two values "string" (default) and "json". This would allow users to make calls with any JSON value type in the JSON-RPC request "method" member."
without any special interpretation. This is a simplification in the short term but if we ever want the possibility to escape =
we'd have to make a breaking change.
Out of these options the only one we should consider before merging is IMHO number 1.The normal test should be simple to run. The special test, e.g. null domain, could be more complicated. We need zmb
for Zonemaster. What you suggest is another tool.
Instead of changing zmb
, create a new tool within or outside Zonemaster-Backend. Then both tools could be available.
I prefer zmb
as-is.
Can't you use zmtest
to start a test?
Can't you use
zmtest
to start a test?
I could, but there are other operations to do, e.g. start a batch or fetch a result of previous test, that zmtest
does not support.
Sure we can repurpose zmb to be a use-case-level tool and add a separate protocol-level tool.
That sounds fine.
The current design of the command line parameters of zmb is not great. Some effort has been made to strike a balance between 1) flexibility in generating invalid requests and 2) convenience in generating valid requests, but the resulting interface leaves a lot to be desired.
Requirements: