Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jsonx-org/schema

"JSON Schema Definition" (JSD) language that offers a vocabulary to describe the structure and constraining the contents of JSON documents.
https://github.com/jsonx-org/schema

consumer-driven-contracts enterprise jsd jsdx json json-schema jsonx jsonx-schema schema validation xml xsd

Last synced: 5 days ago
JSON representation

"JSON Schema Definition" (JSD) language that offers a vocabulary to describe the structure and constraining the contents of JSON documents.

Awesome Lists containing this project

README

        

# JSON Schema Definition Language

> **JSON Schema for the enterprise**

[![Build Status](https://github.com/jsonx-org/schema/actions/workflows/test.yml/badge.svg)](https://github.com/jsonx-org/schema/actions/workflows/test.yml)
[![XSD](https://img.shields.io/badge/schema.xsd-v0.5-blue.svg)](http://jsonx.org/schema-0.5.xsd)
[![JSDx](https://img.shields.io/badge/schema.jsdx-v0.5-blue.svg)](http://jsonx.org/schema-0.5.jsdx)
[![JSD](https://img.shields.io/badge/schema.jsd-v0.5-blue.svg)](http://jsonx.org/schema-0.5.jsd)

[![Build Status](https://github.com/jsonx-org/schema/actions/workflows/test.yml/badge.svg)](https://github.com/jsonx-org/schema/actions/workflows/test.yml)
[![XSD](https://img.shields.io/badge/binding.xsd-v0.5-blue.svg)](http://jsonx.org/binding-0.5.xsd)
[![JSDx](https://img.shields.io/badge/binding.jsdx-v0.5-blue.svg)](http://jsonx.org/binding-0.5.jsdx)
[![JSD](https://img.shields.io/badge/binding.jsd-v0.5-blue.svg)](http://jsonx.org/binding-0.5.jsd)

[![Build Status](https://github.com/jsonx-org/schema/actions/workflows/test.yml/badge.svg)](https://github.com/jsonx-org/schema/actions/workflows/test.yml)
[![XSD](https://img.shields.io/badge/include.xsd-v0.5-blue.svg)](http://jsonx.org/include-0.5.xsd)
[![JSDx](https://img.shields.io/badge/include.jsdx-v0.5-blue.svg)](http://jsonx.org/include-0.5.jsdx)
[![JSD](https://img.shields.io/badge/include.jsd-v0.5-blue.svg)](http://jsonx.org/include-0.5.jsd)

[![Build Status](https://img.shields.io/badge/test-passing-orange.svg)](https://github.com/jsonx-org/schema/actions/workflows/test.yml)
[![XSD](https://img.shields.io/badge/schema.xsd-v0.4-orange.svg)](http://jsonx.org/schema-0.4.xsd)
[![JSDx](https://img.shields.io/badge/schema.jsdx-v0.4-orange.svg)](http://jsonx.org/schema-0.4.jsdx)
[![JSD](https://img.shields.io/badge/schema.jsd-v0.4-orange.svg)](http://jsonx.org/schema-0.4.jsd)

[![Build Status](https://img.shields.io/badge/test-passing-orange.svg)](https://github.com/jsonx-org/schema/actions/workflows/test.yml)
[![XSD](https://img.shields.io/badge/schema.xsd-v0.3-orange.svg)](http://jsonx.org/schema-0.3.xsd)
[![JSDx](https://img.shields.io/badge/schema.jsdx-v0.3-orange.svg)](http://jsonx.org/schema-0.3.jsdx)
[![JSD](https://img.shields.io/badge/schema.jsd-v0.3-orange.svg)](http://jsonx.org/schema-0.3.jsd)

[![Build Status](https://img.shields.io/badge/test-passing-yellow.svg)](https://github.com/jsonx-org/schema/actions/workflows/test.yml)
[![XSD](https://img.shields.io/badge/schema.xsd-v0.2-yellow.svg)](http://jsonx.org/schema-0.2.xsd)
[![JSDx](https://img.shields.io/badge/schema.jsdx-v0.2-yellow.svg)](http://jsonx.org/schema-0.2.jsdx)
[![JSD](https://img.shields.io/badge/schema.jsd-v0.2-yellow.svg)](http://jsonx.org/schema-0.2.jsd)

[![Build Status](https://img.shields.io/badge/test-passing-yellow.svg)](https://github.com/jsonx-org/schema/actions/workflows/test.yml)
[![XSD](https://img.shields.io/badge/schema.xsd-v0.1-yellow.svg)](http://jsonx.org/schema-0.1.xsd)
[![JSDx](https://img.shields.io/badge/schema.jsdx-v0.1-inactive.svg)]()
[![JSD](https://img.shields.io/badge/schema.jsd-v0.1-inactive.svg)]()

## Abstract

This document specifies the JSON Schema Definition Language, which allows for the description of the structure and to constrain the contents of JSON documents. The schema language is represented in two different but equally translatable vocabularies: a JSON vocabulary, and an XML vocabulary. The schema language extends the capabilities found in JSON documents.

## Table of Contents

  1 [Introduction](#1-introduction)

    1.1 [Dependencies on Other Specifications](#11-dependencies-on-other-specifications)

    1.2 [Conventions Used in This Document](#12-conventions-used-in-this-document)

  2 [Purpose](#2-purpose)

  3 [Requirements](#3-requirements)

  4 [Specification](#4-specification)

    4.1 [Schema Document][#schema]

    4.2 [Constraint Types][#constraint-types]

       4.2.1 [boolean][#boolean]

       4.2.2 [number][#number]

           4.2.2.1 [number.scale][#number-scale]

           4.2.2.2 [number.range][#number-range]

       4.2.3 [string][#string]

           4.2.3.1 [string.pattern][#string-pattern]

       4.2.4 [object][#object]

           4.2.4.1 [object.properties][#object-properties]

           4.2.4.2 [Property Names][#property-names]

           4.2.4.3 [object.abstract][#object-abstract]

           4.2.4.4 [object.extends][#object-extends]

                4.2.4.4.1 [Type Declarations][#object-type-declarations]

                4.2.4.4.2 [Object Properties][#object-object-properties]

       4.2.5 [array][#array]

           4.2.5.1 [array.elements][#array-array-elements]

           4.2.5.2 [array.minIterate and array.maxIterate][#array-iterate]

       4.2.6 [reference][#reference]

           4.2.6.1 [reference.type][#reference-type]

                4.2.6.1.1 [Object Properties][#reference-object-properties]

                4.2.6.1.2 [Array Elements][#reference-array-elements]

       4.2.7 [any][#any]

           4.2.7.1 [any.types][#any-types]

                4.2.7.1.1 [Object Properties][#any-object-properties]

                4.2.7.1.2 [Array Elements][#any-array-elements]

    4.3 [Type Declarations][#type-declarations]

    4.4 [Object Properties][#object-properties]

    4.5 [Array Elements][#array-elements]

    4.6 [Language specific bindings][#bindings]

       4.6.1 [Type Bindings][#type-bindings]

       4.6.2 [Field Bindings][#field-bindings]

       4.6.3 [Type/Field Bindings][#typefield-bindings]

       4.6.4 [Examples](#464-examples)

  5 [Related Resources for JSON Schema](#5-related-resources-for-json-schema)

    5.1 [Schemas for JSON Schema](#51-schemas-for-json-schema)

       5.1.1 [Development](#511-development)

       5.1.2 [Current](#512-current)

       5.1.3 [Obsolete](#513-obsolete)

  6 [Sample Schemas](#6-sample-schemas)

    6.1 [`structure.jsdx`](#61-structurejsdx)

    6.2 [`structure.jsd`](#62-structurejsd)

    6.3 [`datatype.jsdx`](#63-datatypejsdx)

    6.4 [`datatype.jsd`](#64-datatypejsd)

    6.5 [`binding.jsdx`](#65-bindingjsdx)

    6.6 [`binding.jsd`](#65-bindingjsd)

  7 [Contributing](#7-contributing)

  8 [Special Thanks](#8-special-thanks)

  9 [License](#9-license)

## 1 Introduction

This document sets out the structural part of the JSON Schema Definition Language. It also contains a directory of links to these related resources.

The JSON Schema Definition Language is designed to describe JSON documents by using schema components to constrain and document the meaning, usage and relationships of their constituent parts: value types and their content. Schemas may also provide for the specification of additional document information, such as normalization and defaulting of values. Schemas have facilities for self-documentation. Thus, the JSON Schema Definition Language can be used to define, describe and catalogue JSON vocabularies for JSON documents.

Any application that consumes well-formed JSON can use the JSON Schema Definition Language formalism to express syntactic, structural and value constraints applicable to its document instances. The JSON Schema Definition Language formalism allows a useful level of constraint checking to be described and implemented for a wide spectrum of JSON applications. However, the language defined by this specification does not attempt to provide _all_ the facilities that might be needed by any application. Some applications may require constraint capabilities not expressible in this language, and so may need to perform their own additional validations.

### 1.1 Dependencies on Other Specifications

The definition of the JSON Schema Definition Language depends on the following specifications: [RFC4627][rfc4627], [RFC7159][rfc7159], and [XMLSchema][xmlschema].

### 1.2 Conventions Used in This Document

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119][rfc2119].

## 2 Purpose

Provide a schema language to describe normative contracts between producer and consumer ends of a protocol exchanging JSON documents.

## 3 Requirements

1. The schema language MUST constrain and document the meaning, usage, constraints and relationships of the constituent parts of a JSON document.

1. The schema language MUST provide meaningful and useful constraint rules for the 5 JSON value types: `boolean`, `number`, `string`, `object`, and `array`.

1. The schema language MUST support schema descriptions for any and all legal JSON documents, as specified by [RFC2119][rfc2119].

1. The schema language MUST be free-of and agnostic-to patterns specific to any particular programming language.

1. The schema language MUST be able to describe itself.

## 4 Specification

The JSON Schema Definition Language (JSD) is normatively defined in an XML Schema Document, with translations expressed in the JSON/XML Schema Definition Language (JSDx), as well as the JSON Schema Definition Language (JSD) itself.

The JSDx format offers XML validation, and using an XML IDE like [oXygen XML Editor][oxygenxml] offers edit-time XML validation, such as:

When using the JSDx format with the [oXygen XML Editor][oxygenxml], the auto-completion features of the editor will guide you in writing the schema. With the JSDx format, the XML editor will also validate keys and keyrefs to ensure that declared types are referenced correctly.

The JSD is comprised of 5 structural abstractions:

  4.1 [Schema Document][#schema]

  4.2 [Constraint Types][#constraint-types]

     4.2.1 [boolean][#boolean]

     4.2.2 [number][#number]

         4.2.2.1 [number.scale][#number-scale]

         4.2.2.2 [number.range][#number-range]

     4.2.3 [string][#string]

         4.2.3.1 [string.pattern][#string-pattern]

     4.2.4 [object][#object]

         4.2.4.1 [object.properties][#object-properties]

         4.2.4.2 [Property Names][#property-names]

         4.2.4.3 [object.abstract][#object-abstract]

         4.2.4.4 [object.extends][#object-extends]

              4.2.4.4.1 [Type Declarations][#object-type-declarations]

              4.2.4.4.2 [Object Properties][#object-object-properties]

     4.2.5 [array][#array]

         4.2.5.1 [array.elements][#array-array-elements]

         4.2.5.2 [array.minIterate and array.maxIterate][#array-iterate]

     4.2.6 [reference][#reference]

         4.2.6.1 [reference.type][#reference-type]

              4.2.6.1.1 [Object Properties][#reference-object-properties]

              4.2.6.1.2 [Array Elements][#reference-array-elements]

     4.2.7 [any][#any]

         4.2.7.1 [any.types][#any-types]

              4.2.7.1.1 [Object Properties][#any-object-properties]

              4.2.7.1.2 [Array Elements][#any-array-elements]

  4.3 [Type Declarations][#type-declarations]

  4.4 [Object Properties][#object-properties]

  4.5 [Array Elements][#array-elements]

  4.6 [Language specific bindings][#bindings]

     4.6.1 [Type Bindings][#type-bindings]

     4.6.2 [Field Bindings][#field-bindings]

     4.6.3 [Type/Field Bindings][#typefield-bindings]

     4.6.4 [Examples](#464-examples)

### 4.1 Schema Document

The **schema** is the root object of the JSD, and contains [type][#type-declarations] definitions.

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( **schema** )
 
 
 
 
 
 
 
 
 
 
 
 
 
  | jx:ns
 
 
jx:schemaLocation
 
 
 
jx:targetNamespace
 
 
 
doc
[a-zA-Z_$][-a-zA-Z\\d_$]*
 
  | _Namespace of the JSON Schema._ Required.
  Used by schema processors to determine to which
  version of the JSON Schema the JSD is written.
_Location URL of namespace._ Optional.
  Specified as: `"%NAMESPACE_URI% %LOCATION_URL%"`
  Used by schema processors to determine location of
  schema definition for a namespace.
_Target namespace of schema document._ Optional.
  Specified as: `"%NAMESPACE_URI%"`
  Represents the namespace of elements declared
  within the schema document.
Text comments. Optional.
_[Type Declaration][#type-declarations]_. Optional.
  Root object definitions that are referenceable
  throughout the schema. |

###### **JSD**

```json
{
"jx:ns": "http://www.jsonx.org/schema-0.4.jsd",
"jx:schemaLocation": "http://www.jsonx.org/schema-0.4.jsd http://www.jsonx.org/schema.jsd",
"jx:targetNamespace": "https://www.jsonx.org/example.jsd"
...
}
```

###### **JSDx**

```xml

targetNamespace="https://www.jsonx.org/example.jsdx">
...

```

### 4.2 Constraint Types

The Constraint Types define the constraint properties for the five JSON value types: **boolean**, **number**, **string**, **object**, and **array**. Aditionally, the JSON Schema Definition Language defines two meta Constraint Types named **any** and **reference**.

The JSD has 3 different scopes where Constraint Types can be defined, which provide different sets of their own constraint properties that apply to all Constraint Types:

1. [Type Declarations][#type-declarations].
1. [Object Properties][#object-properties].
1. [Array Elements][#array-elements].

Each Constraint Type supports the `doc` attribute.

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( [**boolean**][#boolean] \| 
  [**number**][#number] \|
  [**string**][#string] \|
  [**object**][#object] \|
  [**array**][#array] \|
  [any][#any] \|
  [reference][#reference] ) | doc
 
 
 
 
 
  | Text comments. Optional.
 
 
 
 
 
  |

###### **JSD**

```json
{ "doc": "Comment for this element",
...
}
```

###### **JSDx**

```xml

...

```

#### 4.2.1 `boolean`

The **boolean** type is used for the boolean values: `true` and `false`.

The **boolean** type does not have validation constraints.

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( **boolean** )
 
  | jx:type
bindings
  | boolean
[Bindings declaration][#bindings]
  Specifies the language specific bindings. |

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "boolean" }
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml

```

Usage for [object properties][#object-properties]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `true` | :white_check_mark: | The value `true`. |
| `false` | :white_check_mark: | The value `false`. |
| `TRUE` | :x: | `TRUE` is not a valid **boolean** type. |
| `FALSE` | :x: | `FALSE` is not a valid **boolean** type. |
| `0` | :x: | `0` is not a valid **boolean** type. |
| `1` | :x: | `1` is not a valid **boolean** type. |
| `"true"` | :x: | Boolean as string. |

#### 4.2.2 `number`

Used for any numeric type, either integers or floating point numbers.

The **number** type defines two constraint properties for **number** JSON value type: scale, and range.

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( **number** )
 
 
 
 
 
 
 
  | jx:type
scale
 
 
range
 
 
bindings
  | number
(0\|1\|2\|...)
  The number of digits to the right of the decimal point.
  **If a value is not specified, the scale is unbounded.**
_Numerical range_
  Specifies the minimum and maximum limits in [interval
notation][interval-notation].
[Bindings declaration][#bindings]
  Specifies the language specific bindings. |

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "number" }
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml

```

Usage for [object properties][#object-properties]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `5` | :white_check_mark: | Integer. |
| `-7.12` | :white_check_mark: | Floating point number. |
| `12.332794E-5` | :white_check_mark: | Exponential notation. |
| `"7"` | :x: | Number as string. |

##### 4.2.2.1 `number.scale`

The `scale` property specifies the maximum number of accepted digits after the decimal point.

A `scale` of `3` represents a number with a maximum of 3 digits after the decimal.
A `scale` of `0` represents an integer.

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "number", "scale": 2 }
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml

```

Usage for [object properties][#object-properties]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `5.12` | :white_check_mark: | Floating point number with 2 digits after the decimal point. |
| `9.2E-1` | :white_check_mark: | Exponential notation representing a number with 2 digits after the decimal point. |
| `-0.1` | :white_check_mark: | Floating point number with 1 digit after the decimal point. |
| `8.123` | :x: | Floating point number with 3 digits after the decimal point. |
| `8.3E-2` | :x: | Exponential notation representing a number with 3 digits after the decimal point. |
| `"7.65"` | :x: | Number as string. |

##### 4.2.2.2 `number.range`

The `range` property specifies the numerical range (min and max) of accepted values in [interval notation][interval-notation].

A `range` of `[0,10]` represents a number between `0` (inclusive) and `10` (inclusive).
A `range` of `(0,10)` represents a number between `0` (exclusive) and `10` (exclusive).
A `range` of `(1.2E1,)` represents a number greater than `1.2E1` (exclusive).
A `range` of `(,-9.8]` represents a number less than `9.8` (inclusive).

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "number", "range": "[-2,7.5)" }
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml

```

Usage for [object properties][#object-properties]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `5.12` | :white_check_mark: | Floating point number between `-2` (inclusive) and `7.5` (exclusive). |
| `0.3E1` | :white_check_mark: | Exponential notation representing a number between `-2` (inclusive) and `7.5` (exclusive). |
| `-2` | :white_check_mark: | Integer between `-2` (inclusive) and `7.5` (exclusive). |
| `7.49999999999` | :white_check_mark: | Floating point number between `-2` (inclusive) and `7.5` (exclusive). |
| `-2.0000000001` | :x: | Floating point number less than `-2` (inclusive). |
| `7.5` | :x: | Floating point number greater than `7.5` (exclusive). |
| `"6.65"` | :x: | Number as string. |

#### 4.2.3 `string`

The **string** type is used for strings of text. It may contain Unicode characters.

The **string** type defines one constraint property for **string** JSON value type: pattern.

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( **string** )
 
 
 
  | jx:type
pattern
 
bindings
  | string
_Regular expression_
  Specifies the regular expression.
[Bindings declaration][#bindings]
  Specifies the language specific bindings. |

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "string" }
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml

```

Usage for [object properties][#object-properties]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `"Déjà vu"` | :white_check_mark: | String with unicode. |
| `"D\u00e9j\u00e0 vu"` | :white_check_mark: | String with escaped unicode. |
| `""` | :white_check_mark: | Empty string. |
| `"42"` | :white_check_mark: | String representing a number. |
| `42` | :x: | A number. |

##### 4.2.3.1 `string.pattern`

The `pattern` property is used to restrict a string to a particular regular expression, as defined in JavaScript ([ECMA 262][ecma262]).

A `pattern` of `^[a-z]+$` represents a string of one or more lowercase latin characters.
A `pattern` of `^.{12}$` represents a string of any 12 characters.
A `pattern` of `^(\(\d{3}\) )?\d{3}-\d{4}$` represents a string matching a US phone number.

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "string", "pattern": "^(\\(\\d{3}\\) )?\\d{3}-\\d{4}$" }
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml

```

Usage for [object properties][#object-properties]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `"(800) 356-9377"` | :white_check_mark: | String with a 10 digit phone number. |
| `"356-9377"` | :white_check_mark: | String with a 7 digit phone number. |
| `"(888) 356-9377 ext. 111"` | :x: | Unmatched "ext. 111". |
| `"(800) FLO-WERS"` | :x: | Phone number with letters. |
| `""` | :x: | Empty string. |

#### 4.2.4 `object`

The **object** type is used for mapping "keys" to "values".

The **object** type defines three constraint properties for **object** JSON value type: abstract, extends, and named properties.

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( **object** )
 
 
 
 
 
 
  | jx:type
properties
 
abstract
 
extends
 
  | object
_[Property declarations][#object-properties]_
  Map of object properties.
(true\|**false**)
  Whether the object is not allowed to be instantiated.
_Name [( [**object**][#object] ) type][#object]_
  Name of root-level object type declaration specifying
  object inheritence. |

_The default **object** is not very useful, because it has no property mappings._

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "object" }
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml

```

Usage for [object properties][#object-properties]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `{}` | :white_check_mark: | An object without properties. |
| `{"foo":"bar"}` | :x: | An object with property "foo" mapping to value "bar". |

##### 4.2.4.1 `object.properties`

The `properties` property specifies a map of accepted properties for the object.

Keys in the `properties` map are considered as regular expressions (for more info, see [Property Names][#property-names]).
Values in the `properties` map are objects specifying accepted [constraint types][#object-properties].

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "object", "properties": {
"foo": { "jx:type": "string", "pattern": "^[a-z]{,3}$", "nullable": true, "use": "optional" } }
}
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml

```

Usage for [object properties][#object-properties]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `{"foo":"bar"}` | :white_check_mark: | An object with property "foo" mapping to value "bar". |
| `{"foo":""}` | :white_check_mark: | An object with property "foo" mapping to empty string. |
| `{}` | :white_check_mark: | An object without properties is ok, because "foo" is optional. |
| `{"foo":null}` | :white_check_mark: | An object with property "foo" mapping to `null` is ok, because "foo" is nullable. |
| `{"foo":false}` | :x: | An object with property "foo" mapping to `false`. |
| `{"other":""}` | :x: | An object with property "other" mapping to empty string. |

##### 4.2.4.2 Property Names

Names of object properties are considered as regular expressions. If an object declaration defines a property with the name "[a-z]+", it means that this name matches any property whose name is one or more alpha characters. This also means that the name "foo" will only match "foo". If an object defines a property with a regular expression name that matches more than 1 string, the object will accept all the matching names (i.e. an object with multiple properties that match a single property definition with a regular expression name will be valid). If, however, there are multiple defined properties with regular expression name patterns that capture the same name, an associated value will be validated against the first matching property definition. The example below shows an **any** property that matches all names. Such a definition of an **object** type will match any object, except for `{}` (because at least one **any** property is required).

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "object", "properties": {
".*": { "jx:type": "any" } }
}
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml

```

Usage for [object properties][#object-properties]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `{"foo":"bar"}` | :white_check_mark: | Any property is valid. |
| `{"foo":"bar","wow":true}` | :white_check_mark: | Any property is valid. |
| `{"foo":"bar","wow":true,"cool":42}` | :white_check_mark: | Any property is valid. |
| `{}` | :x: | At least one **any** property is required. |

##### 4.2.4.3 `object.abstract`

The `abstract` property specifies whether the declared object is allowed to represent a value instance.

If `abstract` is true, a value of the declared type is allowed to exits.
If `abstract` is false, the declared type can only be used as a super-type of another object type declaration specifying the `extends` property that links to the name of the abstract type.
_**The `abstract` property is only allowed to appear on [type declarations][#type-declarations].**_

###### **JSD**

Usage for [type declarations][#type-declarations]:

```json
{ "myAbstractObject":
{ "jx:type": "object", "abstract": true, "properties": {
"foo": { "jx:type": "string", "pattern": "^[a-z]{,3}$", "nullable": true, "use": "optional" } } }
}
```

###### **JSDx**

Usage for [type declarations][#type-declarations]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `{"foo":"bar"}` | :x: | Instances of `myAbstractObject` are not allowed.
Refer to `extends` property below. |

##### 4.2.4.4 `object.extends`

The `extends` property accepts a name of an **object** type declaration, which specifies object inheritence.

The `extends` property can only specify names of **object** [type declarations][#type-declarations].
The `extends` property can specify names of **object** [type declarations][#type-declarations] that are `abstract`, or not.

###### 4.2.4.4.1 Type declarations

###### **JSD**

Usage for [type declarations][#type-declarations]:

```json
{ "myAbstractObject":
{ "jx:type": "object", "abstract": true, "properties": {
"foo": { "jx:type": "string", "pattern": "^[a-z]{,3}$", "nullable": true, "use": "optional" } } },
"myRealObject":
{ "jx:type": "object", "extends": "myAbstractObject", "properties": {
"thisIsCool": { "jx:type": "boolean", "nullable": false } } }
}
```

###### **JSDx**

Usage for [type declarations][#type-declarations]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `{"foo":"bar"}` | :white_check_mark: | An instance of `myRealObject` object with property "foo" mapping to value "bar". |
| `{"foo":"bar","thisIsCool":true}` | :white_check_mark: | An instance of `myRealObject` object with property "foo" mapping to value "bar", and "thisIsCool" to true. |
| `{"foo":""}` | :white_check_mark: | An instance of `myRealObject` object with property "foo" mapping to empty string. |
| `{"thisIsCool":true}` | :white_check_mark: | An instance of `myRealObject` object with property "thisIsCool" mapping to true. |
| `{"thisIsCool":null}` | :x: | The property "thisIsCool" is not nullable. |

###### 4.2.4.4.2 Object Properties

###### **JSD**

Usage for [object properties][#object-properties]:

```json
{ "myAbstractObject":
{ "jx:type": "object", "abstract": true, "properties": {
"foo": { "jx:type": "string", "pattern": "^[a-z]{,3}$", "nullable": true, "use": "optional" } } },
"rootObject":
{ "jx:type": "object", "abstract": true, "properties": {
"myRealObject":
{ "jx:type": "object", "extends": "myAbstractObject", "properties": {
"thisIsCool": { "jx:type": "boolean", "nullable": false } } }
}
```

###### **JSDx**

Usage for [object properties][#object-properties]:

```xml



```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `{"myRealObject": {"foo":"bar"}}` | :white_check_mark: | A `rootObject` object with an instance of `myRealObject` object with property "foo" mapping to value "bar". |
| `{"myRealObject": {"foo":"bar","thisIsCool":true}}` | :white_check_mark: | A `rootObject` object with an instance of `myRealObject` object with property "foo" mapping to value "bar", and "thisIsCool" to true. |
| `{"myRealObject": {"foo":""}}` | :white_check_mark: | A `rootObject` object with an instance of `myRealObject` object with property "foo" mapping to empty string. |
| `{"myRealObject": {"thisIsCool":true}}` | :white_check_mark: | A `rootObject` object with an instance of `myRealObject` object with property "thisIsCool" mapping to true. |
| `{"myRealObject": {"thisIsCool":null}}` | :x: | The property "thisIsCool" is not nullable. |
| `{"thisIsCool":null}` | :x: | The `rootObject` does not declare the "thisIsCool" property. |

#### 4.2.5 `array`

The **array** type is used for ordered member elements.

The **array** type defines three constraint properties for **array** JSON value type: minIterate, maxIterate, and member elements.

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( **array** )
 
 
 
 
 
 
 
  | jx:type
elements
 
minIterate
 
 
maxIterate
 
  | array
\[ [Element declaration][#array-elements] , ...\]
  Array of member element declarations.
(**1**\|2\|...)
  Specifies the minimum inclusive number of iterations of
  child member elements.
(**1**\|2\|...\|unbounded)
  Specifies the maximum inclusive number of iterations of
  child member elements. |

_The default **array** is not very useful, because it has no member elements._

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "array" }
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml

```

Usage for [object properties][#object-properties]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `[]` | :white_check_mark: | An array without member elements. |
| `[null]` | :x: | An array with one `null` element. |

##### 4.2.5.1 `array.elements`

The `elements` property specifies a list of accepted member elements.

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "array", "elements": [
{ "jx:type": "boolean", "minOccurs": "0", "maxOccurs": "1" },
{ "jx:type": "string", "minOccurs": "1", "maxOccurs": "2" } ]
}
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml


```

Usage for [object properties][#object-properties]:

```xml


```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `[true, "hello"]` | :white_check_mark: | An array with one boolean element, and one string element. |
| `["hello"]` | :white_check_mark: | An array with only one string element, since zero boolean elements is allowed. |
| `["hello", "world"]` | :white_check_mark: | An array with only two string elements, since zero boolean elements is allowed. |
| `["hello", "world", "again"]` | :x: | A maximum of 2 string elements is allowed. |
| `[true, "hello", "world"]` | :white_check_mark: | An array with one boolean element and two string elements. |
| `[true, false, "hello"]` | :x: | A maximum of 1 boolean elements is allowed. |
| `[true]` | :x: | A minimum of 1 string elements are required. |
| `["hello", true]` | :x: | The boolean element must precede the string element. |
| `[]` | :x: | At least one string element is required. |

##### 4.2.5.2 `array.minIterate` and `array.maxIterate`

The `minIterate` and `maxIterate` properties specify the cardinality of allowed iterations (repetitions) of the member elements.

By default, both `minIterate` and `maxIterate` are `1`, which allows a single iteration of the specified member elements.
If `minIterate` is `0`, an empty array is valid regardless of the member elements specified.
If `maxIterate` is `n`, the sequence of member elements can repeat `n` times.

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "array", "minIterate": "0", "maxIterate": "2", "elements": [
{ "jx:type": "boolean", "minOccurs": "0", "maxOccurs": "1" },
{ "jx:type": "string", "minOccurs": "1", "maxOccurs": "2" } ]
}
```

###### **JSDx**

Usage for [type declarations][#type-declarations] and [array elements][#array-elements]:

```xml


```

Usage for [object properties][#object-properties]:

```xml


```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `[true, "hello"]` | :white_check_mark: | An array with one boolean element, and one string element. |
| `["hello"]` | :white_check_mark: | An array with only one string element, since zero boolean elements is allowed. |
| `["hello", "world"]` | :white_check_mark: | An array with only two string elements, since zero boolean elements is allowed. |
| `["hello", "world", "again"]` | :white_check_mark: | The 3rd string element satisfies the 2nd iteration. |
| `["hello", "world", "again", "and", "again"]` | :x: | The 5th string element would require 3 iterations, but `maxIterate` is `2`. |
| `[true, "hello", "world", true, "and", "again"]` | :white_check_mark: | An array with two full iterations. |
| `[true, false, "hello"]` | :x: | A maximum of 1 boolean elements is allowed to appear before a required string element. |
| `[true]` | :x: | A minimum of 1 string elements are required. |
| `["hello", true, "world"]` | :white_check_mark: | The boolean element and "world" satisfy the 2nd iteration. |
| `[]` | :white_check_mark: | An empty array is allowed due to `minIterate` set to `0`. |

#### 4.2.6 `reference`

The **reference** type defines one validation constraint: type.

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( **reference** )
 
 
 
  | jx:type
type
 
bindings
  | reference
_Name of [type declaration][#type-declarations]_
  Name of root-level type declaration to reference.
[Bindings declaration][#bindings]
  Specifies the language specific bindings. |

##### 4.2.6.1 `reference.type`

The **reference** type is used to restrict content by specifying a single type declaration reference.

_The **reference** type is only allowed to appear as an object property or an array member._

The `type` property specifies the accepted type declaration.

###### 4.2.6.1.1 Object Properties

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:ns": "http://www.jsonx.org/schema-0.4.jsd",
"myNumber": { "jx:type": "number" },
"myObject": { "jx:type": "object", "properties": {
"numOrStr": { "jx:type": "reference", "type": "myNumber" } } }
}
```

###### **JSDx**

Usage for [object properties][#object-properties]:

```xml




```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `{"numOrStr":5.2}` | :white_check_mark: | A number is allowed. |
| `{"numOrStr":"hello"}` | :x: | A string is not allowed. |
| `{"numOrStr":false}` | :x: | A boolean is not allowed. |
| `{}` | :x: | The `numOrStr` property is required (by default, all properties specify `use=required`). |

###### 4.2.6.1.2 Array Elements

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:ns": "http://www.jsonx.org/schema-0.4.jsd",
"myNumber": { "jx:type": "number" },
"myArray": { "jx:type": "array", "elements": [
{ "jx:type": "reference", "type": "myNumber" } ] }
}
```

###### **JSDx**

Usage for [array elements][#array-elements]:

```xml




```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `[5.2]` | :white_check_mark: | A number is allowed. |
| `["hello"]` | :x: | A string is not allowed. |
| `[false]` | :x: | A boolean is not allowed. |
| `[]` | :x: | The `any` element is required (by default, all [array elements][#array-elements] specify `minOccurs=1`). |
| `[5.2,6,4,2]` | :white_check_mark: | Repeating occurrences of **myNumber** are allowed (by default, all [array elements][#array-elements] specify `maxOccurs=unbounded)`. |

#### 4.2.7 `any`

The **any** type is used to restrict content by specifying a list of accepted [type declarations][#type-declarations], or an empty list for wildcard.
_The **any** type is only allowed to appear as an object property or an array member._

The **any** type defines one validation constraint: types.

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( **any** )
 
  | jx:type
types
  | any
\[ Name of [type declaration][#array-elements] , ...\]
  Array of [type declarations][#type-declarations]. |

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:type": "any" }
```

###### **JSDx**

Usage for [array elements][#array-elements]:

```xml

```

Usage for [object properties][#object-properties]:

```xml

```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `true` | :white_check_mark: | Any constraint type is allowed. |
| `"hello"` | :white_check_mark: | Any constraint type is allowed. |
| `4.53` | :white_check_mark: | Any constraint type is allowed. |
| `{"foo":"bar"}` | :white_check_mark: | Any constraint type is allowed. |
| `[true,"world"]` | :white_check_mark: | Any constraint type is allowed. |
| `[]` | :white_check_mark: | Any constraint type is allowed. |

##### 4.2.7.1 `any.types`

The `types` property specifies accepted [type declarations][#type-declarations].

###### 4.2.7.1.1 Object Properties

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:ns": "http://www.jsonx.org/schema-0.4.jsd",
"myNumber": { "jx:type": "number" },
"myString": { "jx:type": "string" },
"myObject": { "jx:type": "object", "properties": {
"numOrStr": { "jx:type": "any", "types": "myNumber myString" } } }
}
```

###### **JSDx**

Usage for [object properties][#object-properties]:

```xml





```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `{"numOrStr":5.2}` | :white_check_mark: | A number is allowed. |
| `{"numOrStr":"hello"}` | :white_check_mark: | A string is allowed. |
| `{"numOrStr":false}` | :x: | A boolean is not allowed. |
| `{}` | :x: | The `numOrStr` property is required (by default, all properties specify `use=required`). |

###### 4.2.7.1.2 Array Elements

###### **JSD**

Usage for [type declarations][#type-declarations], [object properties][#object-properties], and [array elements][#array-elements]:

```json
{ "jx:ns": "http://www.jsonx.org/schema-0.4.jsd",
"myNumber": { "jx:type": "number" },
"myString": { "jx:type": "string" },
"myArray": { "jx:type": "array", "elements": [
{ "jx:type": "any", "types": "myNumber myString" } ] }
}
```

###### **JSDx**

Usage for [array elements][#array-elements]:

```xml





```

**Examples**

|           Value | Pass | Description                               |
|-:|-|-|
| `[5.2]` | :white_check_mark: | A number is allowed. |
| `["hello"]` | :white_check_mark: | A string is allowed. |
| `[false]` | :x: | A boolean is not allowed. |
| `[]` | :x: | The `any` element is required (by default, all [array elements][#array-elements] specify `minOccurs=1`). |
| `["hello",5.2,"world","foo","bar",6,4,2]` | :white_check_mark: | Repeating occurrences of **myNumber** or **myString** are allowed (by default, all [array elements][#array-elements] specify `maxOccurs=unbounded)`. |

### 4.3 Type Declarations

The declarative **type** objects are immediate children of the [**schema**][#schema] object, and represent type definitions that are referenceable throughout the schema, via [`any.types`](#4271-anytypes), [`object.extends`](#4244-objectextends), [`array.elements.reference`](#42612-array-elements), and [`object.properties.reference`](#42611-object-properties). The **type** objects inherit constraint properties from [**model**][#constraint-types] definitions with the following extensions: (Note that the **any** and **reference** Constraint Types are not available as a declarative **type**s).

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( [**boolean**][#boolean] \|  
  [**number**][#number] \|
  [**string**][#string] \|
  [**object**][#object] \|
  [**array**][#array] \|
  [~~any~~][#any] \|
  [~~reference~~][#reference] ) | name
 
 
 
 
 
  | _Name of declared type_
  Name of type declaration to be used as reference
  throuthout the JSD.
 
 
 
  |

###### **JSD**

```json
{ "jx:ns": "http://www.jsonx.org/schema-0.4.jsd",
...
"rootArray": { "jx:type": "array",
"elements": [...] },
"rootBoolean": { "jx:type": "boolean" },
"rootNumber": { "jx:type": "number" },
"rootString": { "jx:type": "string" },
"rootObject": { "jx:type": "object",
"properties": {...} }
...
}
```

###### **JSDx**

```xml

...

...





...

...

```

### 4.4 Object Properties

The **property** objects define properties for the declarative objects that belong to an **[object][#object]**. The **property** objects inherit constraint properties from [**model**][#constraint-types] definitions with the following extensions:

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( [**boolean**][#boolean] \| 
  [**number**][#number] \|
  [**string**][#string] \|
  [**object**][#object] \|
  [**array**][#array] \|
  [any][#any] \|
  [reference][#reference] ) | use
 
nullable
 
 
 
  | (**required**\|optional)
  Specifies whether the property use is required or optional.
(**true**\|false)
  Specifies whether the property is nullable.
 
 
  |

###### **JSD**

```json
{ "jx:ns": "http://www.jsonx.org/schema-0.4.jsd",
...
"rootObject": { "jx:type": "object",
"properties": {
"propArray": { "jx:type": "array", "nullable": true, "use": "required",
"elements": [...] },
"propBoolean": { "jx:type": "boolean", "nullable": true, "use": "required" },
"propNumber": { "jx:type": "number", "nullable": true, "use": "required" },
"propString": { "jx:type": "string", "nullable": true, "use": "required" },
"propObject": { "jx:type": "object", "nullable": true, "use": "optional",
"properties": {...} },
"propReference": { "jx:type": "reference", "nullable": true, "use": "required", "type": "..." },
".*": { "jx:type": "any", "nullable": true, "use": "optional", "types": "..." }
}
}
...
}
```

###### **JSDx**

```xml

...


...





...




...

```

### 4.5 Array Elements

The **element** objects define properties for the declarative objects that belong to an **[array][#array]**. The **element** objects inherit constraint properties from [constraint type][#constraint-types] definitions with the following extensions:

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( [**boolean**][#boolean] \| 
  [**number**][#number] \|
  [**string**][#string] \|
  [**object**][#object] \|
  [**array**][#array] \|
  [any][#any] \|
  [reference][#reference] )
  | nullable
 
minOccurs
 
 
maxOccurs
 
  | (**true**\|false)
  Specifies whether the property is nullable.
(0\|**1**\|2\|...)
  Specifies the minimum inclusive number of occurrence of
  the member element.
(0\|1\|2\|...\|**unbounded**)
  Specifies the maximum inclusive number of occurrence of
  the member element. |

###### **JSD**

```json
{ "jx:ns": "http://www.jsonx.org/schema-0.4.jsd",
...
"rootArray": {
"jx:type": "array",
"elements": [
{ "jx:type": "boolean", "minOccurs": "1", "maxOccurs": "unbounded", "nullable": true},
{ "jx:type": "number", "minOccurs": "1", "maxOccurs": "unbounded", "nullable": true },
{ "jx:type": "string", "minOccurs": "1", "maxOccurs": "unbounded", "nullable": true },
{ "jx:type": "array", "minOccurs": "1", "maxOccurs": "unbounded", "nullable": true,
"elements": [...] },
{ "jx:type": "reference", "minOccurs": "1", "maxOccurs": "unbounded", "nullable": true, "type": "..." },
{ "jx:type": "any", "minOccurs": "1", "maxOccurs": "unbounded", "nullable": true, "types": "..." }
]
}
...
}
```

###### **JSDx**

```xml

...





...




...

```

### 4.6 Language specific bindings

As of JSON Schema 0.4, language specific bindings allow schema document declarations to bind information pertainig to zero or many target languages.

Bindings enable a schema to provide schema processors with information to bridge between JSON and the application layer in a custom way.

The binding information is comprised of five identifiers that belong to a single `binding` element:

|               | **Property Name**               | **Property Value**                                          |
|:-|:-|:-|
| ( **binding** )
 
 
 
 
 
 
 
 
 
 
  | **lang**
 
type
 
decode
 
 
encode
 
 
field
  | The language for which the binding is directed.
    (i.e. "java", "python", "ruby", "custom").
The language specific "type" to which the declaration
    is to be bound.
The method, constructor, or executable that consumes JSON
    and produces an instance of **type** (if **type** is specified),
    or of the default native type if **type** is not specified).
The method, constructor, or executable that consumes an
    instance of **type** (if **type** is specified), or of the default
    native type (if **type** is not specified), and produces JSON.
The language specific "field" to which the particular
    declaration is to be bound. |

_Note: **lang** has been marked in bold to indicate that it is required property._

There are three types of `binding` objects:

#### 4.6.1 Type Bindings

Type Bindings only allow for the specification of **type**, **decode**, and **encode** properties.

These bindings are allowed on [Type Declarations](#43-type-declarations) and [Array Elements](#45-array-elements)

#### 4.6.2 Field Bindings

Field Bindings only allow for the specification of a **field** property.

These bindings are allowed on [`reference` Types](#426-reference), and [Object Properties of type `object`, `array`, or `any`](#4241-objectproperties).

#### 4.6.3 Type/Field Bindings

Type/Field Bindings only allow for the specification of all properties: **type**, **decode**, **encode**, and **field**.

These bindings are allowed on [Object Properties of type `boolean`, `number`, or `string`](#4241-objectproperties).

#### 4.6.4 Examples

1. [`datatype.jsdx`](#63-datatypejsdx)
1. [`datatype.jsd`](#64-datatypejsd)
1. [`binding.jsdx`](#65-bindingjsdx)
1. [`binding.jsd`](#66-bindingjsd)

## 5 Related Resources for JSON Schema

### 5.1 Schemas for JSON Schema

#### 5.1.1 Development

* JSON Schema 0.5 **[Development]**

* A JSON Schema schema document XSD [schema-0.5.xsd](http://www.jsonx.org/schema-0.5.xsd) for JSON Schema documents. It incorporates an auxiliary XSD, [datatypes-0.9.xsd](http://www.openjax.org/xml/datatypes-0.9.xsd).

* A JSON Schema schema document JSDx [schema-0.5.jsdx](http://www.jsonx.org/schema-0.5.jsdx) for JSON Schema documents.

* A JSON Schema schema document JSD [schema-0.5.jsd](http://www.jsonx.org/schema-0.5.jsd) for JSON Schema documents.

* JSON Binding 0.5 **[Development]**

* A JSON Binding schema document XSD [binding-0.5.xsd](http://www.jsonx.org/binding-0.5.xsd) for JSON Binding documents.

* A JSON Binding schema document JSDx [binding-0.5.jsdx](http://www.jsonx.org/binding-0.5.jsdx) for JSON Binding documents.

* A JSON Binding schema document JSD [binding-0.5.jsd](http://www.jsonx.org/binding-0.5.jsd) for JSON Binding documents.

* JSON Include 0.5 **[Development]**

* A JSON Include schema document XSD [include-0.5.xsd](http://www.jsonx.org/include-0.5.xsd) for JSON Include declarations.

* A JSON Include schema document JSDx [include-0.5.jsdx](http://www.jsonx.org/include-0.5.jsdx) for JSON Include declarations.

* A JSON Include schema document JSD [include-0.5.jsd](http://www.jsonx.org/include-0.5.jsd) for JSON Include declarations.

#### 5.1.2 Current

* JSON Schema 0.4 **[Current]**

* A JSON Schema schema document XSD [schema-0.4.xsd](http://www.jsonx.org/schema-0.4.xsd) for JSON Schema documents. It incorporates an auxiliary XSD, [datatypes-0.9.xsd](http://www.openjax.org/xml/datatypes-0.9.xsd).

* A JSON Schema schema document JSDx [schema-0.4.jsdx](http://www.jsonx.org/schema-0.4.jsdx) for JSON Schema documents.

* A JSON Schema schema document JSD [schema-0.4.jsd](http://www.jsonx.org/schema-0.4.jsd) for JSON Schema documents.

#### 5.1.3 Obsolete

* JSON Schema 0.3 **[Deprecated]**

* A JSON Schema schema document XSD [schema-0.3.xsd](http://www.jsonx.org/schema-0.3.xsd) for JSON Schema documents. It incorporates an auxiliary XSD, [datatypes-0.9.xsd](http://www.openjax.org/xml/datatypes-0.9.xsd).

* A JSON Schema schema document JSDx [schema-0.3.jsdx](http://www.jsonx.org/schema-0.3.jsdx) for JSON Schema documents.

* A JSON Schema schema document JSD [schema-0.3.jsd](http://www.jsonx.org/schema-0.3.jsd) for JSON Schema documents.

* JSON Schema 0.2 **[Deprecated]**

* A JSON Schema schema document XSD [schema-0.2.xsd](http://www.jsonx.org/schema-0.2.xsd) for JSON Schema documents. It incorporates an auxiliary XSD, [datatypes-0.8.xsd]( http://www.openjax.org/xml/datatypes-0.8.xsd).

* A JSON Schema schema document JSDx [schema-0.2.jsdx](http://www.jsonx.org/schema-0.2.jsdx) for JSON Schema documents.

* A JSON Schema schema document JSD [schema-0.2.jsd](http://www.jsonx.org/schema-0.2.jsd) for JSON Schema documents.

* JSON Schema 0.1 **[Deprecated]**

* A JSON Schema schema document XSD [schema-0.1.xsd](http://www.jsonx.org/schema-0.1.xsd) for JSON Schema documents. It incorporates an auxiliary XSD, [datatypes-0.8.xsd](http://www.openjax.org/xml/datatypes-0.8.xsd).

* A JSON Schema schema document JSDx ~~schema-0.1.jsdx~~ for JSON Schema documents.

* A JSON Schema schema document JSD ~~schema-0.1.jsd~~ for JSON Schema documents.

### 6 Sample Schemas

This section provides sample schemas in both `jsdx` and `jsd` representations.

#### 6.1 `structure.jsdx`

```xml























































```

#### 6.2 `structure.jsd`

```json
{
"jx:ns": "http://www.jsonx.org/schema-0.4.jsd",
"jx:schemaLocation": "http://www.jsonx.org/schema-0.4.jsd http://www.jsonx.org/schema.jsd",
"doc": "Schema expressing complex nested structures",
"array": {
"jx:type": "array",
"elements": [{
"jx:type": "boolean"
}, {
"jx:type": "number",
"range": "[-1,1)"
}, {
"jx:type": "string",
"pattern": "pattern"
}, {
"jx:type": "array",
"elements": [{
"jx:type": "boolean"
}, {
"jx:type": "number",
"range": "[-1,1)"
}, {
"jx:type": "string",
"pattern": "pattern"
}, {
"jx:type": "any",
"types": "boolean number string array object"
}]
}, {
"jx:type": "reference",
"type": "object"
}, {
"jx:type": "any",
"types": "boolean number string array object"
}]
},
"boolean": {
"jx:type": "boolean"
},
"number": {
"jx:type": "number",
"range": "[-1,1)"
},
"string": {
"jx:type": "string",
"pattern": "pattern"
},
"object": {
"jx:type": "object",
"properties": {
"array": {
"jx:type": "array",
"elements": [{
"jx:type": "boolean"
}, {
"jx:type": "number",
"range": "[-1,1)"
}, {
"jx:type": "string",
"pattern": "pattern"
}, {
"jx:type": "array",
"elements": [{
"jx:type": "boolean"
}, {
"jx:type": "number",
"range": "[-1,1)"
}, {
"jx:type": "string",
"pattern": "pattern"
}, {
"jx:type": "any",
"types": "boolean number string array object"
}]
}, {
"jx:type": "reference",
"type": "object"
}, {
"jx:type": "any",
"types": "boolean number string array object"
}]
},
"boolean": {
"jx:type": "boolean"
},
"number": {
"jx:type": "number",
"range": "[-1,1)"
},
"string": {
"jx:type": "string",
"pattern": "pattern"
},
"booleanRef": {
"jx:type": "reference",
"type": "boolean"
},
"subObject": {
"jx:type": "object",
"extends": "object",
"use": "optional",
"properties": {
"subBoolean": {
"jx:type": "boolean"
},
"subNumber": {
"jx:type": "number",
"range": "[-1,1)"
},
"subString": {
"jx:type": "string",
"pattern": "pattern"
},
"subBooleanRef": {
"jx:type": "reference",
"type": "boolean"
},
"subArray": {
"jx:type": "array",
"elements": [{
"jx:type": "boolean"
}, {
"jx:type": "number",
"range": "[-1,1)"
}, {
"jx:type": "string",
"pattern": "pattern"
}, {
"jx:type": "array",
"elements": [{
"jx:type": "boolean"
}, {
"jx:type": "number",
"range": "[-1,1)"
}, {
"jx:type": "string",
"pattern": "pattern"
}, {
"jx:type": "any",
"types": "boolean number string array object"
}]
}, {
"jx:type": "reference",
"type": "object"
}, {
"jx:type": "any",
"types": "boolean number string array object"
}]
}
}
},
".*": {
"jx:type": "any",
"types": "boolean number string array object",
"use": "optional"
}
}
}
}
```

#### 6.3 `datatype.jsdx`

```xml































































































































































































































```

#### 6.4 `datatype.jsd`

```json
{
"jx:ns": "http://www.jsonx.org/schema-0.4.jsd",
"jx:schemaLocation": "http://www.jsonx.org/schema-0.4.jsd http://www.jsonx.org/schema-0.4.jsd",
"jx:targetNamespace": "http://www.jsonx.org/generator/test/datatype.jsdx",
"doc": "Schema intended to express full variability of type declarations",
"arrayArr": {
"jx:type": "array",
"doc": "Array of arrays",
"elements": [{
"jx:type": "reference",
"type": "arrayBool",
"maxOccurs": "1",
"doc": "Reference to array of booleans"
}, {
"jx:type": "reference",
"type": "arrayNum",
"maxOccurs": "1",
"doc": "Reference to array of numbers"
}, {
"jx:type": "reference",
"type": "arrayObj",
"maxOccurs": "1",
"doc": "Reference to array of objects"
}, {
"jx:type": "reference",
"type": "arrayObj",
"maxOccurs": "1",
"doc": "Another reference to array of objects"
}, {
"jx:type": "reference",
"type": "arrayStr",
"maxOccurs": "1",
"doc": "Reference to array of strings"
}, {
"jx:type": "reference",
"type": "arrayStr",
"maxOccurs": "1",
"doc": "Another reference to array of strings"
}, {
"jx:type": "any",
"types": "defaultDecimal StringDecimal defaultBoolean StringBoolean",
"minOccurs": "0",
"maxOccurs": "1",
"nullable": false,
"doc": "Any of defaultDecimal, StringDecimal, defaultBoolean, or StringBoolean type"
}]
},
"arrayBool": {
"jx:type": "array",
"doc": "Array of booleans",
"elements": [{
"jx:type": "any",
"maxOccurs": "1",
"nullable": false,
"doc": "Any type"
}, {
"jx:type": "reference",
"type": "primitiveBoolean",
"maxOccurs": "1",
"nullable": false,
"doc": "Not-nullable reference to primitiveBoolean"
}, {
"jx:type": "reference",
"type": "defaultBoolean",
"maxOccurs": "1",
"doc": "Reference to defaultBoolean"
}]
},
"arrayNum": {
"jx:type": "array",
"doc": "Array of numbers",
"elements": [{
"jx:type": "any",
"maxOccurs": "1",
"nullable": false,
"doc": "Any type"
}, {
"jx:type": "reference",
"type": "defaultDecimal",
"maxOccurs": "1",
"doc": "Reference to defaultDecimal"
}, {
"jx:type": "reference",
"type": "byte",
"maxOccurs": "1",
"nullable": false,
"doc": "Reference to byte"
}, {
"jx:type": "reference",
"type": "StringDecimal",
"maxOccurs": "1",
"doc": "Reference to StringDecimal"
}, {
"jx:type": "reference",
"type": "numRange",
"maxOccurs": "1",
"nullable": false,
"doc": "Reference to numRange"
}, {
"jx:type": "reference",
"type": "cachedInteger",
"maxOccurs": "1",
"doc": "Reference to num"
}, {
"jx:type": "reference",
"type": "plainDecimal",
"maxOccurs": "1",
"nullable": false,
"doc": "Reference to plainDecimal"
}, {
"jx:type": "reference",
"type": "cachedPlainDecimal",
"maxOccurs": "1",
"doc": "Reference to plainDecimalRange"
}, {
"jx:type": "reference",
"type": "byte",
"maxOccurs": "1",
"nullable": false,
"doc": "Reference to byte"
}, {
"jx:type": "reference",
"type": "numRange",
"maxOccurs": "1",
"nullable": false,
"doc": "Reference to numRange"
}, {
"jx:type": "reference",
"type": "cachedInteger",
"maxOccurs": "1",
"doc": "Reference to cachedInteger"
}, {
"jx:type": "reference",
"type": "defaultDecimalRange2",
"minOccurs": "0",
"maxOccurs": "1",
"doc": "Reference to plainDecimalRange"
}]
},
"arrayObj": {
"jx:type": "array",
"doc": "Array of object references",
"elements": [{
"jx:type": "reference",
"type": "objArr",
"maxOccurs": "1",
"doc": "Reference to objArr"
}, {
"jx:type": "reference",
"type": "objBool",
"maxOccurs": "1",
"doc": "Reference to objBool"
}, {
"jx:type": "reference",
"type": "objNum",
"maxOccurs": "1",
"doc": "Reference to objNum"
}, {
"jx:type": "reference",
"type": "objObj",
"maxOccurs": "1",
"doc": "Reference to objObj"
}, {
"jx:type": "reference",
"type": "objStr",
"maxOccurs": "1",
"doc": "Reference to objStr"
}]
},
"arrayStr": {
"jx:type": "array",
"doc": "Array of string references",
"elements": [{
"jx:type": "any",
"types": "byte primitiveBoolean",
"maxOccurs": "1",
"nullable": false,
"doc": "Any type with primitive byte and boolean"
}, {
"jx:type": "reference",
"type": "defaultString",
"maxOccurs": "1",
"doc": "Reference to defaultString"
}, {
"jx:type": "reference",
"type": "charArray",
"maxOccurs": "1",
"nullable": false,
"doc": "Not-nullable reference to charArray"
}, {
"jx:type": "reference",
"type": "uuid",
"maxOccurs": "1",
"doc": "Reference to uuid"
}, {
"jx:type": "reference",
"type": "uuid",
"maxOccurs": "1",
"nullable": false,
"doc": "Not-nullable to uuid"
}, {
"jx:type": "reference",
"type": "url",
"maxOccurs": "1",
"doc": "Reference to url"
}, {
"jx:type": "reference",
"type": "url",
"maxOccurs": "1",
"nullable": false,
"doc": "Not-nullable to url"
}, {
"jx:type": "reference",
"type": "StringBigDecimal",
"maxOccurs": "1",
"doc": "Reference to StringBigDecimal"
}, {
"jx:type": "reference",
"type": "StringBigDecimal",
"maxOccurs": "1",
"nullable": false,
"doc": "Not-nullable to StringBigDecimal"
}, {
"jx:type": "reference",
"type": "nonEmptyString",
"maxOccurs": "1",
"doc": "Reference to nonEmptyString"
}, {
"jx:type": "reference",
"type": "nonEmptyString",
"minOccurs": "2",
"maxOccurs": "3",
"nullable": false,
"doc": "Not-nullable to nonEmptyString"
}]
},
"defaultBoolean": {
"jx:type": "boolean",
"doc": "Default boolean"
},
"primitiveBoolean": {
"jx:type": "boolean",
"doc": "Primitive boolean",
"bindings": [{
"lang": "java",
"type": "boolean",
"encode": "java.lang.String.valueOf"
}]
},
"StringBoolean": {
"jx:type": "boolean",
"bindings": [{
"lang": "java",
"type": "java.lang.String",
"decode": "java.lang.String.valueOf"
}]
},
"defaultDecimal": {
"jx:type": "number",
"doc": "Default decimal type"
},
"defaultInteger": {
"jx:type": "number",
"scale": 0,
"doc": "Default integer type"
},
"byte": {
"jx:type": "number",
"scale": 0,
"range": "[-64,63]",
"doc": "Primitive byte type",
"bindings": [{
"lang": "java",
"type": "byte"
}]
},
"Short": {
"jx:type": "number",
"scale": 0,
"range": "[-16384,16383]",
"doc": "Short number type",
"bindings": [{
"lang": "java",
"type": "java.lang.Short"
}]
},
"StringDecimal": {
"jx:type": "number",
"bindings": [{
"lang": "java",
"type": "java.lang.CharSequence"
}]
},
"numRange": {
"jx:type": "number",
"range": "[1E+10,]",
"doc": "Template for number type with range"
},
"cachedInteger": {
"jx:type": "number",
"scale": 0,
"range": "[1,]",
"doc": "Template for integer number type with range",
"bindings": [{
"lang": "java",
"type": "java.math.BigInteger",
"decode": "org.libj.math.BigIntegers.intern"
}]
},
"plainDecimal": {
"jx:type": "number",
"scale": 2,
"doc": "Template cached BigDecimal",
"bindings": [{
"lang": "java",
"type": "java.math.BigDecimal",
"encode": "this.toPlainString"
}]
},
"cachedPlainDecimal": {
"jx:type": "number",
"scale": 3,
"range": "[-2.222E-12,]",
"doc": "First template for real number type with range",
"bindings": [{
"lang": "java",
"type": "java.math.BigInteger",
"decode": "org.libj.math.BigDecimals.intern",
"encode": "this.toPlainString"
}]
},
"defaultDecimalRange2": {
"jx:type": "number",
"scale": 3,
"range": "[-2.222E-12,]",
"doc": "Second template for real number type with range"
},
"defaultString": {
"jx:type": "string",
"doc": "Default string type"
},
"charArray": {
"jx:type": "string",
"doc": "char[] type",
"bindings": [{
"lang": "java",
"type": "char[]",
"decode": "org.libj.lang.Characters.valueOf",
"encode": "java.lang.String."
}]
},
"uuid": {
"jx:type": "string",
"pattern": "[0-9]{8}-[a-f]{4}-[0-9]{4}-[a-f]{4}-[0-9]{12}",
"doc": "UUID pattern with UUID type",
"bindings": [{
"lang": "java",
"type": "java.util.UUID",
"decode": "org.libj.lang.Strings.toUuidOrNull"
}]
},
"url": {
"jx:type": "string",
"pattern": "((https?|ftp)://jsonx.org/[\\w\\d:#@%/;$()~_?'\\+-=\\\\\\.&]+)",
"doc": "URL pattern with URL type",
"bindings": [{
"lang": "java",
"type": "java.net.URL",
"decode": "java.net.URL."
}]
},
"StringBigDecimal": {
"jx:type": "string",
"pattern": "\\d+(\\.\\d+)?([eE][+-]?\\d{1,5})?",
"doc": "An integer with BigDecimal type represented as a string",
"bindings": [{
"lang": "java",
"type": "java.math.BigDecimal",
"decode": "java.math.BigDecimal."
}]
},
"nonEmptyString": {
"jx:type": "string",
"pattern": "(\\S)|(\\S.*\\S)",
"doc": "Non-empty string"
},
"objTest": {
"jx:type": "object",
"doc": "Object with array references",
"properties": {
"anyNumStr": {
"jx:type": "any",
"types": "defaultDecimal charArray",
"use": "optional",
"doc": "Optional property named anyNumStr of type 'defaultDecimal' or 'charArray'"
}
}
},
"objArr": {
"jx:type": "object",
"doc": "Object with array references",
"properties": {
".*": {
"jx:type": "any",
"nullable": false,
"doc": "Property accepting any name and any type",
"bindings": [{
"lang": "java",
"field": "any1"
}]
},
"arrayBool": {
"jx:type": "reference",
"type": "arrayBool",
"doc": "Property with bool array",
"bindings": [{
"lang": "java",
"field": "ab"
}]
},
"arrayBoolOptional": {
"jx:type": "reference",
"type": "arrayBool",
"use": "optional",
"doc": "Optional property with bool array",
"bindings": [{
"lang": "java",
"field": "abO"
}]
},
"arrayBoolOptionalNotNullable": {
"jx:type": "reference",
"type": "arrayBool",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property with bool array",
"bindings": [{
"lang": "java",
"field": "abONN"
}]
},
"arrayNum": {
"jx:type": "reference",
"type": "arrayNum",
"doc": "Property with num array",
"bindings": [{
"lang": "java",
"field": "an"
}]
},
"arrayNumOptional": {
"jx:type": "reference",
"type": "arrayNum",
"use": "optional",
"doc": "Optional property with num array",
"bindings": [{
"lang": "java",
"field": "anO"
}]
},
"arrayNumOptionalNotNullable": {
"jx:type": "reference",
"type": "arrayNum",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property with num array",
"bindings": [{
"lang": "java",
"field": "anONN"
}]
},
"arrayStr": {
"jx:type": "reference",
"type": "arrayStr",
"doc": "Property with str array",
"bindings": [{
"lang": "java",
"field": "as"
}]
},
"arrayStrOptional": {
"jx:type": "reference",
"type": "arrayStr",
"use": "optional",
"doc": "Optional property with str array",
"bindings": [{
"lang": "java",
"field": "asO"
}]
},
"arrayStrOptionalNotNullable": {
"jx:type": "reference",
"type": "arrayStr",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property with str array",
"bindings": [{
"lang": "java",
"field": "asONN"
}]
},
"anyNumStr": {
"jx:type": "any",
"types": "defaultDecimal charArray",
"use": "optional",
"doc": "Optional property named anyNumStr of type 'defaultDecimal' or 'charArray'",
"bindings": [{
"lang": "java",
"field": "any2"
}]
}
}
},
"objBool": {
"jx:type": "object",
"doc": "Object with boolean properties",
"properties": {
"bo+l": {
"jx:type": "reference",
"type": "primitiveBoolean",
"nullable": false,
"doc": "Not-nullable property with name matching a regex of type primitiveBoolean",
"bindings": [{
"lang": "java",
"field": "bool1"
}]
},
".*": {
"jx:type": "any",
"types": "primitiveBoolean defaultDecimal",
"nullable": false,
"doc": "Not-nullable property of any name and of type 'primitiveBoolean' or 'defaultDecimal'",
"bindings": [{
"lang": "java",
"field": "any"
}]
},
"bo+lOptional": {
"jx:type": "reference",
"type": "StringBoolean",
"use": "optional",
"doc": "Optional property with name matching a regex of type StringBoolean",
"bindings": [{
"lang": "java",
"field": "bool2"
}]
},
"boolOptionalNotNullable": {
"jx:type": "reference",
"type": "defaultBoolean",
"use": "optional",
"nullable": false,
"doc": "Not-nullable, optional property with name matching a regex of type defaultBoolean",
"bindings": [{
"lang": "java",
"field": "bool3"
}]
}
}
},
"objNum": {
"jx:type": "object",
"doc": "Object with number properties",
"properties": {
"num.+": {
"jx:type": "reference",
"type": "defaultDecimal",
"doc": "Property with name matching a regex of type defaultDecimal",
"bindings": [{
"lang": "java",
"field": "regexNum"
}]
},
"numRequired": {
"jx:type": "reference",
"type": "defaultDecimal",
"doc": "Required property for defaultDecimal type"
},
"numOptional": {
"jx:type": "reference",
"type": "defaultDecimal",
"use": "optional",
"doc": "Optional property for defaultDecimal type"
},
"numRequiredNotNullable": {
"jx:type": "reference",
"type": "defaultDecimal",
"nullable": false,
"doc": "Required and not-nullable property for defaultDecimal type"
},
"numOptionalNotNullable": {
"jx:type": "reference",
"type": "defaultDecimal",
"use": "optional",
"nullable": false,
"doc": "Optional and not-nullable property for defaultDecimal type"
},
"any": {
"jx:type": "any",
"types": "defaultDecimal charArray",
"nullable": false,
"doc": "Property named 'any' of type 'defaultDecimal or 'charArray'"
},
"numIntRequired": {
"jx:type": "reference",
"type": "Short",
"doc": "Required property referencing type byte"
},
"numIntOptional": {
"jx:type": "reference",
"type": "StringDecimal",
"use": "optional",
"doc": "Optional property referencing type StringDecimal"
},
"numIntRequiredNotNullable": {
"jx:type": "reference",
"type": "byte",
"nullable": false,
"doc": "Required, not-nullable property referencing type byte"
},
"numIntOptionalNotNullable": {
"jx:type": "reference",
"type": "defaultInteger",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property referencing type defaultInteger"
},
"numRangeRequired": {
"jx:type": "reference",
"type": "numRange",
"doc": "Required property referencing type numRange"
},
"numRangeOptional": {
"jx:type": "reference",
"type": "numRange",
"use": "optional",
"doc": "Optional property referencing type numRange"
},
"numRangeRequiredNotNullable": {
"jx:type": "reference",
"type": "numRange",
"nullable": false,
"doc": "Required, not-nullable property referencing type numRange"
},
"numRangeOptionalNotNullable": {
"jx:type": "reference",
"type": "numRange",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property referencing type numRange"
},
"cachedIntegerRequired": {
"jx:type": "reference",
"type": "cachedInteger",
"doc": "Required property referencing type cachedInteger"
},
"cachedIntegerOptional": {
"jx:type": "reference",
"type": "cachedInteger",
"use": "optional",
"doc": "Optional property referencing type cachedInteger"
},
"cachedIntegerRequiredNotNullable": {
"jx:type": "reference",
"type": "cachedInteger",
"nullable": false,
"doc": "Required, not-nullable property referencing type cachedInteger"
},
"cachedIntegerOptionalNotNullable": {
"jx:type": "reference",
"type": "cachedInteger",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property referencing type cachedInteger"
},
"plainDecimalRequired": {
"jx:type": "reference",
"type": "plainDecimal",
"doc": "Required property referencing type plainDecimal"
},
"plainDecimalOptional": {
"jx:type": "reference",
"type": "plainDecimal",
"use": "optional",
"doc": "Optional property referencing type plainDecimal"
},
"plainDecimalRequiredNotNullable": {
"jx:type": "reference",
"type": "plainDecimal",
"nullable": false,
"doc": "Required, not-nullable property referencing type plainDecimal"
},
"plainDecimalOptionalNotNullable": {
"jx:type": "reference",
"type": "plainDecimal",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property referencing type plainDecimal"
},
"plainDecimalRangeRequired": {
"jx:type": "reference",
"type": "cachedPlainDecimal",
"doc": "Required property referencing type cachedPlainDecimal"
},
"plainDecimalRangeOptional": {
"jx:type": "reference",
"type": "defaultDecimalRange2",
"use": "optional",
"doc": "Optional property referencing type defaultDecimalRange2"
},
"plainDecimalRangeRequiredNotNullable": {
"jx:type": "reference",
"type": "defaultDecimalRange2",
"nullable": false,
"doc": "Required, not-nullable property referencing type defaultDecimalRange2"
},
"plainDecimalRangeOptionalNotNullable": {
"jx:type": "reference",
"type": "cachedPlainDecimal",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property referencing type cachedPlainDecimal"
}
}
},
"objObj": {
"jx:type": "object",
"doc": "Object of objects",
"properties": {
"objOptional": {
"jx:type": "reference",
"type": "objBool",
"use": "optional",
"doc": "Optional reference to objBool",
"bindings": [{
"lang": "java",
"field": "obj1"
}]
},
"objOptionalNotNullable": {
"jx:type": "reference",
"type": "objNum",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable reference to objNum",
"bindings": [{
"lang": "java",
"field": "obj2"
}]
},
"objExtends1": {
"jx:type": "object",
"extends": "objObj",
"use": "optional",
"doc": "Nested definition of optional object extending objObj",
"bindings": [{
"lang": "java",
"field": "obj3"
}],
"properties": {
"objExtends2": {
"jx:type": "object",
"extends": "objObj",
"use": "optional",
"doc": "Further nested definition of optional object extending objObj",
"bindings": [{
"lang": "java",
"field": "objX"
}],
"properties": {
"objExtends3": {
"jx:type": "object",
"extends": "objObj",
"use": "optional",
"doc": "Further more nested definition of optional object extending objObj",
"properties": {
"objExtends4": {
"jx:type": "object",
"extends": "objObj",
"use": "optional",
"doc": "And yet further more nested definition of optional object extending objObj",
"bindings": [{
"lang": "java",
"field": "objX"
}],
"properties": {
"defaultDecimal": {
"jx:type": "reference",
"type": "defaultDecimal",
"use": "optional",
"doc": "Optional property named 'defaultDecimal' of type 'defaultDecimal'",
"bindings": [{
"lang": "java",
"field": "objX"
}]
}
}
}
}
}
}
}
}
},
"objExtendsOptional": {
"jx:type": "object",
"extends": "objBool",
"use": "optional",
"doc": "Optional property of nested object definition extending objBool",
"bindings": [{
"lang": "java",
"field": "obj4"
}],
"properties": {
"defaultString": {
"jx:type": "reference",
"type": "defaultString",
"doc": "Optional property named 'defaultString' of type 'defaultString'"
},
"charArray": {
"jx:type": "reference",
"type": "charArray",
"doc": "Optional property named 'charArray' of type 'charArray'"
}
}
},
"objExtendsOptionalNotNullable": {
"jx:type": "object",
"extends": "objBool",
"use": "optional",
"nullable": false,
"bindings": [{
"lang": "java",
"field": "obj5"
}],
"properties": {
"arrayBool": {
"jx:type": "reference",
"type": "arrayBool",
"doc": "Optional property named 'arrayBool' of type 'arrayBool'"
}
}
}
}
},
"objStr": {
"jx:type": "object",
"doc": "Object definition with properties of string types",
"properties": {
"defaultString": {
"jx:type": "reference",
"type": "defaultString",
"doc": "Property referencing 'defaultString' type"
},
"defaultStringOptional": {
"jx:type": "reference",
"type": "defaultString",
"use": "optional",
"doc": "Optional property referencing 'defaultString' type"
},
"defaultStringOptionalNotNullable": {
"jx:type": "reference",
"type": "defaultString",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property referencing 'defaultString' type"
},
"charArray": {
"jx:type": "reference",
"type": "charArray",
"doc": "Property referencing 'charArray' type"
},
"charArrayOptional": {
"jx:type": "reference",
"type": "charArray",
"use": "optional",
"doc": "Optional property referencing 'charArray' type"
},
"charArrayOptionalNotNullable": {
"jx:type": "reference",
"type": "charArray",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property referencing 'charArray' type"
},
"uuid": {
"jx:type": "reference",
"type": "uuid",
"doc": "Property referencing 'uuid' type"
},
"uuidOptional": {
"jx:type": "reference",
"type": "uuid",
"use": "optional",
"doc": "Optional property referencing 'uuid' type"
},
"uuidOptionalNotNullable": {
"jx:type": "reference",
"type": "uuid",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property referencing 'uuid' type"
},
"url": {
"jx:type": "reference",
"type": "url",
"doc": "Property referencing 'url' type"
},
"urlOptional": {
"jx:type": "reference",
"type": "url",
"use": "optional",
"doc": "Optional property referencing 'url' type"
},
"urlOptionalNotNullable": {
"jx:type": "reference",
"type": "url",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property referencing 'url' type"
},
"StringBigDecimal": {
"jx:type": "reference",
"type": "StringBigDecimal",
"doc": "Property referencing 'StringBigDecimal' type"
},
"StringBigDecimalOptional": {
"jx:type": "reference",
"type": "StringBigDecimal",
"use": "optional",
"doc": "Optional property referencing 'StringBigDecimal' type"
},
"StringBigDecimalOptionalNotNullable": {
"jx:type": "reference",
"type": "StringBigDecimal",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property referencing 'StringBigDecimal' type"
},
"nonEmptyString": {
"jx:type": "reference",
"type": "nonEmptyString",
"doc": "Property referencing 'nonEmptyString' type"
},
"nonEmptyStringOptional": {
"jx:type": "reference",
"type": "nonEmptyString",
"use": "optional",
"doc": "Optional property referencing 'nonEmptyString' type"
},
"nonEmptyStringOptionalNotNullable": {
"jx:type": "reference",
"type": "nonEmptyString",
"use": "optional",
"nullable": false,
"doc": "Optional, not-nullable property referencing 'nonEmptyString' type"
}
}
}
}
```

#### 6.5 `binding.jsdx`

```xml


























































































```

#### 6.6 `binding.jsd`

```json
{
"jx:ns": "http://www.jsonx.org/schema-0.4.jsd",
"jx:schemaLocation": "http://www.jsonx.org/schema-0.4.jsd http://www.jsonx.org/schema-0.4.jsd",
"doc": "Schema focusing on bindings",
"StringBoolean": {
"jx:type": "boolean",
"bindings": [{
"lang": "java",
"type": "java.lang.String"
}]
},
"short": {
"jx:type": "number",
"scale": 0,
"range": "[-32768,32767]",
"bindings": [{
"lang": "java",
"type": "short"
}]
},
"StringDecimal": {
"jx:type": "number",
"bindings": [{
"lang": "java",
"type": "java.lang.StringBuilder",
"decode": "java.lang.StringBuilder."
}]
},
"uuid": {
"jx:type": "string",
"bindings": [{
"lang": "java",
"type": "java.util.UUID",
"decode": "org.libj.lang.Strings.toUuidOrNull"
}]
},
"arrayReferences": {
"jx:type": "array",
"elements": [{
"jx:type": "reference",
"type": "StringBoolean"
}, {
"jx:type": "reference",
"type": "short",
"nullable": false
}, {
"jx:type": "reference",
"type": "StringDecimal"
}, {
"jx:type": "reference",
"type": "uuid"
}]
},
"arrayDirect": {
"jx:type": "array",
"elements": [{
"jx:type": "boolean",
"bindings": [{
"lang": "java",
"type": "java.lang.String"
}]
}, {
"jx:type": "number",
"scale": 0,
"nullable": false,
"bindings": [{
"lang": "java",
"type": "short"
}]
}, {
"jx:type": "number",
"bindings": [{
"lang": "java",
"type": "java.lang.StringBuilder",
"decode": "java.lang.StringBuilder."
}]
}, {
"jx:type": "string",
"bindings": [{
"lang": "java",
"type": "java.util.UUID",
"decode": "org.libj.lang.Strings.toUuidOrNull"
}]
}]
},
"objRefs": {
"jx:type": "object",
"properties": {
"arrayDirect": {
"jx:type": "reference",
"type": "arrayDirect",
"bindings": [{
"lang": "java",
"field": "objRefArrayDirect"
}]
},
"arrayReferences": {
"jx:type": "reference",
"type": "arrayReferences",
"bindings": [{
"lang": "java",
"field": "objRefArrayReferences"
}]
},
"StringBoolean": {
"jx:type": "reference",
"type": "StringBoolean",
"bindings": [{
"lang": "java",
"field": "objRefStringBoolean"
}]
},
"short": {
"jx:type": "reference",
"type": "short",
"nullable": false,
"bindings": [{
"lang": "java",
"field": "objRefShortPrimitive"
}]
},
"StringDecimal": {
"jx:type": "reference",
"type": "StringDecimal",
"bindings": [{
"lang": "java",
"field": "objRefStringDecimal"
}]
},
"uuid": {
"jx:type": "reference",
"type": "uuid",
"bindings": [{
"lang": "java",
"field": "objRefUuid"
}]
},
"object": {
"jx:type": "reference",
"type": "objRefs",
"bindings": [{
"lang": "java",
"field": "objRefObject"
}]
}
}
},
"objDir": {
"jx:type": "object",
"properties": {
"arrayDirect": {
"jx:type": "array",
"bindings": [{
"lang": "java",
"field": "objDirArrayDirect"
}],
"elements": [{
"jx:type": "boolean",
"bindings": [{
"lang": "java",
"type": "java.lang.String"
}]
}, {
"jx:type": "number",
"scale": 0,
"nullable": false,
"bindings": [{
"lang": "java",
"type": "short"
}]
}, {
"jx:type": "number",
"bindings": [{
"lang": "java",
"type": "java.lang.StringBuilder",
"decode": "java.lang.StringBuilder."
}]
}, {
"jx:type": "string",
"bindings": [{
"lang": "java",
"type": "java.util.UUID",
"decode": "org.libj.lang.Strings.toUuidOrNull"
}]
}]
},
"arrayReferences": {
"jx:type": "array",
"bindings": [{
"lang": "java",
"field": "objDirArrayReferences"
}],
"elements": [{
"jx:type": "reference",
"type": "arrayDirect"
}, {
"jx:type": "reference",
"type": "arrayReferences"
}, {
"jx:type": "reference",
"type": "StringBoolean"
}, {
"jx:type": "reference",
"type": "short",
"nullable": false
}, {
"jx:type": "reference",
"type": "StringDecimal"
}, {
"jx:type": "reference",
"type": "uuid"
}]
},
"StringBoolean": {
"jx:type": "boolean",
"bindings": [{
"lang": "java",
"type": "java.lang.String",
"field": "objDirStringBoolean"
}]
},
"short": {
"jx:type": "number",
"scale": 0,
"nullable": false,
"bindings": [{
"lang": "java",
"type": "short",
"field": "objDirShortPrimitive"
}]
},
"StringDecimal": {
"jx:type": "number",
"bindings": [{
"lang": "java",
"type": "java.lang.StringBuilder",
"field": "objDirStringDecimal",
"decode": "java.lang.StringBuilder."
}]
},
"uuid": {
"jx:type": "string",
"bindings": [{
"lang": "java",
"type": "java.util.UUID",
"field": "objDirUuid",
"decode": "org.libj.lang.Strings.toUuidOrNull"
}]
},
"object": {
"jx:type": "object",
"extends": "objDir",
"bindings": [{
"lang": "java",
"field": "objDirObject"
}]
}
}
}
}
```

## 7 Contributing

Pull requests are welcome. For major changes, please [open an issue](../../../issues) first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## 8 Special Thanks

[![Java Profiler](https://www.ej-technologies.com/images/product_banners/jprofiler_small.png)](https://www.ej-technologies.com/products/jprofiler/overview.html)

_Special thanks to [EJ Technologies](https://www.ej-technologies.com/) for providing their award winning Java Profiler ([JProfiler](https://www.ej-technologies.com/products/jprofiler/overview.html)) for development of the JSONx Framework._

## 9 License

This project is licensed under the MIT License - see the [LICENSE.txt](LICENSE.txt) file for details.

[#schema]: #41-schema-document
[#constraint-types]: #42-constraint-types
[#boolean]: #421-boolean
[#number]: #422-number
[#number-scale]: #4221-numberscale
[#number-range]: #4222-numberrange
[#string]: #423-string
[#string-pattern]: #4231-stringpattern
[#object]: #424-object
[#object-properties]: #4241-objectproperties
[#property-names]: #4242-property-names
[#object-abstract]: #4243-objectabstract
[#object-extends]: #4244-objectextends
[#object-type-declarations]: #42441-type-declarations
[#object-object-properties]: #42442-object-properties
[#array]: #425-array
[#array-array-elements]: #4251-arrayelements
[#array-iterate]: #4252-arrayminiterate-and-arraymaxiterate
[#reference]: #426-reference
[#reference-type]: #4261-referencetype
[#reference-object-properties]: #42611-object-properties
[#reference-array-elements]: #42612-array-elements
[#any]: #427-any
[#any-types]: #4271-anytypes
[#any-object-properties]: #42711-object-properties
[#any-array-elements]: #42712-array-elements
[#type-declarations]: #43-type-declarations
[#object-properties]: #44-object-properties
[#array-elements]: #45-array-elements
[#bindings]: #46-language-specific-bindings
[#type-bindings]: #461-type-bindings
[#field-bindings]: #462-field-bindings
[#typefield-bindings]: #463-typefield-bindings

[ecma262]: http://www.ecma-international.org/publications/standards/Ecma-262.htm
[interval-notation]: https://en.wikipedia.org/wiki/Interval_(mathematics)#Classification_of_intervals
[oxygenxml]: https://www.oxygenxml.com/xml_editor/download_oxygenxml_editor.html
[rfc2119]: https://www.ietf.org/rfc/rfc2119.txt
[rfc4627]: https://www.ietf.org/rfc/rfc4627.txt
[rfc7159]: https://www.ietf.org/rfc/rfc7159.txt
[xmlschema]: http://www.w3.org/2001/XMLSchema