1 year ago

#178303

test-img

kalbo123

RAML Mulesoft Unsupported chars in string value

I am getting an error of 'Unsupported chars in string value (probably a binary file)' When sending a post request in postman. There is not a problem when I use the mocking service in anypoint's design center, only when I run in anypoint studio and post in postman.

raml

  id:
    type: string 
    pattern: ^\{\\"\w+\\":\\"\w+\\"(?:,\\"\w+\\":\\"\w+\\")*\}$|^\{\}$
    required: false
    example:   
     “{\"key1\":\"val1\",\"key2\":\"val2\"}”

I have tried to have the example have single quotes, double quotes and no quotes. It doesn't seem to like the slash before the curly brace.

I just need my regex to allow for these two scenarios (which the regex does work):

{\"key1\":\"val1\",\"key2\":\"val12\"}

{}

I am sending field in the request body as:

"id": "\{\"key1\":\"val1\",\"key2\":\"val2\"\}"

I think the problem is when converts to java its causing a problem but I am not able to figure out how I can send the string with validation and not erroring. Please help.

regex

mulesoft

raml

0 Answers

Your Answer

Accepted video resources