-
Notifications
You must be signed in to change notification settings - Fork 934
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
Date ref not does not appear to be getting cast #553
Comments
On the face of it, it would make sense it doesn't cast, b/c there is no schema definition for also
you don't need the |
@jquense Thanks for the tip! Would it make sense to pass a schema or cast function as an option to the ref? Right now, ref's only take contextPrefix as an option, I could envision an api like this:
Not sure if it would help to define the whole schema for it like:
I'd love to be a contributor to such an awesome library. If you like the concept I could submit a PR? |
Just wanted to add one further thing. If we could access the parent schema - see #551 - not just the parent object, then, at least for sibling ref's, we wouldn't even have to pass in a cast/schema option, to the ref, we could just infer it from the schema type of the sibling (invaluable feature, I think!). We would still have to supply a schema/cast option if the ref were context, though. |
how would that work there since isn't a sibling schema, if there was it'd be used already. This example is a bit weird b/c you are using throw-away data in the value input as a dependency for a known field |
Sorry! Still learning the library! |
My issue with this is Date.min() docs suggest that the limit(string) gets cast. Why wouldn't Ref that's a string in context also get cast to a date? Otherwise, what's the suggested way to cast contextual References. |
I've got some utility functions for yup that I use like so:
This works:
This does not:
From what I can tell in the test, it looks like it resolves the ref correctly, but it doesn't cast it (at least not in the way I think it should cast it, but I could be misunderstanding something).
I can fix it by doing this, (but it's much less elegant :( ):
I'm just wondering if this is a bug that the resolved ref isn't getting cast in the first example I posted? Am I just misunderstanding how casting is supposed to work (completely possible)? Is it at all related to this old issue: #40?
The text was updated successfully, but these errors were encountered: