javascript - I there anyway to define a dict in jsoncschema? -


i trying define schema object type. there way allow property name, restrict property values adhere schema. way can allow key , ensure values of same structure/type.

thanks in advance.

the additionalproperties keyword can either boolean or schema.

if it's schema, schema must apply properties don't match either properties or patternproperties. therefore, if keys can anything, schema just:

{     "type": "object",     "additionalproperties": {"type": "integer"} } 

you'd need use patternproperties if want restrict keys - example, lower-case alphabetic only:

{     "type": "object",     "patternproperties": {         "^[a-z]+$": {"type": "object"}     },     "additionalproperties": false } 

since want allow any property name, additionalproperties best solution you.


Comments

Popular posts from this blog

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -