Code Monkey home page Code Monkey logo

Comments (4)

bzbarsky-apple avatar bzbarsky-apple commented on June 22, 2024

First, not all constraint checks are skipped for null. Only the ones that list is_null_allowed=True, which are:

  • type constraints
  • minLength/maxLength constraints
  • minValue/maxValue constraints
  • notValue constraint
  • anyOf constraint

This is certainly correct behavior for minValue/maxValue and minLength/maxLength checks if the attribute is nullable. Spec constraints always mean "if the value is not null". See section "7.18.3. Constraint & Value", subsection "7.18.3.6. Nullable in Range", which says:

If data is nullable then null SHALL be a valid value.

So if you have a nullable int with constraint 1-3, the valid values are: null, 1, 2, 3. If you have a nullable string with some length constraints, null is a valid value (and in fact a zero-length string is also allowed, per that same spec section, no matter what the constraints say).

I suspect anyOf is probably correct as well, for the same reason.

I'm not sure what the story here is for non-nullable attributes for which the server nevertheless returns null.

For the notValue bit... that part looks odd to me. We do have some YAML using notValue: null and at first glance those would pass even if the value is in fact null. Checking that now.

from connectedhomeip.

bzbarsky-apple avatar bzbarsky-apple commented on June 22, 2024

And yes, I just confirmed that notValue: null does not fail if the value is in fact null. So we need to fix that.

from connectedhomeip.

bzbarsky-apple avatar bzbarsky-apple commented on June 22, 2024

#32871 should fix notValue: null.

from connectedhomeip.

cecille avatar cecille commented on June 22, 2024

Thanks, Boris. Ok, sounds like the runner is correct, and the test just isn't properly accounting for this case. I'll close this issue and handle it in the test itself.

from connectedhomeip.

Related Issues (20)

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.