NaturalIntelligence / nimnjs

JS implementation of nimn specification
https://solothought.com/nimn
Other
45 stars 6 forks source link

Update schema structure #14

Closed amitguptagwl closed 6 years ago

amitguptagwl commented 6 years ago

nimn js use simplified object structure to defined the schema of an object;

 var schema = [{
        "name" : "string" ,
        "age" : "number" ,
        "registered" : "boolean" ,
        "calldetails" : [{
            "from" : "string" ,
            "to" : "string" ,
            "when" : "string" 
        }]
    }
];

This may lead bug in future as it doesn't guarantee the order of keys. Moreover it is recommended that fields with fixed values should be defined in the schema itself. So that it'll easy to switch from one application to other;

Proposed schema


var schema = [
    {
        fieldName : "state",
        type : "fixed",
        values : [
            [ "running",1] , [ "ready", \u1234 ] , [ "stop", 's' ]
        ]
    },{
        fieldName : "desc",
        type : "dynamic",
    },{
        fieldName : "skills",
        type : "list",
        value : {
            type : "dynamic",
        }
    },{
        fieldName : "skills",
        type : "map",
        value : [
            {},{},{}
        ]
    }
]
devamaz commented 6 years ago

I Man can i work on this.

amitguptagwl commented 6 years ago

Sorry man I picked this story few hours back and assigned to myself. Hopefully it'll be finished in next few hours.