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
Post a Comment