Coder Social home page Coder Social logo

evnt's Introduction

Mac Fitton

๐Ÿ“ซ How to reach me:
๐Ÿ“ง [email protected]
Currently learning Electron



evnt's People

Contributors

angelplusultra avatar

Stargazers

 avatar

Watchers

 avatar

evnt's Issues

Yup Validation for sign up schema not enforcing an array of strings for locationTracking property

in server/middleware/validation/validators.js

I have a schema im trying to enforce with yup and ensure that the data inside the array are strings, here is the yup schema:

locationTracking: yup
        .array()
        .of(yup.string())
        .required('locationTracking is required')
        .typeError('locationTracking must be an array')
        .min(1, 'locationTracking must have at least one location'),

    });

I also attempted adding the required and typeError methods


locationTracking: yup
            .array()
            .of(yup.string().require().typeError('data must be strings'))
            .required('locationTracking is required')
            .typeError('locationTracking must be an array')
            .min(1, 'locationTracking must have at least one location'),

        });

the schema enforces that locationTracking is an array but does not enforce that it needs to be an array of strings. Arrays of numbers, booleans etc all fly by this validation.

the data being validated is the req.body being sent as json by postman, i thought theres was some sort of type coercion occurring but when I check for the type of data, it returns number, boolean etc, so completely flying by my validation

Test issue

Yo somethings wrong with this piece of shit app bruh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.