# Does Yang support "validate" like this?

**URL:** <https://dmap-community.ductus.global/t/does-yang-support-validate-like-this/2649>\
**Category:** YANG\
**Created:** [August 21, 2019, 3:44pm UTC](https://dmap-community.ductus.global/t/does-yang-support-validate-like-this/2649 "2019-08-21T15:44:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![buddha87](https://avatars.discourse-cdn.com/v4/letter/b/5f8ce5/32.png) [@buddha87](https://dmap-community.ductus.global/u/buddha87)\
**Post date:** [August 21, 2019, 3:44pm UTC](https://dmap-community.ductus.global/t/does-yang-support-validate-like-this/2649/1 "2019-08-21T15:44:44Z")

</div>

I am working in a project which has a yang schema like

```auto
    list group {
    list all-models {
       key model;
       leaf model {
           type system-model;
       }
    }

    container $model {
      ...
    }
    }

```

In this case, the type system-model is a customized defined type which is enum. Assuming enum includes : model\_a, model\_b, model\_c.  
Then the continer $model, the reason I used $model is because this container will be augmented from another yang files. So the “list group” may be (depends on how the external yang file augment to this “list group”)

```auto
    list group {
    list all-models {
       key model;
       leaf model {
           type system-model;
       }
    }

    container model_a {
      ...
    }

    container model_b {
      ...
    }
    }

```

Then in this case, the user can’t add “model\_c” to list all-models since container “model\_c” doesn’t exist in list group.  
In this case, is there a way using yang syntax to validate ? If user want to add “model\_c” into list all-models, the confd will report error to prevent user doing that.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [August 23, 2019, 10:47am UTC](https://dmap-community.ductus.global/t/does-yang-support-validate-like-this/2649/2 "2019-08-23T10:47:20Z")

</div>

I’m not sure if such possibility exists. The only thing that occurs to me is validation point in application.
