Closed jobinli closed 4 years ago
确实有这个情况, 可以这样改动下,
public function setRequire()
{
$this->required = in_array("required", explode($this->rule, '|'));
return $this;
}
仅判断 strpos($this->rule, 'required|') !== false
会在仅有 required
约束时失效
已更新在 1.5.8
版本
https://github.com/daodao97/apidog/blob/32be225c5c3d253cf953a774b3ca59c652d01605/src/Annotation/Param.php#L35-L40
此处的
required
判定是否加上|
符号比较好?因为像required_if
之类的规则,会在 swagger-ui 前端就被拦截提交,不好做测试。不知 swagger 是否能实现这种关联检测的判定。