spring-cloud / spring-cloud-dataflow

A microservices-based Streaming and Batch data processing in Cloud Foundry and Kubernetes
https://dataflow.spring.io
Apache License 2.0
1.11k stars 580 forks source link

JSON parse error in POST tools/parseTaskTextToGraph #5255

Closed Asinrus closed 3 months ago

Asinrus commented 1 year ago

Hello, everyone

I created by UI a task definiton :a: http-experiment --body='{"params": {"val1": ${val2}}' ,where http-experiment is an application with metadata, where --body is setted in org.springframework.cloud.dataflow.spring-configuration-metadata.json.

I have an issue with a endpoint: POST tools/parseTaskTextToGraph I get a error:

{
  "_embedded": {
    "errors": [
      {
        "message": "JSON parse error: Unexpected character ('p' (code 112)): was expecting comma to separate Object entries; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('p' (code 112)): was expecting comma to separate Object entries\n at [Source: (PushbackInputStream); line: 1, column: 39]",
        "logref": "HttpMessageNotReadableException",
        "_links": {
          "self": {
            "href": "/"
          }
        }
      }
    ]
  }
}

Could you say, please, it is correct behaviour?

Additional context: Spring Cloud DataFlow version: 2.9.1

corneil commented 1 year ago

Try escaping the " like in `--body="{\"params\": {\"val1\": ${val2}}"

Asinrus commented 1 year ago

So, I didn't get a result I made next definition a: http-experiment --body="{\"params\": {\"val_1\": ${val_1}}" I get

{
  "_embedded": {
    "errors": [
      {
        "message": "JSON parse error: Unexpected character ('{' (code 123)): was expecting comma to separate Object entries; nested exception is com.fasterxml.jackson.core.JsonParseException: Unexpected character ('{' (code 123)): was expecting comma to separate Object entries\n at [Source: (PushbackInputStream); line: 1, column: 38]",
        "logref": "HttpMessageNotReadableException",
        "_links": {
          "self": {
            "href": "/"
          }
        }
      }
    ]
  }
}

Moreover, my definition was rewritten to a: http-experiment --body='"{\"params\": {\"val_1\": ${val_1}}"'.

corneil commented 10 months ago

a: http-experiment --body="{\"params\": {\"val_1\": ${val_1}}" ${val_1} is recursive and that is going to cause problems. What happens with a: http-experiment --body="{\"params\": {\"val_1\": \"value_1\"}}"?

cppwfs commented 3 months ago

Closing due to inactivity. If closed in error please let us know.