如何使用JSON模式验证YAML

Let's say I want to validate YAML and I convert it to JSON to use the JSON schema.

For example I've YAML like following:

    dep:
     name: ui
     path: ui
     requires:
       name: users
       properties:
       name: users
     name: ui2
     path: be
     requires:
       name: users1

What I want to validate is that the name of dep is unique which can be achieved like following

{
   "$schema":"http://json-schema.org/draft-04/schema#",
   "type":"object",
   "properties":{
      "name":{
         "type":"array",
         "items":{
            "type":"string",
            "pattern":"/^[A-Za-z0-9_-.]+$/"
         },
         "uniqueItems":true
      }
   },
   "required":[
      "name"
   ]
}

But what about the line number for example if user put ui instead ui2 in the second instance of dep, how it should give you the line num?