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

Refinements are not working within dynamic util #830

Closed
rossholdway opened this issue Jun 12, 2021 · 1 comment · Fixed by #966
Closed

Refinements are not working within dynamic util #830

rossholdway opened this issue Jun 12, 2021 · 1 comment · Fixed by #966
Labels
bug ♥ help please Issues that we'd love help solving

Comments

@rossholdway
Copy link

I believe I've found a bug. Refinements don't seem to work when returned from the dynamic util. See below example, which I would expect to fail - however it passes validation.

const schema = object({
  name: string(),
  age: dynamic((value, context) => {
    return size(integer(), 1, 100);
  })
});

const person = struct.validate({name: 'Ross', age: 1000}, schema);
@ianstormtaylor ianstormtaylor added bug ♥ help please Issues that we'd love help solving labels Sep 8, 2021
@Gelio
Copy link
Contributor

Gelio commented Oct 21, 2021

#966 should fix it 🚀

ianstormtaylor pushed a commit that referenced this issue Mar 2, 2022
* Respect refiner in `dynamic`

Provide a refiner in the result of the `dynamic` utility that is a proxy to the
results of the dynamically returned struct.

Fixes #830

* Respect refiner in `lazy`

Provide a refiner in the struct returned from the `lazy` utility. It proxies the
call to the lazily resolved struct.

Related to #830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ♥ help please Issues that we'd love help solving
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants