def create_jsonschema_from_metaschema(metaschema, required_fields=False, is_reviewer=False):
 json_schema = base_metaschema(metaschema)
 required = []
 for page in metaschema['pages']:
  for question in page['questions']:
   if (is_required(question) and required_fields):
    required.append(question['qid'])
   json_schema['properties'][question['qid']] = {'type': 'object', 'additionalProperties': False, 'properties': extract_question_values(question, required_fields, is_reviewer)}
   if required_fields:
    json_schema['properties'][question['qid']]['required'] = ['value']
  if (required and required_fields):
   json_schema['required'] = required
 return json_schema

def create_jsonschema_from_metaschema ( metaschema , required_fields = False , is_reviewer = False ) : json_schema = base_metaschema ( metaschema ) required = [ ] for page in metaschema [ 'pages' ] : for question in page [ 'questions' ] : if ( is_required ( question ) and required_fields ) : required . append ( question [ 'qid' ] ) json_schema [ 'properties' ] [ question [ 'qid' ] ] = { 'type' : 'object' , 'additionalProperties' : False , 'properties' : extract_question_values ( question , required_fields , is_reviewer ) } if required_fields : json_schema [ 'properties' ] [ question [ 'qid' ] ] [ 'required' ] = [ 'value' ] if ( required and required_fields ) : json_schema [ 'required' ] = required return json_schema
creates jsonschema from registration metaschema for validation .