如何解决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 举报,一经查实,本站将立刻删除。