Triple doublequotes not preserved when switching back from design view to source view
dilini-muthumala opened this issue · comments
Description:
A sequence of three double quotes, which are put for escaping the double quotes in a payload, are not preserved when switching from design view to source view.
Example payload element:
@payload(""" { "event": { "status":"{{status}}"} } """)
Furthermore, if we provide following value to headers
option in http-response
sink
, the double quotes get trnasformed into single quotes when switching from design view to source view.
headers="'content-type:json','content-length:94'"
Affected Product Version:
SP 4.3.0
OS, DB, other environment details and versions:
This issue is not exclusive to a specific environment.
Steps to reproduce:
- Start Editor and create new Siddhi app on source view using the Siddhi app given below:
@App:name("ShipmentService")
@App:description("Description of the plan")
@source(type='http-request', source.id='shipment', receiver.url='http://localhost:8080/shipment/',
@map(type='json', @attributes(messageId='trp:messageId', orderId='$.event.orderId')))
define stream ShipmentService (messageId string, orderId string);
@sink(type='http-response', source.id='shipment', message.id='{{messageId}}', headers="'content-type:json','content-length:94'",
@map(type='json', @payload(""" { "event": { "status":"{{status}}"} } """)))
--@sink(type='log')
define stream ShipmentResponce (status String, messageId string);
@info(name='ProcessShipment')
from ShipmentService
select ifThenElse(convert(orderId, 'long') > 1000, ifThenElse(count() > 5, "success", "delayed"), ifThenElse(math:round(math:rand()) ==0, "delayed", "success" )) as status, messageId
group by orderId
insert into ShipmentResponce;
- Go to design view and change something on the siddhi app (for example, add new stream).
- Switch back to Source view. It will have following Siddhi app.
@App:name("ShipmentService")
@App:description("Description of the plan")
@source(type='http-request', source.id='shipment', receiver.url='http://localhost:8080/shipment/',
@map(type='json', @attributes(messageId='trp:messageId', orderId='$.event.orderId')))
define stream ShipmentService (messageId string, orderId string);
@sink(type='http-response', source.id='shipment', message.id='{{messageId}}', headers=''content-type:json','content-length:94'',
@map(type='json', @payload("{ "event": { "status":"{{status}}"} } ")))
--@sink(type='log')
define stream ShipmentResponce (status String, messageId string);
@info(name='ProcessShipment')
from ShipmentService
select ifThenElse(convert(orderId, 'long') > 1000, ifThenElse(count() > 5, "success", "delayed"), ifThenElse(math:round(math:rand()) ==0, "delayed", "success" )) as status, messageId
group by orderId
insert into ShipmentResponce;
In the resulting Siddhi app, payload is changed as below:
@payload(" { "event": { "status":"{{status}}"} } "))
In addition to that, headers in http-response sink are changed as
headers=''content-type:json','content-length:94''
Related Issues:
None.