confluentinc / confluentinc/ksql
Character escaping required, not documented, for KSQL REST API
- Dominant language
- Java
- Stars
- 315
- Forks
- 1k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 36
Description
The documentation for KSQL does not require that backslashes be escaped. However, with the REST API, this is required.
https://docs.confluent.io/current/ksql/docs/developer-guide/syntax-reference.html
The following curl command
```
curl -v -m 3 -X POST http://localhost:8088/ksql -H "Content-Type: application/json; charset=utf-8" -d "{\"ksql\":\"INSERT INTO match SELECT field FROM eventstream WHERE otherfield LIKE '%\Bad query';\"}"
```
Produces the query: `{"ksql":"INSERT INTO match SELECT field FROM eventstream WHERE otherfield LIKE '%\Bad query';"}`
Whereas the following curl command
```
curl -v -m 3 -X POST http://localhost:8088/ksql -H "Content-Type: application/json; charset=utf-8" -d "{\"ksql\":\"INSERT INTO match SELECT field FROM eventstream WHERE otherfield LIKE '%\\\Good query';\"}"
```
Produces the query: `{"ksql":"INSERT INTO match SELECT field FROM eventstream WHERE otherfield LIKE '%\\Good query';"}`
Note: the shell is obviously escaping `\\\` into `\\`
Contributor guide
Research direction
Start with the linked KSQL syntax-reference documentation and compare its REST API guidance with the two curl examples in the issue. Document that backslashes must be escaped for REST API requests, preserving the distinction between shell escaping and the resulting JSON query; done means the documentation states this requirement clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell, sql
- Domain
- api, documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100