This is a script that converts attribute descriptions to JSONSchema as used in Leipzig. It includes two different modes:
- Default mode is compatible with the format used in huscy
- Raw mode is compatible with the format used in castellum
There are two notable things missing from this representation:
- Translations (for label, help text, and choices labels)
- Filter-specific information such as
operators
orfilter_form_class
I did not add support for Categories yet because they are rarely used.
$ ./manage.py attribute_schema
{
"properties": {
"Date of birth": {
"format": "date",
"type": "string"
},
"Handedness": {
"enum": [
"Right",
"Left"
],
"type": "string"
},
"Highest degree": {
"enum": [
"No degree",
"Elementary school",
"Hauptschule",
"Mittlere Reife",
"Abitur",
"Bachelor",
"Master"
],
"type": "string"
},
"Language": {
"type": "string"
}
},
"type": "object"
}
$ ./manage.py attribute_schema --raw
{
"properties": {
"d5": {
"description": "Handedness",
"enum": [
10,
11
],
"type": "integer"
},
"d6": {
"description": "Language",
"type": "string"
},
"d7": {
"description": "Date of birth",
"format": "date",
"type": "string"
},
"d8": {
"description": "Highest degree",
"enum": [
12,
13,
14,
15,
16,
17,
18
],
"type": "integer"
}
},
"type": "object"
}