https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/mesh.schema.json
358674
function handleMesh (mesh, gltf, ctx, renderer) {
  return mesh.primitives.map((primitive) => {
    const geometryCmp = renderer.geometry(
      handlePrimitive(primitive, gltf, ctx, renderer)
    )
    const materialCmp =
      primitive.material !== undefined
        ? renderer.material(
          handleMaterial(
            gltf.materials[primitive.material],
            gltf,
            ctx,
            renderer
          )
        )
        : renderer.material()

    const components = [
      geometryCmp,
      materialCmp
    ]

    // Create morph
    if (primitive.targets) {
      let sources = {}
      const targets = primitive.targets.reduce((targets, target) => {
        const targetKeys = Object.keys(target)

        targetKeys.forEach(targetKey => {
          const targetName = PEX_ATTRIBUTE_NAME_MAP[targetKey] || targetKey
          targets[targetName] = targets[targetName] || []

          const accessor = getAccessor(gltf.accessors[target[targetKey]], gltf.bufferViews)

          targets[targetName].push(accessor._data)

          if (!sources[targetName]) {
            const sourceAccessor = getAccessor(gltf.accessors[primitive.attributes[targetKey]], gltf.bufferViews)
            sources[targetName] = sourceAccessor._data
          }
        })
        return targets
      }, {})

      const morphCmp = renderer.morph({
        sources,
        targets,
        weights: mesh.weights
      })
      components.push(morphCmp)
    }

    return components
  })
}
24482
function(options) {
    options = options || {}
    var exclude = options.exclude || []
    var schema = []
    var query = []
    var mutation = []

    Object.keys(this.models).forEach(function(modelName) {
      var model = this.models[modelName]
      var definition = model.definition

      if (definition.graphqlHelper.hidden) return // via this.graphQLExclude()
      if (exclude.indexOf(modelName) !== -1) return

      schema.push(model.toGraphQLType())
      schema.push.apply(schema, definition.graphqlHelper.schema)

      query.push.apply(query, definition.graphqlHelper.query)
      mutation.push.apply(mutation, definition.graphqlHelper.mutation)
    }, this)

    if (query.length > 0) {
      schema.push(
        [
          'type Query{',
          query
            .map(function(str) {
              return '  ' + str
            })
            .join('\n'),
          '}'
        ].join('\n')
      )
    }

    if (mutation.length > 0) {
      schema.push(
        [
          'type Mutation{',
          mutation
            .map(function(str) {
              return '  ' + str
            })
            .join('\n'),
          '}'
        ].join('\n')
      )
    }

    return schema.join('\n\n')
  }
21441
def get_json_schema(filename):
    
    file_path = os.path.join("schemas", filename)
    with open(file_path) as f:
        schema = yaml.load(f)
    return schema
844378
function schemaType(schema) {
    let type;
    if (schema.hasOwnProperty('type')) {
        type = schema.type;
    } else if (schema.hasOwnProperty('properties') || schema.hasOwnProperty('allOf') || schema.hasOwnProperty('additionalProperties')) {
        type = 'object';
    } else if (schema.hasOwnProperty('items')) {
        type = 'array';
    }

    switch (type) {
        case 'array':
        case 'boolean':
        case 'file':
        case 'integer':
        case 'number':
        case 'object':
        case 'string':
            return type;
    }
}
1311497
def get_model_schema_and_features(model_dir):
  
  schema_file = os.path.join(model_dir, 'assets.extra', 'schema.json')
  schema = json.loads(file_io.read_file_to_string(schema_file))
  features_file = os.path.join(model_dir, 'assets.extra', 'features.json')
  features_config = json.loads(file_io.read_file_to_string(features_file))
  return schema, features_config
