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

Update dependency fastest-validator to v1.11.0 #10

Merged
merged 1 commit into from
May 11, 2021

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented May 11, 2021

WhiteSource Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
fastest-validator 1.10.1 -> 1.11.0 age adoption passing confidence

Release Notes

icebob/fastest-validator

v1.11.0

Compare Source

Async custom validator supports

const schema = {
    // Turn on async mode for this schema
    $$async: true,
    name: {
        type: "string",
        min: 4,
        max: 25,
        custom: async (v) => {
            await new Promise(resolve => setTimeout(resolve, 1000));
            return v.toUpperCase();
        }
    },

    username: {
        type: "custom",
        custom: async (v) => {
            // E.g. checking in the DB that whether is unique.
            await new Promise(resolve => setTimeout(resolve, 1000));
            return v.trim();
        }
    },
}

The compiled check function has an async property to detect this mode. If true it returns a Promise.

const check = v.compile(schema);
console.log("Is async?", check.async);

Meta-information for custom validators

You can pass any extra meta information for the custom validators which is available via context.meta.

const schema = {
    name: { type: "string", custom: (value, errors, schema, name, parent, context) => {
        // Access to the meta
        return context.meta.a;
    } },
};
const check = v.compile(schema);

const res = check(obj, {
    // Passes meta information
    meta: { a: "from-meta" }
});

Changes

  • support default and optional in tuples and arrays #​226
  • fix that this points to the Validator instance in custom functions #​231

Configuration

📅 Schedule: At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻️ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box.

This PR has been generated by WhiteSource Renovate. View repository job log here.

@changeset-bot
Copy link

changeset-bot bot commented May 11, 2021

⚠️ No Changeset found

Latest commit: 713d484

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented May 11, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

next-validations – ./

🔍 Inspect: https://vercel.com/dunghd/next-validations/9KBUY6aLgRg6gw6qMyRP23dfj3wW
✅ Preview: https://next-validations-git-renovate-fastest-validator-1x-dunghd.vercel.app

next-validations-demo – ./example

🔍 Inspect: https://vercel.com/dunghd/next-validations-demo/Ag8RHv4ebFgF2Gg6QcFNefFhmE4V
✅ Preview: https://next-validations-demo-git-renovate-fastest-validator-1x-dunghd.vercel.app

@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 713d484
Status: ✅  Deploy successful!
Preview URL: https://fcbb114d.next-validations.pages.dev

View logs

@jellydn jellydn merged commit 126dce8 into main May 11, 2021
@jellydn jellydn deleted the renovate/fastest-validator-1.x branch May 11, 2021 14:36
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

Successfully merging this pull request may close these issues.

2 participants