question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Are there any opportunities to expand the existing scheme? For example, I have a schema for creating a user with the fields email and password, they are required. But for updating it is not so. Is there any way to drop required from the fields in the schema or add required to the fields in the existing schema and other rules like test, etc ?

const userSchemaCreate = yup.object().shape({
  email: yup
    .string()
    .email('Invalid email')
    .test('email', 'Email already exist', checkEmail)
    .required('Email is required'),
  password: yup
    .string()
    .required('Password is required'),
})

const userSchemaUpdate = ... // change userSchemaCreate(remove required in email and password, and remove test in email)

userSchemaUpdate:

yup.object().shape({
  email: yup
    .string()
    .email('Invalid email')
  password: yup
    .string()
})

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jgouxcommented, Sep 11, 2018

Awesome, this function should definitly be exposed by yup! 👍

On this line :

let getNextCurrent = ()=> idx === 0 ? this : yup.reach(this, prop.join(parts.slice(0, idx)));

Where does prop come from?

0reactions
jquensecommented, Sep 11, 2018

o sorry didn’t factor it out, its from property-expr which is what yup uses for path parsing

Read more comments on GitHub >

github_iconTop Results From Across the Web

Publishing and the Active Directory schema - Microsoft Learn
When you manage on-premises clients, you should extend the Active Directory schema for Configuration Manager. An extended schema can simplify ...
Read more >
Extend schema - Managed Microsoft AD - Google Cloud
Extend the schema. When you initiate schema extension, Managed Microsoft AD creates a schema extension backup automatically before applying the schema changes.
Read more >
Using the expand and contract pattern | Prisma's Data Guide
In this article, we introduce the expand and contract pattern to help migrate data and clients to a new schema.
Read more >
Extend your schema - AWS Directory Service
The process of adding definitions to the schema is referred to as “extending the schema.” Schema extensions make it possible for you to...
Read more >
Learn How To Extend AD Schema For SCCM | ConfigMgr
Extend Active Directory Schema for SCCM · Login to Schema Master DC server with Schema admin access rights · Copy X64 folder needed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found