Skip to content

Instantly share code, notes, and snippets.

@tejovanthn
Created July 21, 2016 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tejovanthn/c93b2e8953889e87f06e015a057ab7a9 to your computer and use it in GitHub Desktop.
Save tejovanthn/c93b2e8953889e87f06e015a057ab7a9 to your computer and use it in GitHub Desktop.
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