svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
soljsonvalidate(1)
soljsonvalidate(1) User Commands soljsonvalidate(1)
NAME
soljsonvalidate - validate json against json schema files
SYNOPSIS
/usr/bin/soljsonvalidate [-nv] [-i pattern] [path] ...
DESCRIPTION
The soljsonvalidate command loads JSON schema files and validates JSON
files against those schemas.
By default, soljsonvalidate loads all schemas reachable through descent
from /usr/share/lib/json/soljsonvalidate. Any schema therein will iden‐
tify itself w/ the 'id' tag. Any JSON files claiming adherence to one
of those schemas (w/ the '$schema' attribute) will be validated against
that schema. No schemas are loaded from the default path if -n option
is specified.
All paths passed to soljsonvalidate are examined. Directories are
recursively examined and symbolic links traversed. Any ordinary files
are queued for validation if they match a pattern specified by the -i
option. The default pattern used if no -i option is specified is
'*.json'.
If no paths are specified, soljsonvalidate will attempt to read JSON
file from stdin and validate that.
All matching JSON files are opened and checked for JSON syntax errors.
No validation is performed if syntax errors are found. Once loaded, all
JSON files are validated and any new schemas found are validated
against the built-in base schema.
By default, if no errors occur soljsonvalidate runs silently and exits
with a 0 error code. If errors occur, appropriate error messages are
printed. If the -v option is specified, soljsonvalidate prints a line
for each json object successfully validated in addition to any error
messages generated by json object failing validation.
Note that "/usr/bin/soljsonvalidate <path>
..." is equivalent to "/usr/bin/soljsonvalidate -n
/usr/share/lib/json/soljsonvalidate <path>
..".
The output of this command, both for errors and with the -v option, is
intended for human use and the format of the resulting messages is
explicitly subject to change.
OPTIONS
The following options are supported:
-n Does not load /usr/share/lib/json/soljsonvalidate as the
first item on the path.
-v Prints messages for successful validations.
-i pattern Specifies an alternate file matching pattern as described
in the fnmatch(7) man page.
EXIT STATUS
0 All JSON files were loaded and validated successfully.
1 One or more errors occurred.
EXAMPLES
Example 1 Validating a JSON File
Below is a sample JSON file, 'solaris.json':
[{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "solaris-machine",
"description": "machines on which Solaris runs",
"type": "object",
"properties": {
"architecture": {
"description": "machine CPU architecture",
"enum": ["SPARC", "x86"]
},
"number-of-sockets": {
"type": "integer",
"minimum": 1
}
}
},
{
"$schema": "solaris-machine",
"id": "M6-32",
"architecture": "SPARC",
"number-of-sockets": 32
},
{
"$schema": "solaris-machine",
"id": "not-so-far",
"architecture": "ARM",
"number-of-sockets": 1
},
{
"$schema": "solaris-machine",
"id": "missing-something-important",
"architecture": "SPARC",
"number-of-sockets": 0
}
]
When this file is validated by using the soljsonvalidate command, it
displays the following two error messages:
bash: soljsonvalidate -n solaris.json
solaris.json: validation error: key 'architecture' does not have value ('"ARM"') contained in enum ["SPARC", "x86"]
solaris.json: validation error: key 'number-of-sockets' is 0.000000, less than minimum value 1.000000
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Availabilitypkg:/developer/base-developer-utilities _
Interface StabilityT{ name, options, and exit codes: evolving messages:
volatile T}
SEE ALSO
soljsonfmt(1)
Oracle Solaris 11.4 18 Nov 2016 soljsonvalidate(1)