soljsonvalidate(1) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

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 with the '$schema' attribute will be validated against
       that  schema. No schemas are loaded from the default path if the -n op‐
       tion is specified.


       All paths passed to soljsonvalidate are examined. Directories  are  re‐
       cursively examined and symbolic links traversed. Any ordinary files are
       queued  for  validation if they match a pattern specified by the -i op‐
       tion. The default  pattern  used  if  no  -i  option  is  specified  is
       '*.json'.


       If  no  paths  are specified, soljsonvalidate will attempt to read JSON
       data 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 objects 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 ex‐
       plicitly 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:


         % 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



       In the actual command output, each error would be  on  a  single  line,
       without the line breaks shown here.

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)

HISTORY
       The soljsonvalidate command was introduced in Oracle Solaris 11.4.0.

Oracle Solaris 11.4               29 Nov 2022               soljsonvalidate(1)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3