swagger设置字段required必填

时间:2025-02-18 09:40:15
  • package ;
  • import .*;
  • import ;
  • import ;
  • import .*;
  • import ;
  • import ;
  • import ;
  • import ;
  • import ;
  • import ;
  • import ;
  • import ;
  • import .slf4j.Slf4j;
  • import ;
  • import ;
  • import ;
  • import .*;
  • import ;
  • import ;
  • import ;
  • import ;
  • import ;
  • import ;
  • import ;
  • import ;
  • @EnableAsync
  • @RestController
  • @Api(value = "MyAppController",tags = {"自建应用服务"})
  • @RequestMapping("/myApp")
  • @Slf4j
  • public class MyAppController extends BaseController {
  • @Autowired
  • private MyAppService myAppService;
  • @ApiOperation(value = "自建应用-推送图文消息给用户",
  • notes = "逻辑如下:"+ MyConstants.SWAGGER2_FOX_BR_TAG +
  • MyConstants.SWAGGER2_FOX_BR_TAG)
  • @RequestMapping(value = "/sendNews", method = )
  • @ResponseBody
  • public String sendNews(@Validated @RequestBody MyAppSendNewsReqBean vo) {
  • String code = ;
  • try {
  • ("myApp sendNews vo={}",vo);
  • (vo);
  • } catch (Exception e) {
  • code = ;
  • ();
  • }
  • return (code);
  • }
  • }