Skip to content

Commit

Permalink
[WSO2-Release] [Release 5.2.1] update documentation for release 5.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wso2-jenkins-bot committed Apr 2, 2021
1 parent cb96996 commit b927fee
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ For information on <a target="_blank" href="https://siddhi.io/">Siddhi</a> and i

## Latest API Docs

Latest API Docs is <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.0">5.2.0</a>.
Latest API Docs is <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.1">5.2.1</a>.

## Features

* <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.0/#json-sink-mapper">json</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#sink-mapper">Sink Mapper</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">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></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.0/#json-source-mapper">json</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#source-mapper">Source Mapper</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">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></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.1/#json-sink-mapper">json</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#sink-mapper">Sink Mapper</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">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></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.1/#json-source-mapper">json</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#source-mapper">Source Mapper</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">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></p></div>

## Dependencies

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

!!! Info "Tested Siddhi Core version: *<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/">5.1.18</a>*"
It could also support other Siddhi Core minor versions.

## Sinkmapper

### json *<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#sink-mapper">(Sink Mapper)</a>*
<p></p>
<p style="word-wrap: break-word;margin: 0;">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>
<p></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>", event.grouping.enabled="<BOOL>", enable.null.attribute.value="<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">validate.json</td>
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">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></p></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"><p style="word-wrap: break-word;margin: 0;">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.</p></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">event.grouping.enabled</td>
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">This parameter is used to preserve event chunks when the value is set to 'true' or the value can be set to 'false' to separate events</p></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>
<tr>
<td style="vertical-align: top">enable.null.attribute.value</td>
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">If this parameter is true, output parameter values will contain null values if not they will be undefined</p></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>
</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></p>
<p style="word-wrap: break-word;margin: 0;">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>
<p></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></p>
<p style="word-wrap: break-word;margin: 0;">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>
<p></p>
## Sourcemapper

### json *<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#source-mapper">(Source Mapper)</a>*
<p></p>
<p style="word-wrap: break-word;margin: 0;">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>
<p></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>", event.grouping.enabled="<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"><p style="word-wrap: break-word;margin: 0;">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.</p></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"><p style="word-wrap: break-word;margin: 0;"><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.)</p></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>
<tr>
<td style="vertical-align: top">event.grouping.enabled</td>
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">This parameter is used to preserve event chunks when the value is set to 'true' or the value can be set to 'false' to separate events</p></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></p>
<p style="word-wrap: break-word;margin: 0;">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>
<p></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></p>
<p style="word-wrap: break-word;margin: 0;">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>
<p></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></p>
<p style="word-wrap: break-word;margin: 0;">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;&nbsp;&nbsp;&nbsp;},<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"price":55.6<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;}<br>}<br></p>
<p></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></p>
<p style="word-wrap: break-word;margin: 0;">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>
<p></p>
12 changes: 10 additions & 2 deletions docs/api/latest.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# API Docs - v5.2.0
# API Docs - v5.2.1

!!! Info "Tested Siddhi Core version: *<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/">5.1.18</a>*"
It could also support other Siddhi Core minor versions.
Expand All @@ -12,7 +12,7 @@
<span id="syntax" class="md-typeset" style="display: block; font-weight: bold;">Syntax</span>

```
@sink(..., @map(type="json", validate.json="<BOOL>", enclosing.element="<STRING>", event.grouping.enabled="<BOOL>")
@sink(..., @map(type="json", validate.json="<BOOL>", enclosing.element="<STRING>", event.grouping.enabled="<BOOL>", enable.null.attribute.value="<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>
Expand Down Expand Up @@ -49,6 +49,14 @@
<td style="vertical-align: top">Yes</td>
<td style="vertical-align: top">No</td>
</tr>
<tr>
<td style="vertical-align: top">enable.null.attribute.value</td>
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">If this parameter is true, output parameter values will contain null values if not they will be undefined</p></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>
</table>

<span id="examples" class="md-typeset" style="display: block; font-weight: bold;">Examples</span>
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ For information on <a target="_blank" href="https://siddhi.io/">Siddhi</a> and i

## Latest API Docs

Latest API Docs is <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.0">5.2.0</a>.
Latest API Docs is <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.1">5.2.1</a>.

## Features

* <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.0/#json-sink-mapper">json</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#sink-mapper">Sink Mapper</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">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></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.0/#json-source-mapper">json</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#source-mapper">Source Mapper</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">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></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.1/#json-sink-mapper">json</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#sink-mapper">Sink Mapper</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">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></p></div>
* <a target="_blank" href="https://siddhi-io.github.io/siddhi-map-json/api/5.2.1/#json-source-mapper">json</a> *(<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#source-mapper">Source Mapper</a>)*<br> <div style="padding-left: 1em;"><p><p style="word-wrap: break-word;margin: 0;">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></p></div>

## Dependencies

Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pages:
- Information: index.md
- API Docs:
- latest: api/latest.md
- 5.2.1: api/5.2.1.md
- 5.2.0: api/5.2.0.md
- 5.1.1: api/5.1.1.md
- 5.1.0: api/5.1.0.md
Expand Down

0 comments on commit b927fee

Please sign in to comment.