public static interface Json.Schema
Represents JSON schema - a specific data format that a JSON entity must follow. The idea of a JSON schema is very similar to XML. Its main purpose is validating input.
More information about the various JSON schema specifications can be found at http://json-schema.org. JSON Schema is an IETF draft (v4 currently) and our implementation follows this set of specifications. A JSON schema is specified as a JSON object that contains keywords defined by the specification. Here are a few introductory materials:
Modifier and Type | Method and Description |
---|---|
Json |
toJson()
Return the JSON representation of the schema.
|
Json |
validate(Json document)
Validate a JSON document according to this schema.
|
Json validate(Json document)
Validate a JSON document according to this schema. The validations attempts to
proceed even in the face of errors. The return value is always a Json.object
containing the boolean property ok
. When ok
is true
,
the return object contains nothing else. When it is false
, the return object
contains a property errors
which is an array of error messages for all
detected schema violations.
document
- The input document.{"ok":true}
or {"ok":false, errors:["msg1", "msg2", ...]}
Json toJson()
Return the JSON representation of the schema.
Copyright © 2019 JBoss by Red Hat. All rights reserved.