vercel-labs / vercel-labs/json-render

Custom validation checks do not support async implementation

Open
#291 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
16.8k
Forks
901
Avg merge
3h 14m
Merged PRs (30d)
4

Description

Async implementation of custom validation checks is not supported even though snippets mention this in @json-render/react documentation

https://json-render.dev/docs/validation#usage-with-react

    isUniqueEmail: async (value) => {
      const response = await fetch(`/api/check-email?email=${value}`);
      const { available } = await response.json();
      return available;
    },

https://json-render.dev/docs/api/react#validationprovider

type ValidationFunction = (value: unknown, args?: object) => boolean | Promise<boolean>;

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the @json-render/react ValidationProvider documentation and the validation usage example, then locate the implementation of custom validation checks. Verify how the documented ValidationFunction is invoked and how its Promise result is handled. Done means async custom checks work as documented while synchronous checks continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.