Package: pyjo-mdl
# pyjo-mdlModel definition language for PyjoThis package will allow you to dynamically create pyjo models with adomain specific language created ad-hoc.# Model definition languageWe can define the structure of the model with a json format.Heres a basic example:```{"url": {"type": "url","required": false},"name": {"type": "string"},"rounds": {"type": "array","element": {"type": "embedded","model": {"foo": {"type": "string"},"bar": {"type": "integer","min_value": 100}}}}}```This allows to define models as a set of properties with some typeand validation.As you can see, there are many possible properties in this DSL.We want to keep it as simple as possible to start with,so heres a very basic list of stuff that we plan to addfrom the beginning.More stuff will come in the future as needs arise.# Available properties and options### Some generally available options:- `required`: true if the property must be always filled when providing content. Defaults to true- `type`: type of the property, see below for a proposal of the initial set of properties available### stringBasic string field, may contain any set of UTF-8 characters.Extra options:- `validation`: a regular expression the string must satisfy- `min_length`: Min number of chars in the string, defaults to 0- `max_length`: Max number of chars in the string, defaults to infinite!- `values`: array of all and only possible values for this fieldExample:```{"tag_version": {"type": "string","validation": "^.*-[0-9]\.[0-9]\.[0-9]build[0-9]+$""max_length": 256}}```Example (enum):```{"meal_category": {"type": "string","values": ["smoothie","main dish","dessert",]}}```### integerInteger number. Extras:- `min_value`: min value allowed- `max_value`: max value allowed```{"calories": {"type": "integer","min_value": 0}}```### floatFloating point number. Extras:- `min_value`: min value allowed- `max_value`: max value allowed```{"price": {"type": "float","min_value": 0,"max_value": 99.99}}```### booleanFlag, true or false. Cant be easier than this.```{"hidden": {"type": "boolean"}}```Booleans will automatically consider values in`yes, true, t, y, 1` to be truthy (ignoring case),values in `no, false, f, n, 0` to be falsy. Other string values willraise an exception.### url:URLs are validated with the following regex:`http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+````{"cover_image": {"type": "url"}}```### embeddedRepresents an embedded model that may have no meaning outside of themain model. Its useful to represent some nested data structure.May contain all the properties of a full model. Must contain:- `model`: the model structure being embeddedExample```{"pet": {"type": "embedded","model": {"name": {"type": "string",},"age": {"type": "integer","min_value": 0}}}}```### arrayRepresents a list of fields of any kind, including embedded. Extras:- `element`: defines the kind of element in this array property. It may be of any kind, including embeddedExamples (primitive content):```{"lucky_numbers": {"type": "array","element": {"type": "integer"}}}```Example 2 (embedded complex models):```{"pets": {"type": "array","element": {"type": "embedded","model": {"name": {"type": "string"},"age": {"type": "integer","min_value": 0}}}}}```