corenova / yang-js

YANG parser and composer
Apache License 2.0
56 stars 18 forks source link

List create function doesn't emit create event or return the new created item #83

Closed quantang closed 5 years ago

quantang commented 5 years ago

I found the yang-js does not emit 'create' event since we changed the list implementations. Besides, the 'create' function returns the list, instead of the newly created entity which is not convenient.

I will try to propose a change to make it later. Please feel free to share your thoughts if you have different opinions.

sekur commented 5 years ago

I've added 'create' event emit. As to the newly created item(s), please refer to yang-express/0.6.6/lib/restjson.js

Instead of having the List.create return a conditional newly created item (if singular), it continues to return the main List property. However, you can now access the List.change property to reference the list of changed list items. I've updated the yang-express restjson so that when you perform a POST (that may contain one or more list items) it returns the List.change which would be one or more newly created items.

quantang commented 5 years ago

Yeah, that looks good to me. Cheers.