1028340
function initJsonSchema (args) {
    // get global validator instance
    var validator = this.global().validator
    // get schema id based on model name - must be globally unique
    this.schemaId = '/model/'+this.name
    // set option to perform schema validation on created/update
    this.validateSchema = args.validate === false ? false : true
    // create schema for model
    var schema = this.schemaMeta = {
        id: this.schemaId,
        properties: {},
        required: [],
        type: 'object',
    }
    // get data column
    var dataColumn = this.columnName('data')
    // create entry in schema for data if model has data
    if (dataColumn) {
        // schema id for data only
        this.schemaDataId = '/model/'+this.name+'/data'
        // create data schema - meta and data schemas are compiled without
        // ref so that the complete schemas can be easily sent to clients
        var schemaData = this.schemaData = schema.properties[dataColumn] = {
            additionalProperties: args.additionalProperties,
            id: this.schemaDataId,
            properties: {},
            type: 'object',
        }
        // merge schema from args over data schema
        _.merge(schemaData.properties, args.properties)
        // if required properties are set then add
        if (args.required) {
            // required must be array
            if (typeof args.required === 'string') {
                args.required = [args.required]
            }
            // throw error if not array
            assert.ok(Array.isArray(args.required), 'required must be array or string')
            // add list of required properties
            schemaData.required = args.required
        }
        // add data schema
        validator.addSchema(schemaData, this.schemaDataId)
    }
    // create schema for each default column
    _.each(this.defaultColumns, (defaultName, columnName) => {
        // skip data column which is already specified
        if (defaultName === 'data') {
            return
        }
        // get column spec
        var column = this.columns[columnName]
        // if there is not schema for type then skip
        if (!defaultSchemas[column.type]) {
            return
        }
        // get column schema
        var columnSchema = _.cloneDeep(defaultSchemas[column.type])
        // set default schema based on type
        schema.properties[columnName] = columnSchema
        // make property required unless nullable
        if (column.null === false) {
            schema.required.push(columnName)
        }
    })
    // add schema
    validator.addSchema(schema, this.schemaId)
}
508498
def _schema_to_json_file_object(self, schema_list, file_obj):
        
        json.dump(schema_list, file_obj, indent=2, sort_keys=True)
1335190
def lexicographic_sort_schema(schema: GraphQLSchema) -> GraphQLSchema:
    """"""

    def replace_type(type_):
        if is_list_type(type_):
            return GraphQLList(replace_type(type_.of_type))
        elif is_non_null_type(type_):
            return GraphQLNonNull(replace_type(type_.of_type))
        else:
            return replace_named_type(type_)

    def replace_named_type(type_: GraphQLNamedType) -> GraphQLNamedType:
        return type_map[type_.name]

    def replace_maybe_type(maybe_type):
        return maybe_type and replace_named_type(maybe_type)

    def sort_directive(directive):
        kwargs = directive.to_kwargs()
        kwargs.update(
            locations=sorted(directive.locations, key=sort_by_name_key),
            args=sort_args(directive.args),
        )
        return GraphQLDirective(**kwargs)

    def sort_args(args_map):
        args = {}
        for name, arg in sorted(args_map.items()):
            kwargs = arg.to_kwargs()
            kwargs.update(type_=replace_type(arg.type))
            args[name] = GraphQLArgument(**kwargs)
        return args

    def sort_fields(fields_map):
        fields = {}
        for name, field in sorted(fields_map.items()):
            kwargs = field.to_kwargs()
            kwargs.update(type_=replace_type(field.type), args=sort_args(field.args))
            fields[name] = GraphQLField(**kwargs)
        return fields

    def sort_input_fields(fields_map):
        return {
            name: GraphQLInputField(
                replace_type(field.type),
                description=field.description,
                default_value=field.default_value,
                ast_node=field.ast_node,
            )
            for name, field in sorted(fields_map.items())
        }

    def sort_types(arr: List[GraphQLNamedType]) -> List[GraphQLNamedType]:
        return [
            replace_named_type(type_) for type_ in sorted(arr, key=sort_by_name_key)
        ]

    def sort_named_type(type_: GraphQLNamedType) -> GraphQLNamedType:
        if is_scalar_type(type_) or is_introspection_type(type_):
            return type_
        elif is_object_type(type_):
            kwargs = type_.to_kwargs()
            object_type = cast(GraphQLObjectType, type_)
            # noinspection PyTypeChecker
            kwargs.update(
                interfaces=lambda: sort_types(object_type.interfaces),  # type: ignore
                fields=lambda: sort_fields(object_type.fields),
            )
            return GraphQLObjectType(**kwargs)
        elif is_interface_type(type_):
            kwargs = type_.to_kwargs()
            interface_type = cast(GraphQLInterfaceType, type_)
            kwargs.update(fields=lambda: sort_fields(interface_type.fields))
            return GraphQLInterfaceType(**kwargs)
        elif is_union_type(type_):
            kwargs = type_.to_kwargs()
            union_type = cast(GraphQLUnionType, type_)
            # noinspection PyTypeChecker
            kwargs.update(types=lambda: sort_types(union_type.types))  # type: ignore
            return GraphQLUnionType(**kwargs)
        elif is_enum_type(type_):
            kwargs = type_.to_kwargs()
            enum_type = cast(GraphQLEnumType, type_)
            kwargs.update(
                values={
                    name: GraphQLEnumValue(
                        val.value,
                        description=val.description,
                        deprecation_reason=val.deprecation_reason,
                        ast_node=val.ast_node,
                    )
                    for name, val in sorted(enum_type.values.items())
                }
            )
            return GraphQLEnumType(**kwargs)
        elif is_input_object_type(type_):
            kwargs = type_.to_kwargs()
            input_object_type = cast(GraphQLInputObjectType, type_)
            kwargs.update(fields=lambda: sort_input_fields(input_object_type.fields))
            return GraphQLInputObjectType(**kwargs)

        # Not reachable. All possible types have been considered.
        raise TypeError(f"Unexpected type: '{inspect(type_)}'.")  # pragma: no cover

    type_map: Dict[str, GraphQLNamedType] = {
        type_.name: sort_named_type(type_)
        for type_ in sorted(schema.type_map.values(), key=sort_by_name_key)
    }

    return GraphQLSchema(
        types=list(type_map.values()),
        directives=[
            sort_directive(directive)
            for directive in sorted(schema.directives, key=sort_by_name_key)
        ],
        query=replace_maybe_type(schema.query_type),
        mutation=replace_maybe_type(schema.mutation_type),
        subscription=replace_maybe_type(schema.subscription_type),
        ast_node=schema.ast_node,
    )
