get the schema fields in a comma seperated
form
17248
public function getSchemaString($ctx=null) 
    {
      $str = "";
      if (!$ctx)
          $ctx = $this->schema->fields;

      foreach ($ctx as $f)
          $str.=$f. ",";

      return $str;
    }
721052
function getFields(collection) {

    var message = 'What fields should "' + collection + '" have?\n',
        config;

    config = {
        properties: {
            fields: {
                description: message.magenta +
                '   Comma-separated fieldname:fieldtype pairs (ex: id:index, username:username)\n'.grey,
                type: 'string',
                required: true,
                pattern: FIELDS_REGEXP
            }
        }
    };

    prompt.start();
    prompt.message = '   >> ';
    prompt.delimiter = '';

    return new Promise(function(resolve, reject) {
        prompt.get(config, function(err, result) {
            if (err) return reject(err);
            return resolve(result.fields);
        });
    }).then(function(input) {
        return (input.match(FIELDS_REGEXP) || []).reduce(function(prev, curr) {
            var parts = curr.split(':');
            prev[parts[0]] = parts[1].replace(/\+/g, '}~{'); // with "+" also support name={fistName}~{lastName} concatenations
            return prev;
        }, {});
    });
}
356360
def get_fields(schema, exclude_dump_only=False):
    
    if hasattr(schema, "fields"):
        fields = schema.fields
    elif hasattr(schema, "_declared_fields"):
        fields = copy.deepcopy(schema._declared_fields)
    else:
        raise ValueError(
            "{!r} doesn't have either `fields` or `_declared_fields`.".format(schema)
        )
    Meta = getattr(schema, "Meta", None)
    warn_if_fields_defined_in_meta(fields, Meta)
    return filter_excluded_fields(fields, Meta, exclude_dump_only)
617910
function generateSchemaFile( $schema, $params = array() )
    {
        $sql = '';

        $i = 0;
        foreach ( $schema as $table => $tableDef )
        {
            // Skip the info structure, this is not a table
            if ( $table == '_info' )
                continue;

            if ( $i > 0 )
                $sql .= "\n\n";
            $sql .= $this->generateTableSchema( $table, $tableDef, $params );
            ++$i;
        }

        return $sql;
    }
864412
def get_field_list(fields, schema):
  
  # If the fields weren't supplied get them from the schema.
  if schema:
    all_fields = [f['name'] for f in schema._bq_schema if f['type'] != 'RECORD']

  if isinstance(fields, list):
    if schema:
      # validate fields exist
      for f in fields:
        if f not in all_fields:
          raise Exception('Cannot find field %s in given schema' % f)
    return fields
  if isinstance(fields, basestring) and fields != '*':
    if schema:
      # validate fields exist
      for f in fields.split(','):
        if f not in all_fields:
          raise Exception('Cannot find field %s in given schema' % f)
      return fields.split(',')
  if not schema:
    return []
  return all_fields
629831
def get_params(self, params, name_request):
        '''
        
        '''
        self.write('')
        for elem in params:
            request_type = elem['type'] if elem.get('type', None) else 'schema'
            name = elem['name']
            if elem.get('required', None):
                name += '(required)'
            schema = elem.get('schema', None)
            name = ':{} {} {}:'.format(name_request, request_type, name)
            if schema:
                definition = schema['$ref'].split('/')[-1]
                self.write(name + ' :ref:`{}`'.format(definition), 1)
                self.write('')
            else:
                desc = elem.get('description', '')
                self.write(name)
                self.write('{}'.format(desc), self.indent_depth + 1)
        self.write('')
237419
public function getSchema(Form $form)
    {
        $schema = [
            'name' => $form->getName(),
            'id' => $form->FormName(),
            'action' => $form->FormAction(),
            'method' => $form->FormMethod(),
            'attributes' => $form->getAttributes(),
            'data' => [],
            'fields' => [],
            'actions' => []
        ];

        /** @var FormField $action */
        foreach ($form->Actions() as $action) {
            $schema['actions'][] = $action->getSchemaData();
        }

        /** @var FormField $field */
        foreach ($form->Fields() as $field) {
            $schema['fields'][] = $field->getSchemaData();
        }

        return $schema;
    }
1191431
public function serializeSchema()
    {
        $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
        $xml = '';
        // imports
        if (sizeof($this->imports) > 0) {
            foreach ($this->imports as $ns => $list) {
                foreach ($list as $ii) {
                    if ($ii['location'] != '') {
                        $xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n";
                    } else {
                        $xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n";
                    }
                }
            }
        }
        // complex types
        foreach ($this->complexTypes as $typeName => $attrs) {
            $contentStr = '';
            // serialize child elements
            if (isset($attrs['elements']) && (count($attrs['elements']) > 0)) {
                foreach ($attrs['elements'] as $element => $eParts) {
                    if (isset($eParts['ref'])) {
                        $contentStr .= "   <$schemaPrefix:element ref=\"$element\"/>\n";
                    } else {
                        $contentStr .= "   <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\"";
                        foreach ($eParts as $aName => $aValue) {
                            // handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable
                            if ($aName != 'name' && $aName != 'type') {
                                $contentStr .= " $aName=\"$aValue\"";
                            }
                        }
                        $contentStr .= "/>\n";
                    }
                }
                // compositor wraps elements
                if (isset($attrs['compositor']) && ($attrs['compositor'] != '')) {
                    $contentStr = "  <$schemaPrefix:$attrs[compositor]>\n" . $contentStr . "  </$schemaPrefix:$attrs[compositor]>\n";
                }
            }
            // attributes
            if (isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)) {
                foreach ($attrs['attrs'] as $attr => $aParts) {
                    $contentStr .= "    <$schemaPrefix:attribute";
                    foreach ($aParts as $a => $v) {
                        if ($a == 'ref' || $a == 'type') {
                            $contentStr .= " $a=\"" . $this->contractQName($v) . '"';
                        } elseif ($a == 'http://schemas.xmlsoap.org/wsdl/:arrayType') {
                            $this->usedNamespaces['wsdl'] = $this->namespaces['wsdl'];
                            $contentStr .= ' wsdl:arrayType="' . $this->contractQName($v) . '"';
                        } else {
                            $contentStr .= " $a=\"$v\"";
                        }
                    }
                    $contentStr .= "/>\n";
                }
            }
            // if restriction
            if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != '') {
                $contentStr = "   <$schemaPrefix:restriction base=\"" . $this->contractQName($attrs['restrictionBase']) . "\">\n" . $contentStr . "   </$schemaPrefix:restriction>\n";
                // complex or simple content
                if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)) {
                    $contentStr = "  <$schemaPrefix:complexContent>\n" . $contentStr . "  </$schemaPrefix:complexContent>\n";
                }
            }
            // finalize complex type
            if ($contentStr != '') {
                $contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n" . $contentStr . " </$schemaPrefix:complexType>\n";
            } else {
                $contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n";
            }
            $xml .= $contentStr;
        }
        // simple types
        if (isset($this->simpleTypes) && count($this->simpleTypes) > 0) {
            foreach ($this->simpleTypes as $typeName => $eParts) {
                $xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n  <$schemaPrefix:restriction base=\"" . $this->contractQName($eParts['type']) . "\">\n";
                if (isset($eParts['enumeration'])) {
                    foreach ($eParts['enumeration'] as $e) {
                        $xml .= "  <$schemaPrefix:enumeration value=\"$e\"/>\n";
                    }
                }
                $xml .= "  </$schemaPrefix:restriction>\n </$schemaPrefix:simpleType>";
            }
        }
        // elements
        if (isset($this->elements) && count($this->elements) > 0) {
            foreach ($this->elements as $element => $eParts) {
                $xml .= " <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\"/>\n";
            }
        }
        // attributes
        if (isset($this->attributes) && count($this->attributes) > 0) {
            foreach ($this->attributes as $attr => $aParts) {
                $xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"" . $this->contractQName($aParts['type']) . "\"\n/>";
            }
        }
        // finish 'er up
        $attr = '';
        foreach ($this->schemaInfo as $k => $v) {
            if ($k == 'elementFormDefault' || $k == 'attributeFormDefault') {
                $attr .= " $k=\"$v\"";
            }
        }
        $el = "<$schemaPrefix:schema$attr targetNamespace=\"$this->schemaTargetNamespace\"\n";
        foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
            $el .= " xmlns:$nsp=\"$ns\"";
        }
        $xml = $el . ">\n" . $xml . "</$schemaPrefix:schema>\n";
        return $xml;
    }
