Swagger Codegen Spring Boot-发送无效的Emum而不是400响应时,对象内部的Enum为空

问题描述

我使用的是swagger版本2。我在body对象内的对象中有一个枚举。当我发送一个无效的枚举时,它将变为null并输入controller方法而不是400响应。我的控制器带有@Validated注释。

我的对象

  UpdateIdeaFieldRequestBody:
    type: object
    properties:
      field:
        $ref: '#/deFinitions/UpdateIdeaFieldNameEnum'
      value:
        type: string
        example: Best project ever
    required:
      - value
      - field

  UpdateIdeaFieldNameEnum:
type: object
description: Enum of possible field names to update in an idea
properties:
  field:
    enum: [executive_sponsor,division,platform_contact]
    type: string
  required:
    - field

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)