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

Add support for denied_with and denied_without #660

Closed
erma07 opened this issue Sep 10, 2020 · 6 comments · Fixed by #664
Closed

Add support for denied_with and denied_without #660

erma07 opened this issue Sep 10, 2020 · 6 comments · Fixed by #664

Comments

@erma07
Copy link
Contributor

erma07 commented Sep 10, 2020

Package version eg. v8, v9:

v10

Issue, Question or Enhancement:

Add support for:
denied_with
denied_with_all
denied_without
denied_without_all

@andig
Copy link

andig commented Sep 15, 2020

Aren't those similar to fieldexcludes?

@erma07
Copy link
Contributor Author

erma07 commented Sep 15, 2020

Played around with FieldExcludes https://play.golang.org/p/rhRupsq_cnM and strings.Contains(field.String(), currentField.String()) is not what I need.

The idea for eg denied_with is that if there is x then there must not be a y and the idea for denied_without is that if x is not there then y must not be there.

@andig
Copy link

andig commented Sep 15, 2020

The idea for eg denied_with is that if there is x then there must not be a y and the idea for denied_without is that if x is not there then y must not be there.

You mean

The idea for eg FieldExcludes is that if there is x then there must not be a y and the idea for denied_without is that if x is not there then y must not be there.

?

@erma07
Copy link
Contributor Author

erma07 commented Sep 15, 2020

Since FieldExcludes currently uses strings.Contains, means it has a purpose - x string must not contain y string. I don't know if anyone uses it like that though.
fmt.Println(strings.Contains("xy", "y")) -> true
fmt.Println(strings.Contains("x", "y")) -> false

I proposed clear names and analogy for required_with, required_with_all, required_without, required_without_all (most of the same code can be used) for creating denied_with, denied_with_all, denied_without, denied_without_all.

And the idea is denied_with is that if there is x then there must not be a y and the idea for denied_without is that if x is not there then y must not be there.

@andig
Copy link

andig commented Sep 15, 2020

And the idea is denied_with is that if there is x then there must not be a y and the idea for denied_without is that if x is not there then y must not be there.

Agreed. I need this too, actually. I've probably misread fieldexcludes in #662 then. The current description of what it provides is not very clear.

@andig
Copy link

andig commented Sep 15, 2020

I would probably have expected excluded instead of denied, but I‘d be happy to see this supported, it‘s really missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants