def _build_schema_resource(fields):
 infos = []
 for field in fields:
  info = {'name': field.name, 'type': field.field_type, 'mode': field.mode}
  if (field.description is not None):
   info['description'] = field.description
  if (field.fields is not None):
   info['fields'] = _build_schema_resource(field.fields)
  infos.append(info)
 return infos

def _build_schema_resource ( fields ) : infos = [ ] for field in fields : info = { 'name' : field . name , 'type' : field . field_type , 'mode' : field . mode } if ( field . description is not None ) : info [ 'description' ] = field . description if ( field . fields is not None ) : info [ 'fields' ] = _build_schema_resource ( field . fields ) infos . append ( info ) return infos
generate a resource fragment for a schema .