Skip to content

Commit

Permalink
[WSO2-Release] [Release 5.0.3] update documentation for release 5.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wso2-jenkins-bot committed May 27, 2019
1 parent 25439f5 commit 2aafe75
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 7 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Find some useful links below:

## Latest API Docs

Latest API Docs is <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.2">5.0.2</a>.
Latest API Docs is <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.3">5.0.3</a>.

## How to use

Expand Down Expand Up @@ -48,8 +48,8 @@ extension you can replace the component <a target="_blank" href="https://github

## Features

* <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.2/#json-sink-mapper">json</a> *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#sink-mapper">(Sink Mapper)</a>*<br><div style="padding-left: 1em;"><p>This extension is an Event to JSON output mapper. <br>Transports that publish messages can utilize this extension to convert Siddhi events to JSON messages. <br>You can either send a pre-defined JSON format or a custom JSON message.<br></p></div>
* <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.2/#json-source-mapper">json</a> *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#source-mapper">(Source Mapper)</a>*<br><div style="padding-left: 1em;"><p>This extension is a JSON-to-Event input mapper. Transports that accept JSON messages can utilize this extension to convert an incoming JSON message into a Siddhi event. Users can either send a pre-defined JSON format, where event conversion happens without any configurations, or use the JSON path to map from a custom JSON message.<br>In default mapping, the JSON string of the event can be enclosed by the element "event", though optional.</p></div>
* <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.3/#json-sink-mapper">json</a> *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#sink-mapper">(Sink Mapper)</a>*<br><div style="padding-left: 1em;"><p>This extension is an Event to JSON output mapper. <br>Transports that publish messages can utilize this extension to convert Siddhi events to JSON messages. <br>You can either send a pre-defined JSON format or a custom JSON message.<br></p></div>
* <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.3/#json-source-mapper">json</a> *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#source-mapper">(Source Mapper)</a>*<br><div style="padding-left: 1em;"><p>This extension is a JSON-to-Event input mapper. Transports that accept JSON messages can utilize this extension to convert an incoming JSON message into a Siddhi event. Users can either send a pre-defined JSON format, where event conversion happens without any configurations, or use the JSON path to map from a custom JSON message.<br>In default mapping, the JSON string of the event can be enclosed by the element "event", though optional.</p></div>

## How to Contribute

Expand Down
127 changes: 127 additions & 0 deletions docs/api/5.0.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# API Docs - v5.0.3

## Sinkmapper

### json *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#sink-mapper">(Sink Mapper)</a>*

<p style="word-wrap: break-word">This extension is an Event to JSON output mapper. <br>Transports that publish messages can utilize this extension to convert Siddhi events to JSON messages. <br>You can either send a pre-defined JSON format or a custom JSON message.<br></p>

<span id="syntax" class="md-typeset" style="display: block; font-weight: bold;">Syntax</span>
```
@sink(..., @map(type="json", validate.json="<BOOL>", enclosing.element="<STRING>")
```

<span id="query-parameters" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">QUERY PARAMETERS</span>
<table>
<tr>
<th>Name</th>
<th style="min-width: 20em">Description</th>
<th>Default Value</th>
<th>Possible Data Types</th>
<th>Optional</th>
<th>Dynamic</th>
</tr>
<tr>
<td style="vertical-align: top">validate.json</td>
<td style="vertical-align: top; word-wrap: break-word">If this property is set to <code>true</code>, it enables JSON validation for the JSON messages generated. <br>When validation is carried out, messages that do not adhere to proper JSON standards are dropped. This property is set to 'false' by default. <br></td>
<td style="vertical-align: top">false</td>
<td style="vertical-align: top">BOOL</td>
<td style="vertical-align: top">Yes</td>
<td style="vertical-align: top">No</td>
</tr>
<tr>
<td style="vertical-align: top">enclosing.element</td>
<td style="vertical-align: top; word-wrap: break-word">This specifies the enclosing element to be used if multiple events are sent in the same JSON message. <br>Siddhi treats the child elements of the given enclosing element as events and executes JSON expressions on them. <br>If an <code>enclosing.element</code> is not provided, the multiple event scenario is disregarded and JSON path is evaluated based on the root element.</td>
<td style="vertical-align: top">$</td>
<td style="vertical-align: top">STRING</td>
<td style="vertical-align: top">Yes</td>
<td style="vertical-align: top">No</td>
</tr>
</table>