2601
def iter_fields(self, schema: Schema) -> Iterable[Tuple[str, Field]]:
        
        for name in sorted(schema.fields.keys()):
            field = schema.fields[name]
            yield field.dump_to or name, field
656929
function getSchema()
    {
        # Database structure
        $schema = 'CREATE TABLE IF NOT EXISTS ' . $this->table . ' (';
        $sep = PHP_EOL;

        foreach($this->schema as $fld) {
            $schema .= $sep . $fld;
            $sep = ', ' . PHP_EOL;
        }

        $schema .= PHP_EOL . ');' . PHP_EOL;

        # Indecies
        foreach($this->indecies as $index) {
            foreach($index as $type=>$field) {
                $type = strtolower($type);
                switch ($type) {
                    case 'u':
                    case 'unique':
                        $schema .=  'CREATE UNIQUE INDEX ';
                        break;
                    case 'i':
                    case 'index':
                    default:
                        $schema .=  'CREATE INDEX ';
                }
                $schema .=
                    "{$this->table}_{$field}_{$type}" .
                    ' ON ' . $this->table . '(' . $field . ');' . PHP_EOL;
            }
        }

        return $schema;
    }
171914
protected function initSchemaFields()
    {
        $schema = static::getSchemaFields();
        $parser = static::getDatabase()->getParser();

        // prepare field values strip schema definitions
        foreach ($schema as $field) {
            $this->{$field} = $parser->getNotationValue($this->{$field});
        }
    }
272902
def dump(schema):
    
    result = {}

    for name, _ in iteritems(schema.getschemas()):

        if hasattr(schema, name):
            val = getattr(schema, name)

            if isinstance(val, DynamicValue):
                val = val()

            if isinstance(val, Schema):
                val = dump(val)

            result[name] = val

    return result
582800
def columns(self):
        """"""
        result = self.query.result()
        return [field.name for field in result.schema]
157265
function(schemaData) {
    var fields = [];

    if (schemaData &&
           'object' === typeof schemaData &&
           schemaData['fields'] &&
            Array.isArray(schemaData['fields'])) {
      schemaData['fields'].forEach((f) => {
        if (f['field'] && f['type'] && 'nested' !== f['type']) {
          fields.push(f['field']);
        }
      });

    }

    if (fields.length) {
      fields = fields.filter(this.uniqueFilter);
    }

    return fields;
  }
918851
def schema_handler(self, schema):
        '''
        
        '''
        dict_for_render = schema.get('properties', dict()).items()
        if schema.get('$ref', None):
            def_name = schema.get('$ref').split('/')[-1]
            dict_for_render = self.definitions[def_name].get('properties', dict()).items()
        elif schema.get('properties', None) is None:
            return ''

        answer_dict = dict()
        json_dict = dict()
        for opt_name, opt_value in dict_for_render:
            var_type = opt_value.get('format', None) or opt_value.get('type', None) or 'object'
            json_name = self.indent + ':jsonparameter {} {}:'.format(var_type, opt_name)
            json_dict[json_name] = self.get_json_props_for_response(var_type, opt_value)

            answer_dict[opt_name] = self.get_response_example(opt_name, var_type, opt_value)
            if var_type == 'string':
                answer_dict[opt_name] = answer_dict[opt_name].format(opt_name)

        self.write('')
        for line in json.dumps(answer_dict, indent=4).split('\n'):
            self.write(line, self.indent_depth)

        self.write('')
        for json_param_name, json_param_value in json_dict.items():
            desc = '{}{}'.format(
                json_param_value['title'], json_param_value['props_str']
            ) or 'None'
            self.write(json_param_name + ' ' + desc)
753945
def _get_field_mapping(self, schema):
        
        if 'mapping' in schema:
            return schema['mapping']
        elif schema['type'] == 'dict' and 'schema' in schema:
            return self._get_mapping(schema['schema'])
        elif schema['type'] == 'list' and 'schema' in schema.get('schema', {}):
            return self._get_mapping(schema['schema']['schema'])
        elif schema['type'] == 'datetime':
            return {'type': 'date'}
        elif schema['type'] == 'string' and schema.get('unique'):
            return {'type': 'string', 'index': 'not_analyzed'}
882732
function getSchema(key) {
	var matches = key.match(/^\[(.*)\]$/); // key in [] is optional
	if (matches) return [matches[1], exports[matches[1]].optional().allow(null)];
	return [key, exports[key]];
}