非规范化上下文和 api 平台的问题

时间:2021-06-05 16:09:38

标签: api symfony platform

我正在尝试使用我在以前版本中使用的非规范化上下文,但它不起作用。 Swagger 无法识别负载示例中的非规范化上下文组

App\Entity\User:
  attributes:
    id:
      groups: [user_read]
    name:
      groups: [user_read, user_register, user_update, movement_read]
    email:
      groups: [user_read, user_register]
    password:
      groups: [user_register]
    avatar:
      groups: [user_read]
    active:
      groups: [user_read]
    token:
      groups: [user_activate]
    createdAt:
      groups: [user_read]
    updatedAt:
      groups: [user_read]

现在在集合操作中:

collectionOperations:
    register:
      method: POST
      path: /users/register
      controller: App\Api\Action\User\Register
      denormalization_context:
        groups: [user_register]
      openapi_context:
        summary: Register a user in the API

(我使用 yaml 进行资源和序列化)

现在,在 api 文档中,在此端点中,有效负载中所需的数据是:

"name": "string",
"email": "string",
"avatar": "string",
"active": true,
"createdAt": "2019-08-24T14:15:22Z"

应该只是姓名和电子邮件,因为这是 user_register 组中的字段

0 个答案:

没有答案