swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

How to specify default json value in swagger php documentation?

Open prady00 opened this issue 11 years ago • 7 comments

I have also raised it as a SO question- http://stackoverflow.com/questions/27665622/how-to-specify-default-json-value-in-swagger-php-documentation

prady00 avatar Dec 27 '14 08:12 prady00

Hi, I'm guessing you should convert the defaultValue into a single line, and escape the quotes with a slash.

fehguy avatar Dec 27 '14 21:12 fehguy

It says -

[WARN] [Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_PARENTHESIS, got 'email' in ....

I've done this - defaultValue = "{"email":"pradeep****@gmail.com","first_name":"Pradeep","last_name":"Kumar","group":"subscriber","password":"password"}"

prady00 avatar Dec 28 '14 14:12 prady00

Hi, I think you'll needt open this in the swagger-php repo, which I believe is here:

https://github.com/zircote/swagger-php

fehguy avatar Dec 29 '14 15:12 fehguy

silly question, but did you try single quotes around the JSON?

fehguy avatar Dec 29 '14 15:12 fehguy

I have the same problem... also try many approaches without success including single quotes...

ClaudioVarandas avatar Jan 08 '15 11:01 ClaudioVarandas

Here is the same problem. I think we can avoid this problems escaping the quotes from the source string...or converto to unicode..

jmpatricio avatar Jan 08 '15 11:01 jmpatricio

has this been resolved? I can escape the quotes like showed but then it replaces it with backslashes in the example so that is not what I am looking for example="{""code"":""3088"",""quantity"":""2""},{""code"":""3089"",""quantity"":""1""}",

wraycode avatar Aug 22 '17 19:08 wraycode