Skip to main content
# pyjo-mdl
Model definition language for Pyjo


This package will allow you to dynamically create pyjo models with a
domain specific language created ad-hoc.

# Model definition language

We 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 type
and 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 add
from 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


### string
Basic 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 field

Example:

```
{
"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",
]
}
}
```


### integer
Integer number. Extras:

- `min_value`: min value allowed
- `max_value`: max value allowed

```
{
"calories": {
"type": "integer",
"min_value": 0
}
}
```


### float
Floating point number. Extras:

- `min_value`: min value allowed
- `max_value`: max value allowed

```
{
"price": {
"type": "float",
"min_value": 0,
"max_value": 99.99
}
}
```


### boolean
Flag, 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 will
raise 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"
}
}
```

### embedded
Represents an embedded model that may have no meaning outside of the
main 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 embedded

Example

```
{
"pet": {
"type": "embedded",
"model": {
"name": {
"type": "string",
},
"age": {
"type": "integer",
"min_value": 0
}
}
}
}
```

### array
Represents 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 embedded

Examples (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
}
}
}
}
}
```


Metadata

Release files for pyjo-mdl 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pyjo-mdl 0.1.4
File Interpreter ABI Platform Actions
pyjo_mdl-0.1.4-py2.py3-none-any.whl Python 2, Python 3 none any Details for pyjo_mdl-0.1.4-py2.py3-none-any.whl

Release files / pyjo_mdl-0.1.4-py2.py3-none-any.whl

Download URL pyjo_mdl-0.1.4-py2.py3-none-any.whl
Size 6.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
bf13560a0384630add7d5795bd12581b90a1da9045a391b9c16f086b74c4f748
BLAKE2b-256 checksum
How to use checksums
e9a45ec0543d81f548dc9f4e6be8fb70204cb9769dae8374c94680d21121d69c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15

Security for pyjo-mdl 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page