Nelmio Api Doc中的组排除在更新composer后不起作用


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

我将参数设置为数组,如中所述http://jmsyst.com/libs/serializer/master/reference/annotations

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

并在另一类中定义一些选项

class QuestionOptions
{
    /**
       * @JMS'Type("integer")
       * @Groups({"get_option"})
       */
      public $question_option_id ;
      /**
       * @JMS'Type("string")
       * @Groups({"post_option"})
       */
      public $question_option_description;
}

在@ApiDoc中,我定义了

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

在更新之前,它运行良好。但在composer update之后,只有"QuestionAnswer"组名有效,并且它显示QuestionOptions类中的所有属性。如何以更新前的方式提交数组中的属性?

哇,真奇怪。类似的事情过去发生在我身上,这似乎是一个API问题。在代码端,我们开发人员无能为力。也没有人找到解决方法或修复方法。

marcin jozwikowski评论十一月252020

好吧,我成功了!答案是最古老的:清除缓存。至少我的情况就是这样。Serializer手册中也要求安装sensio/framework-extra-bundle,但如果没有它,它对我来说是有效的

原始评论:https://github.com/nelmio/NelmioApiDocBundle/issues/1167#issuecomment-733909426