Git Product home page Git Product logo

Comments (5)

ramukima avatar ramukima commented on September 24, 2024

Should the event be raised only after 'the change in model is validated against the schema' ?

from yang-js.

sekur avatar sekur commented on September 24, 2024

To be honest, I wasn't really sure what the behavior for missing leafref should be. Because it is a relational dependency, it may be valid at the time it's being set but it CAN also become invalid if the data it's pointing at changes. So I opted to compute it at the Getter side instead of the Setter side. Which basically means that it currently accepts an invalid/missing leafref while you're setting it (since it may become valid at a future time when the referencing leaf can be resolved).

What I can do is to have it trigger an error - but still accept the data? Not too sure yet on the best approach for this...

from yang-js.

ramukima avatar ramukima commented on September 24, 2024

The missing leafref is reported perfectly fine as seen above. I am not sure whether an 'CU' event must be raised on such things. Every subscription will then need to parse such errors on every event raised and that too for every field in the schema, which is not so good.

How does the system reject an invalid model when I do not pass any value for 'mandatory true' attributes ? Does that as well raise an event so that the model subscriber receives it?

from yang-js.

sekur avatar sekur commented on September 24, 2024

Well, the CU events are raised because the input configuration was not rejected during Setter (despite the fact that missing leafref does make that configuration invalid). Basically we are implicitly treating it as a pseudo-valid configuration. I can also consider having it enforce during Setter so the data itself is rejected?

Except for the leafref case, all other constraint validations take effect during Setter - which means that an error will be thrown and no CUD events will be triggered.

from yang-js.

sekur avatar sekur commented on September 24, 2024

Latest yang-js handles leafref resolution during Setter and will reject invalid value appropriately and not raise any CU events. Closing issue.

from yang-js.

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.