...
Table of Contents maxLevel 3
Schema declaration
A schema is represented in JSON by one of:
- A JSON string, naming a defined type.
- A JSON object, of the form:
{"type": "typeName" ...attributes...}
, wheretypeName
is either a primitive or a derived type name, as defined below. - A JSON array, representing a union of embedded types.
A WSO2 ESB Data Mapper schema should start with the $schema
attribute with the WSO2 Data Mapper schema version. For example: { “$schema”:”http://wso2-data-mapper-json-schema/1.0v”}
Also, it can contain following optional attributes that will define more information about the schema.
- “id”: a JSON string declaring a unique identifier for the schema.
- “title”: a JSON string defining the root element name.
- “description”: a JSON string providing a detailed description about the schema.
- “type”: a JSON string providing the element type.
- “namespaces”: a JSON array of JSON objects defining namespaces and prefix values used in the schema as shown in the following example.
Code Block | ||
---|---|---|
| ||
{ “$schema” : ”http://wso2-data-mapper-json-schema/1.0v”, “id”:”http://wso2-data-mapper-json-schema-sample-o1”, “title”:”RootElement”, "type":"object", “description”:”This schema represent any form of object without any restriction” , "namespaces":[ { "prefix":"ns1", "url":"http://ns1.com"}, {"prefix":"ns2", "url":"http://ns2.com"}] } |