67041
public function get_item_schema() {
		$schema = array(
			'$schema'    => 'http://json-schema.org/draft-04/schema#',
			'title'      => "{$this->parent_post_type}-revision",
			'type'       => 'object',
			/*
			 * Base properties for every Revision
			 */
			'properties' => array(
				'author'          => array(
					'description' => __( 'The id for the author of the object.' ),
					'type'        => 'integer',
					'context'     => array( 'view', 'edit', 'embed' ),
				),
				'date'            => array(
					'description' => __( 'The date the object was published.' ),
					'type'        => 'string',
					'format'      => 'date-time',
					'context'     => array( 'view', 'edit', 'embed' ),
				),
				'date_gmt'        => array(
					'description' => __( 'The date the object was published, as GMT.' ),
					'type'        => 'string',
					'format'      => 'date-time',
					'context'     => array( 'view', 'edit' ),
				),
				'guid'            => array(
					'description' => __( 'GUID for the object, as it exists in the database.' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit' ),
				),
				'id'              => array(
					'description' => __( 'Unique identifier for the object.' ),
					'type'        => 'integer',
					'context'     => array( 'view', 'edit', 'embed' ),
				),
				'modified'        => array(
					'description' => __( 'The date the object was last modified.' ),
					'type'        => 'string',
					'format'      => 'date-time',
					'context'     => array( 'view', 'edit' ),
				),
				'modified_gmt'    => array(
					'description' => __( 'The date the object was last modified, as GMT.' ),
					'type'        => 'string',
					'format'      => 'date-time',
					'context'     => array( 'view', 'edit' ),
				),
				'parent'          => array(
					'description' => __( 'The id for the parent of the object.' ),
					'type'        => 'integer',
					'context'     => array( 'view', 'edit', 'embed' ),
					),
				'slug'            => array(
					'description' => __( 'An alphanumeric identifier for the object unique to its type.' ),
					'type'        => 'string',
					'context'     => array( 'view', 'edit', 'embed' ),
				),
			),
		);

		$parent_schema = $this->parent_controller->get_item_schema();

		if ( ! empty( $parent_schema['properties']['title'] ) ) {
			$schema['properties']['title'] = $parent_schema['properties']['title'];
		}
		if ( ! empty( $parent_schema['properties']['content'] ) ) {
			$schema['properties']['content'] = $parent_schema['properties']['content'];
		}
		if ( ! empty( $parent_schema['properties']['excerpt'] ) ) {
			$schema['properties']['excerpt'] = $parent_schema['properties']['excerpt'];
		}
		if ( ! empty( $parent_schema['properties']['guid'] ) ) {
			$schema['properties']['guid'] = $parent_schema['properties']['guid'];
		}

		return $this->add_additional_fields_schema( $schema );
	}
115324
def load_schema(file_or_fp):
    
    fp = open(file_or_fp, 'r') if isinstance(file_or_fp, str) else file_or_fp
    obj = json.load(fp)
    schema = Schema(obj)
    return schema
403315
def schema():
    
    tables = orca.list_tables()
    cols = {t: orca.get_table(t).columns for t in tables}
    steps = orca.list_steps()
    injectables = orca.list_injectables()
    broadcasts = orca.list_broadcasts()

    return jsonify(
        tables=tables, columns=cols, steps=steps, injectables=injectables,
        broadcasts=broadcasts)
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)
1156908
def build_schema(
    source: Union[str, Source],
    assume_valid=False,
    assume_valid_sdl=False,
    no_location=False,
    experimental_fragment_variables=False,
) -> GraphQLSchema:
    """"""
    return build_ast_schema(
        parse(
            source,
            no_location=no_location,
            experimental_fragment_variables=experimental_fragment_variables,
        ),
        assume_valid=assume_valid,
        assume_valid_sdl=assume_valid_sdl,
    )
