Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ApiProperty注解中的required参数无法继承的问题 #2520

Open
qq295823929 opened this issue Nov 23, 2022 · 0 comments
Open

@ApiProperty注解中的required参数无法继承的问题 #2520

qq295823929 opened this issue Nov 23, 2022 · 0 comments

Comments

@qq295823929
Copy link

export class CreateNotificationReq {
@rule(RuleType.string().max(32).required())
@ApiProperty({
example: '关于xxx的通知',
description: '通知标题',
maxLength: 32,
required: true,
})
title: string;

@rule(RuleType.string().max(1024).required())
@ApiProperty({
example: '今天天气不错,我们决定春游',
description: '通知内容',
maxLength: 512,
})
content: string;
}

export class UpdateNotificationReq extends CreateNotificationReq {
@rule(RuleType.number().required())
@ApiProperty({ example: 1, description: '通知的id', required: true })
id: number;
}
如上代码,修改时比新增时多了一个id属性
image

但是修改的却是这个样子的
image

,经过阅读代码,发现生成swagger多了一个删除required的逻辑,不知道是有什么用意还是什么,如果手动删除掉就可以继承了

image

  • Node Version:
  • Midway Version(Decorator/Core):
  • Component Name/Version:
  • Platform:
  • Mini Showcase Repository:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant