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

what's iValueObject for during the validation step? #668

Open
igorsantos07 opened this issue Aug 23, 2021 · 1 comment
Open

what's iValueObject for during the validation step? #668

igorsantos07 opened this issue Aug 23, 2021 · 1 comment
Assignees

Comments

@igorsantos07
Copy link

igorsantos07 commented Aug 23, 2021

I was trying to get a smarter type class (so I can use it to do sanitization as well), and stumbled upon iValueObject, which seems to... short-circuit param validation? It seems that, if I supply an object implementing that interface as a param type, it will not validate any of the types declared on it, is this correct?

I see no documentation whatsoever on that behavior, and that interface is only very briefly mentioned in V4 docs (in the V3 subdomain? confusing) about return object documentation.

What's the idea? Should iValueObject implement its own in-house validation instead? It would be very nice if we could integrate more robust objects into the call params. Specifically, I was trying to turn my types into Laravel Collections, but it doesn't really work since they store their values inside a private property, while Restler depends on publicly named props to identify the types. It would be easy to allow extensibility there; either the Validator part that sets a value could be extensible, or if it checked for a custom setter instead of just $instance->{$key}. If this sounds interesting, I can provide a PR for the latter (but this is actually a different topic).

@Arul-
Copy link
Member

Arul- commented Feb 20, 2022

iValueObject should not do short circuit validation. Can you provide an example?

Restler 3 had two versions RC5 and RC6 both maintained at the same time which lead to much confusion

So RC5 became Restler 4, RC6 became Restler 5

@Arul- Arul- self-assigned this Feb 20, 2022
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

No branches or pull requests

2 participants