-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
Read parent object in custom tag #991
Comments
Not possible to get parent object info. If it requires, it is out of validation library scope. |
well, actually it is possible, because that code is working and I'm reading parent object info. I'm asking this cause this feature exists in nestjs/swagger and IMO is useful, so why should it be out of the scope of the validation library something that is working right now (even is not documented) and is useful for validation purposes (validate some field based on another field)? |
The parent object, it is just your domestic issue. The parent can be sometimes array, sometimes tuple, and even possible to does not exist due to standalone utilization. I do not have plan to support such private and type unsafe story. If you need to solve your domain problem, then you have to do it by yourself. |
Also, the reason why you could utilize the For reference, if some object type is extremely simple, it would be inlined, so that |
so, with typia there's no way to validate one property based in another one at same level?
in this contrived exampled, validated that port is 443 is protocol is https, could this be achieved? |
Not possible. |
and why custom tags only supports this values my questions is I can use an array of objects, but not a plain object, os there any special reason behind that? |
In the object case, it actually defined as actual property type in the compiler API. I can separate it manually, but did not it due to no use case yet. |
Hi, I'm trying to read the parent object (input) in a custom validation tag.
I think I found a workaround for it, using
input
without the$
as prefix, but this works right now, maybe not in the future if you change that variable name. Is this possible right now? I think this is useful, maybe the validate callback could receive the parent object as arg.Current
Proposal
thanks
The text was updated successfully, but these errors were encountered: