Nelmioapidocbundle: Symfony Serializer Groups cause Exception while parsing

Created on 27 Mar 2018  路  8Comments  路  Source: nelmio/NelmioApiDocBundle

api/doc page results in error after defining Groups annotation in Entity:
{"error":{"code":500,"message":"Internal Server Error","exception":[{"message":"Warning: Illegal offset type in isset or empty","class":"ErrorException","trace"

There is something suspicious going on this line:
https://github.com/nelmio/NelmioApiDocBundle/blob/a356221c6769988712295a16bc5896b8265e8029/ModelDescriber/ObjectModelDescriber.php#L66

$groups - this is actually a numerical-key array of groups from SWG annotation in controller
$property - while this is an instance of object(EXSystComponentSwaggerSchema)

PS Unfortunately have no time for further investigation. Will switch to JMS

Most helpful comment

I just released v3.2.1 containing this fix https://github.com/nelmio/NelmioApiDocBundle/releases/tag/v3.2.1.

All 8 comments

You're right, I don't know how we ended up using $property, it should be $propertyName. Will try to submit a fix.

Hello, when the problem will be corrected?

when somebody has time to do it, i guess. you are welcome to send a pull request. this is open source and people work on it in their free time...

I do not think it is a fix, because groups variable are number ordered array that is contsructed from controller's annotation group.

I believe that fix should contain fetching groups from target property and performing array_intersect between groups defined in controller and model

Seems like this exists on latest stable 3.2.0 when is the next release coming?

I just released v3.2.1 containing this fix https://github.com/nelmio/NelmioApiDocBundle/releases/tag/v3.2.1.

@GuilhemN thanks!

Thanks @GuilhemN (and all others involved)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yalagin picture yalagin  路  5Comments

andydandy80 picture andydandy80  路  4Comments

smuralidharan picture smuralidharan  路  3Comments

timotheemoulin picture timotheemoulin  路  5Comments

NicolasGuilloux picture NicolasGuilloux  路  4Comments