Ajv JSON schema validation

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ต.ค. 2024

ความคิดเห็น • 56

  • @jgoebel
    @jgoebel  3 ปีที่แล้ว +12

    What do you think about this video?
    Was the explanation clear?

  • @1arpaxad
    @1arpaxad 2 ปีที่แล้ว +3

    amazing explanations. very nice and clean way to handle input validation

    • @jgoebel
      @jgoebel  2 ปีที่แล้ว

      Glad it was helpful!

  • @sakethraman611
    @sakethraman611 3 ปีที่แล้ว +1

    Great video, thanks a lot for clearly explaining why the error reference needs to be copied.

    • @jgoebel
      @jgoebel  3 ปีที่แล้ว

      thx Saketh 👍

  • @thaynabentodasilva3424
    @thaynabentodasilva3424 2 ปีที่แล้ว

    Awesome!! The video helped me a lot. Thanks!

    • @jgoebel
      @jgoebel  2 ปีที่แล้ว

      Glad it helped!

  • @1arpaxad
    @1arpaxad 2 ปีที่แล้ว +1

    in the validateDto function, you might want to change "res.status(400).json(errors);" to "return res.status(400).json(errors);" to prevent next being called and immediately return the response to the client

    • @TakingItCasual
      @TakingItCasual 2 ปีที่แล้ว

      I get a consistent-return eslint error after implementing your change. Would instead putting the "next();" under an else statement be ideal?

    • @1arpaxad
      @1arpaxad 2 ปีที่แล้ว

      @@TakingItCasual can you send your code snippet after the change?

  • @ezhilarasan9910
    @ezhilarasan9910 ปีที่แล้ว +1

    Can I send the sample json data with the request instead using postman?

  • @dan-louis
    @dan-louis 2 ปีที่แล้ว +1

    Thanks for the video!
    If you are getting a error that says "Cannot set headers after they are sent to the client", you can add an 'else' in front of the 'next()' in validate-dto.js.

    • @jgoebel
      @jgoebel  2 ปีที่แล้ว

      this error means that you have basically instructed the server to send a response and shortly after it you are trying to modify the response by adding an additional header

  • @1arpaxad
    @1arpaxad 2 ปีที่แล้ว +1

    ajv-sanitizer is also a nice library to use with ajv

  • @mohammedaliyaan7130
    @mohammedaliyaan7130 3 ปีที่แล้ว

    Thank you soo much, Ajv concept cleared

    • @jgoebel
      @jgoebel  3 ปีที่แล้ว

      thx Mohammed 👍

  • @alsjdnfansdfk
    @alsjdnfansdfk ปีที่แล้ว

    Nice video, thanks.

    • @jgoebel
      @jgoebel  ปีที่แล้ว

      Glad you liked it!

  • @sdfsfsfd437
    @sdfsfsfd437 ปีที่แล้ว

    Is it also possible to use AJV for FRONTEND data validation?

  • @alisawiali70
    @alisawiali70 11 หลายเดือนก่อน

    Thanke vier mach

    • @jgoebel
      @jgoebel  11 หลายเดือนก่อน

      you're most welcome

  • @NoName-oh9fh
    @NoName-oh9fh 3 ปีที่แล้ว

    А что лучше использовать по вашему опыту для валидаций тела запроса в nodeJS?

    • @jgoebel
      @jgoebel  3 ปีที่แล้ว

      this is ultimately a matter of taste. I'd go with some library. Some people use Ajv, others use yup or express-validator. Any of them works. Ajv has the additional advantage that it is standardized

  • @abhs4932
    @abhs4932 3 ปีที่แล้ว +1

    Good video

    • @jgoebel
      @jgoebel  3 ปีที่แล้ว

      thx abh! 👍

  • @FerdinandJeremy-w2y
    @FerdinandJeremy-w2y 18 วันที่ผ่านมา

    Sporer Expressway

  • @reilwaystation9511
    @reilwaystation9511 2 ปีที่แล้ว

    whenever I hear AJV my mind thinks of JAV

  • @MerleCastillejo-n7f
    @MerleCastillejo-n7f หลายเดือนก่อน

    Howell Knolls

  • @SylvesterHughes-t2g
    @SylvesterHughes-t2g 20 วันที่ผ่านมา

    Maximillian Path

  • @WilcoxChanning
    @WilcoxChanning หลายเดือนก่อน

    Douglas Road

  • @LauraHarris-g3w
    @LauraHarris-g3w หลายเดือนก่อน

    Halvorson View

  • @EricGibbs-y7u
    @EricGibbs-y7u 6 วันที่ผ่านมา

    Furman Forks

  • @TomlinsonNina
    @TomlinsonNina หลายเดือนก่อน

    904 Jody Street

  • @JuttaKoepsel-y7q
    @JuttaKoepsel-y7q 20 วันที่ผ่านมา

    Reggie Mountain

  • @JeffreyRobinson-c8z
    @JeffreyRobinson-c8z หลายเดือนก่อน

    Lonnie Forest

  • @SheridanRobert
    @SheridanRobert หลายเดือนก่อน

    893 Arch Roads

  • @MauriceToth-c3r
    @MauriceToth-c3r หลายเดือนก่อน

    Carter Radial

  • @DustyHildring-x4v
    @DustyHildring-x4v หลายเดือนก่อน

    Hane Knolls

  • @HenryBotras-l1t
    @HenryBotras-l1t 6 วันที่ผ่านมา

    Aida Stravenue

  • @DavidAnderson-k2k
    @DavidAnderson-k2k หลายเดือนก่อน

    Emmitt Points

  • @LeandroMannion-h5y
    @LeandroMannion-h5y หลายเดือนก่อน

    Ariel Spur

  • @MelissaPerez-q5h
    @MelissaPerez-q5h หลายเดือนก่อน

    Hector Crossroad

  • @NorrisRodia-n5h
    @NorrisRodia-n5h หลายเดือนก่อน

    Axel Lakes

  • @DavidAdams-u5v
    @DavidAdams-u5v หลายเดือนก่อน

    Moore Mall

  • @DonPatricia-g2v
    @DonPatricia-g2v หลายเดือนก่อน

    Gracie Flats

  • @DilaraÇetin-y4g
    @DilaraÇetin-y4g หลายเดือนก่อน

    Conn Road

  • @SherlynOhlrich-u3j
    @SherlynOhlrich-u3j หลายเดือนก่อน

    Shanahan Way

  • @RisaMerlini-i6z
    @RisaMerlini-i6z หลายเดือนก่อน

    Ondricka Inlet

  • @BobbyMaggie-e4t
    @BobbyMaggie-e4t หลายเดือนก่อน

    Heaney Islands

  • @CherylKimball-i7e
    @CherylKimball-i7e หลายเดือนก่อน

    Wilton Bypass

  • @CaroleRhames-i2e
    @CaroleRhames-i2e หลายเดือนก่อน

    Lubowitz Stream

  • @PatriciaHarris-s8x
    @PatriciaHarris-s8x หลายเดือนก่อน

    Pagac Fall

  • @KerryMeservey-k4n
    @KerryMeservey-k4n หลายเดือนก่อน

    Ardith Manor

  • @MichealRott-b5x
    @MichealRott-b5x หลายเดือนก่อน

    Hammes Station

  • @ZulaGoshorn-n1u
    @ZulaGoshorn-n1u หลายเดือนก่อน

    Herman Viaduct

  • @ElsyOrmiston
    @ElsyOrmiston หลายเดือนก่อน

    2789 Collin Orchard