5844
def schemaNewMemParserCtxt(buffer, size):
    
    ret = libxml2mod.xmlSchemaNewMemParserCtxt(buffer, size)
    if ret is None:raise parserError('xmlSchemaNewMemParserCtxt() failed')
    return SchemaParserCtxt(_obj=ret)
1125009
function buildJsonSchema(comments) {

    // skeleton schema object
    var schema = {
        properties: {
        }
    };

    // go through each comment block
    (comments || []).forEach(function(block) {

        // we're only interested in customTags (none standard jsDoc comments i.e. @schema.)
        (block.customTags || []).forEach(function(item) {

            var tag = item.tag.replace('schema.', '');
            var value = item.value || '';

            // skip properties with no value
            if (value === '') return;

            if (block.scope === 'global') {
                schema[tag] = value;
            }
            else {

                // item is a property
                schema.properties[block.name] = schema.properties[block.name] || {};

                // jsdoc-parse lowercase tag names, so we need more case blocks to correct this
                switch (tag) {

                    /* integers */

                    case 'minimum':
                    case 'maximum': {
                        schema.properties[block.name][tag] = parseInt(value, 10);
                    } break;

                    case 'minitems': {
                        schema.properties[block.name].minItems = parseInt(value, 10);
                    } break;

                    case 'maxitems': {
                        schema.properties[block.name].maxItems = parseInt(value, 10);
                    } break;

                    case 'minlength': {
                        schema.properties[block.name].minLength = parseInt(value, 10);
                    } break;

                    case 'maxlength': {
                        schema.properties[block.name].maxLength = parseInt(value, 10);
                    } break;

                    case 'exclusiveminimum': {
                        schema.properties[block.name].exclusiveMinimum = parseInt(value, 10);
                    } break;

                    case 'exclusivemaximum': {
                        schema.properties[block.name].exclusiveMaximum = parseInt(value, 10);
                    } break;

                    case 'divisibleby': {
                        schema.properties[block.name].divisibleBy = parseInt(value, 10);
                    } break;

                    /* boolean's */

                    case 'required': {
                        schema.properties[block.name][tag] = (value === 'true');
                    } break;

                    case 'uniqueitems': {
                        schema.properties[block.name].uniqueItems = (value === 'true');
                    } break;

                    /* strings */

                    case 'extends':
                    case 'id':
                    case 'type':
                    case 'pattern':
                    case 'title':
                    case 'format':
                    case 'disallow':
                    case 'extends':
                    case 'enum':
                    case 'description':
                    case 'name':
                    case 'default':
                    default: {
                        schema.properties[block.name][tag] = value;
                    } break;
                }
            }

        });
    });

    return schema;
}
966067
function generateConfigsFromSchema(schema) {
    const configSet = new RuleConfigSet();

    if (Array.isArray(schema)) {
        for (const opt of schema) {
            if (opt.enum) {
                configSet.addEnums(opt.enum);
            } else if (opt.type && opt.type === "object") {
                if (!configSet.addObject(opt)) {
                    break;
                }

            // TODO (IanVS): support oneOf
            } else {

                // If we don't know how to fill in this option, don't fill in any of the following options.
                break;
            }
        }
    }
    configSet.addErrorSeverity();
    return configSet.ruleConfigs;
}
761816
def json_response_schema( expected_object_schema ):
    
    schema = {
        'type': 'object',
        'properties': {
            'status': {
                'type': 'boolean',
            },
            'indexing': {
                'type': 'boolean',
            },
            'lastblock': {
                'anyOf': [
                    {
                        'type': 'integer',
                        'minimum': 0,
                    },
                    {
                        'type': 'null',
                    },
                ],
            },
        },
        'required': [
            'status',
            'indexing',
            'lastblock'
        ],
    }

    # fold in the given object schema
    schema['properties'].update( expected_object_schema['properties'] )
    schema['required'] = list(set( schema['required'] + expected_object_schema['required'] ))

    return schema