<span id="examples" class="md-typeset" style="display: block; font-weight: bold;">Examples</span>
<span id="example-1" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 1</span>
```
@sink(type='inMemory', topic='stock', @map(type='json'))
define stream FooStream (symbol string, price float, volume long);
```
<p style="word-wrap: break-word">Above configuration does a default JSON input mapping that generates the output given below.<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;"event":{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"symbol":WSO2,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"price":55.6,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"volume":100<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br></p>

<span id="example-2" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 2</span>
```
@sink(type='inMemory', topic='{{symbol}}', @map(type='json', enclosing.element='$.portfolio', validate.json='true', @payload( """{"StockData":{"Symbol":"{{symbol}}","Price":{{price}}}""")))
define stream BarStream (symbol string, price float, volume long);
```
<p style="word-wrap: break-word">The above configuration performs a custom JSON mapping that generates the following JSON message as the output.<br>{"portfolio":{<br>&nbsp;&nbsp;&nbsp;&nbsp;"StockData":{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"Symbol":WSO2,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"Price":55.6<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;}<br>}</p>

## Sourcemapper

### json *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#source-mapper">(Source Mapper)</a>*

<p style="word-wrap: break-word">This extension is a JSON-to-Event input mapper. Transports that accept JSON messages can utilize this extension to convert an incoming JSON message into a Siddhi event. Users can either send a pre-defined JSON format, where event conversion happens without any configurations, or use the JSON path to map from a custom JSON message.<br>In default mapping, the JSON string of the event can be enclosed by the element "event", though optional.</p>

<span id="syntax" class="md-typeset" style="display: block; font-weight: bold;">Syntax</span>
```
@source(..., @map(type="json", enclosing.element="<STRING>", fail.on.missing.attribute="<BOOL>")
```

<span id="query-parameters" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">QUERY PARAMETERS</span>
<table>
<tr>
<th>Name</th>
<th style="min-width: 20em">Description</th>
<th>Default Value</th>
<th>Possible Data Types</th>
<th>Optional</th>
<th>Dynamic</th>
</tr>
<tr>
<td style="vertical-align: top">enclosing.element</td>
<td style="vertical-align: top; word-wrap: break-word">This is used to specify the enclosing element when sending multiple events in the same JSON message. <br>Mapper treats the child elements of a given enclosing element as events and executes the JSON path expressions on these child elements. <br>If the enclosing.element is not provided then the multiple-event scenario is disregarded and the JSON path is evaluated based on the root element.</td>
<td style="vertical-align: top">$</td>
<td style="vertical-align: top">STRING</td>
<td style="vertical-align: top">Yes</td>
<td style="vertical-align: top">No</td>
</tr>
<tr>
<td style="vertical-align: top">fail.on.missing.attribute</td>
<td style="vertical-align: top; word-wrap: break-word"><br>This parameter allows users to handle unknown attributes.The value of this can either be true or false. By default it is true. <br>&nbsp;If a JSON execution fails or returns null, mapper drops that message. <br>However, setting this property to false prompts mapper to send an event with a null value to Siddhi, where users can handle it as required, ie., assign a default value.)</td>
<td style="vertical-align: top">true</td>
<td style="vertical-align: top">BOOL</td>
<td style="vertical-align: top">Yes</td>
<td style="vertical-align: top">No</td>
</tr>
</table>

<span id="examples" class="md-typeset" style="display: block; font-weight: bold;">Examples</span>
<span id="example-1" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 1</span>
```
@source(type='inMemory', topic='stock', @map(type='json'))
define stream FooStream (symbol string, price float, volume long);
```
<p style="word-wrap: break-word">This configuration performs a default JSON input mapping.<br>&nbsp;For a single event, the input is required to be in one of the following formats:<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;"event":{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"symbol":"WSO2",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"price":55.6,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"volume":100<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br><br>or <br><br>{<br>&nbsp;&nbsp;&nbsp;&nbsp;"symbol":"WSO2",<br>&nbsp;&nbsp;&nbsp;&nbsp;"price":55.6,<br>&nbsp;&nbsp;&nbsp;&nbsp;"volume":100<br>}<br></p>

<span id="example-2" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 2</span>
```
@source(type='inMemory', topic='stock', @map(type='json'))
define stream FooStream (symbol string, price float, volume long);
```
<p style="word-wrap: break-word">This configuration performs a default JSON input mapping. <br>For multiple events, the input is required to be in one of the following formats:<br>[<br>{"event":{"symbol":"WSO2","price":55.6,"volume":100}},<br>{"event":{"symbol":"WSO2","price":56.6,"volume":99}},<br>{"event":{"symbol":"WSO2","price":57.6,"volume":80}}<br>]<br><br>or <br><br>[<br>{"symbol":"WSO2","price":55.6,"volume":100},<br>{"symbol":"WSO2","price":56.6,"volume":99},<br>{"symbol":"WSO2","price":57.6,"volume":80}<br>]</p>

<span id="example-3" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 3</span>
```
@source(type='inMemory', topic='stock', @map(type='json', enclosing.element="$.portfolio", @attributes(symbol = "company.symbol", price = "price", volume = "volume")))
```
<p style="word-wrap: break-word">This configuration performs a custom JSON mapping.<br>For a single event, the expected input is similar to the one shown below:<br>.{<br>&nbsp;"portfolio":{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"stock":{ "volume":100,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"company":{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"symbol":"WSO2"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"price":55.6<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>}<br></p>

<span id="example-4" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 4</span>
```
@source(type='inMemory', topic='stock', @map(type='json', enclosing.element="$.portfolio", @attributes(symbol = "stock.company.symbol", price = "stock.price", volume = "stock.volume")))
define stream FooStream (symbol string, price float, volume long);
```
<p style="word-wrap: break-word">The configuration performs a custom JSON mapping.<br>For multiple events, expected input looks as follows.<br>.{"portfolio":<br>&nbsp;&nbsp;&nbsp;[ {"stock":{"volume":100,"company":{"symbol":"wso2"},"price":56.6}}, {"stock":{"volume":200,"company":{"symbol":"wso2"},"price":57.6}} ]<br>}<br></p>

2 changes: 1 addition & 1 deletion docs/api/latest.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# API Docs - v5.0.2
# API Docs - v5.0.3

## Sinkmapper

Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Find some useful links below:

## Latest API Docs

Latest API Docs is <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.2">5.0.2</a>.
Latest API Docs is <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.3">5.0.3</a>.

## How to use

Expand Down Expand Up @@ -48,8 +48,8 @@ extension you can replace the component <a target="_blank" href="https://github

## Features

* <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.2/#json-sink-mapper">json</a> *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#sink-mapper">(Sink Mapper)</a>*<br><div style="padding-left: 1em;"><p>This extension is an Event to JSON output mapper. <br>Transports that publish messages can utilize this extension to convert Siddhi events to JSON messages. <br>You can either send a pre-defined JSON format or a custom JSON message.<br></p></div>
* <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.2/#json-source-mapper">json</a> *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#source-mapper">(Source Mapper)</a>*<br><div style="padding-left: 1em;"><p>This extension is a JSON-to-Event input mapper. Transports that accept JSON messages can utilize this extension to convert an incoming JSON message into a Siddhi event. Users can either send a pre-defined JSON format, where event conversion happens without any configurations, or use the JSON path to map from a custom JSON message.<br>In default mapping, the JSON string of the event can be enclosed by the element "event", though optional.</p></div>
* <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.3/#json-sink-mapper">json</a> *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#sink-mapper">(Sink Mapper)</a>*<br><div style="padding-left: 1em;"><p>This extension is an Event to JSON output mapper. <br>Transports that publish messages can utilize this extension to convert Siddhi events to JSON messages. <br>You can either send a pre-defined JSON format or a custom JSON message.<br></p></div>
* <a target="_blank" href="https://wso2-extensions.github.io/siddhi-map-json/api/5.0.3/#json-source-mapper">json</a> *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#source-mapper">(Source Mapper)</a>*<br><div style="padding-left: 1em;"><p>This extension is a JSON-to-Event input mapper. Transports that accept JSON messages can utilize this extension to convert an incoming JSON message into a Siddhi event. Users can either send a pre-defined JSON format, where event conversion happens without any configurations, or use the JSON path to map from a custom JSON message.<br>In default mapping, the JSON string of the event can be enclosed by the element "event", though optional.</p></div>

## How to Contribute

Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ markdown_extensions:
pages:
- Welcome: index.md
- API Docs:
- 5.0.3: api/5.0.3.md
- 5.0.2: api/5.0.2.md
- 5.0.1: api/5.0.1.md
- 5.0.0: api/5.0.0.md
Expand Down

0 comments on commit 2aafe75

Please sign in to comment.