Group exclusion in Nelmio Api Doc does not work After updating composer

PhpSymfonyDoctrine OrmNelmioapidocbundle

Php Problem Overview


I set up a parameter as array, as described in http://jmsyst.com/libs/serializer/master/reference/annotations

class QuestionAnswer
{
    /**
   * @JMS\Type("ArrayCollection<Rest\Bundle\Entity\Fixture\QuestionOptions>")
     * @Groups({"QuestionAnswer"})
   */
      public $question_options_array ;
}

and define some options in another class

class QuestionOptions
{
    /**
       * @JMS\Type("integer")
       * @Groups({"get_option"})
       */
      public $question_option_id ;

      /**
       * @JMS\Type("string")
       * @Groups({"post_option"})
       */
      public $question_option_description;
}

In @ApiDoc I define

     * input={
     *      "class" = "Rest\BeautyBundle\Entity\Fixture\ProfileQuestionAnswer", 
     *      "groups"={"QuestionAnswer", "get_option"},
     *  },

Before updating it works well. But after composer update only the "QuestionAnswer" group name works and it shows all properties from QuestionOptions class. How can I submit properties in the array the way it was before the update?

Php Solutions


Solution 1 - Php

Wow quite odd. Something very similar happened with me in the past and It seems to be an API issue. Nothing on the code end that us developers can do. No one has found a workaround or fix either.

Solution 2 - Php

> marcin-jozwikowski commented on Nov 25, 2020 > > OK, I got it working! > The answer is as old as it gets: clear the cache. At least that's what it was in my case. > There's also a requirement in Serializer manual to install sensio/framework-extra-bundle but it work for me without it.

Original comment: https://github.com/nelmio/NelmioApiDocBundle/issues/1167#issuecomment-733909426

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHayk GrigoryanView Question on Stackoverflow
Solution 1 - PhpColinView Answer on Stackoverflow
Solution 2 - PhpSerghei NiculaevView Answer on Stackoverflow