cmoberg / pyang-json-schema-plugin

Pyang JSON Schema output plugin
Apache License 2.0
27 stars 35 forks source link

Mandatory Field doesn't seem to be mapping to the JSON Schema "required" field #14

Open manny-atx opened 2 years ago

manny-atx commented 2 years ago

Adding leaf nodes under a list property I have doesn't seem to be mapping to the JSON Schema required fields.

Input:

    container interfaces {
        list interface {
            key name;
            leaf name {
                type string;
                mandatory true;
                description "Interface name. Example value: GigabitEthernet 0/0/0";
            }
        }
}

Output:

{
    "title": "ultraconfig-interfaces",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Generated by pyang from module ultraconfig-interfaces",
    "type": "object",
    "properties": {
        "ultraconfig-interfaces:interfaces": {
            "type": "object",
            "properties": {
                "interface": {
                    "type": "array",
                    "items": [{
                        "name": {
                            "type": "string"
                        }
                    }]
                }
            }
        }
    }
}
rahul12130 commented 1 year ago

how you are running this do you have any steps for this