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

Schema - ReferenceError: Schema is not defined #20

Open
bigoper opened this issue Jul 27, 2021 · 2 comments
Open

Schema - ReferenceError: Schema is not defined #20

bigoper opened this issue Jul 27, 2021 · 2 comments

Comments

@bigoper
Copy link

bigoper commented Jul 27, 2021

Thank you for writing this, I find your library to be super helpful!

ISSUE
Upon execution of your example, I get the following error:

ReferenceError: Schema is not defined

I was not able to locate your definition/import of Schema in your code.

CODE

// custom validation function checking value for a regex
const checkHexColor = val => {
  return /^#[0-9a-fA-F]$/.test(val)
}

const car = new Schema({
  color: {
    type: String,
    use: { checkHexColor }
  }
})
@PseudoCoding
Copy link

ditto this

@MattiSG
Copy link

MattiSG commented Jan 27, 2023

This seems to be a pure documentation issue. Just passing a base JS object instead of trying to instantiate a Schema instance works with validateSchema 🙂

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

No branches or pull requests

3 participants