Swagger-php: Quotes in annotations

Created on 6 Jul 2016  路  2Comments  路  Source: zircote/swagger-php

Is there a way to include double quotes in descriptions?

/*
 * @SWG\Definition(
 *   definition="Something",
 *   description="This could be a "foo" or a "bar" or something else."
 */

This generates the error:

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

I've tried escaping them with backslashes, but that doesn't work (same error):

/*
 * @SWG\Definition(
 *   definition="Something",
 *   description="This could be a \"foo\" or a \"bar\" or something else."
 */

Nor does using single quotes for the outer string:

/*
 * @SWG\Definition(
 *   definition="Something",
 *   description='This could be a "foo" or a "bar" or something else.'
 */

Gives the error:

[WARN] [Syntax Error] Expected PlainValue, got ''' in ...

Most helpful comment

You can escape a " with a ".
description="This could be a ""foo"" or a ""bar"" or something else."

All 2 comments

You can escape a " with a ".
description="This could be a ""foo"" or a ""bar"" or something else."

Thanks @bfanger !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikylucky picture mikylucky  路  4Comments

ricardovanlaarhoven picture ricardovanlaarhoven  路  5Comments

aqlx86 picture aqlx86  路  3Comments

DerManoMann picture DerManoMann  路  3Comments

Dalabad picture Dalabad  路  4Comments