You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@WankkoRee Hi, that is expected result. If a parameter is not required, it ignores the validation if such parameter is not committed. Try using this validation rule for attribute Test: Test *int `v:"required|integer|min:1" dc:"测试"`, and see the difference.
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
@gqcn I think this result is inconsistent with common understanding. When the definition of a passed parameter is a pointer and is not required, if the parameter is submitted, the value obtained should be verified; if a passed parameter is not submitted, it should be nil.
In the demo I gave, GET /test means explicitly not submitting the test parameter. You can see that the obtained value is nil, which is consistent with the understanding; GET /test?test=0 means explicitly submitting it. The test parameter can be seen to hit the verification logic, which is also consistent with the understanding; however, the meaning of GET /test?test= is not clear. If it is understood that the test parameter is submitted, it is actually obtained. The value is reached, but the value is 0, which means that the expected verification was not triggered. If it is understood that the test parameter was not submitted, but a non-nil value was actually obtained.
1. What version of
Go
and system type/arch are you using?go version go1.20.5 windows/amd64
2. What version of
GoFrame
are you using?v2.5.0
3. Can this issue be re-produced with the latest release?
yes
4. What did you do?
5. What did you expect to see?
GET /test
GET /test?test=
GET /test?test=0
6. What did you see instead?
GET /test
GET /test?test=
GET /test?test=0
The text was updated successfully, but these errors were encountered: