Validating a JSON file in advance from the command line
HCL Domino comes with a simple command-line tool to use to validate a one-touch setup JSON configuration file.
For a one-touch setup JSON configuration file to be valid, it must contain valid JSON as well as meet the requirements of the one-touch setup schema defined in the file dominoOneTouchSetup.schema.json that ships with Domino.
To validate a one-touch setup JSON configuration file, use the executable file validjson
(for example, on Windows, validjson.exe) that is provided with Domino. To run the tool,
use any of the following options.
Note: Since this tool is a Notes
application, you can run it using the command line from the program directory or run
it from the server console, for example,
load validjson
valid.json
.Validate that the file has valid JSON
Run the following
command:
validjson <fileToValidate>.json
For example:
validjson valid.json
If successful, you'll see the following
message:
Success - valid.json is valid
If there's a JSON syntactical error, you'll see a message such as
this:
Failed - JSON validation - invalid.json
==> Missing a comma or '}' after an object member. at offset 60 ["type": "first"]
Validate that the file has valid JSON and conforms to the default Domino schema
To validate that the file has valid JSON and that it conforms to the default schema
defined in dominoOneTouchSetup.schema.json, use the following
command:
validjson <fileToValidate>.json -default
For
example:
validjson valid.json -default
If successful, you'll see the following
message:
Success - valid.json is valid with respect to schema dominoOneTouchSetup.schema.json
If the JSON is valid but doesn't conform with the default Domino schema, you'll see
messages such as
this:
Failed - JSON validation - nonconforming.json
==> Schema reference: #/properties/serverSetup/properties/server/properties/type
==> Schema keyword: enum
==> Document reference: #/serverSetup/server/type
==> Likely cause: serverSetup/server/type value must be one of the allowed values
Validate that the file has valid JSON and conforms to a user-provided schema
To validate that the file contains valid JSON and conforms to the schema
requirements detailed at https://json-schema.org/specification.html, use the
following command:
validjson <fileToValidate>.json <userProvidedSchema>.json