Skip to content

Instantly share code, notes, and snippets.

@tejovanthn tejovanthn/append.py
Created Jul 21, 2016

Embed
What would you like to do?
Lost in dicts
def append(data):
if not data.get('type',None):
return {'type':'object', 'properties':data}
else:
return data
{
"meal": {
"type": "array",
"title": "Meal",
"minItems": 1,
"items": {
"course": {
"type": "array",
"title": "Course",
"items": {
"minof": {
"type": "string",
"title": "Min number"
},
"maxof": {
"type": "string",
"title": "Max number"
},
"options": {
"type": "string",
"title": "Options",
"format": "text"
}
}
}
}
}
}
{
"type": "object",
"properties": {
"meal": {
"type": "array",
"title": "Meal",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"course": {
"type": "array",
"title": "Course",
"items": {
"type": "object",
"properties": {
"minof": {
"type": "string",
"title": "Min number"
},
"maxof": {
"type": "string",
"title": "Max number"
},
"options": {
"type": "string",
"title": "Options",
"format": "text"
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.