Exemplo n.º 1
0
static int on_map_key(void *ctx, const unsigned char *str, yajl_size_t len)
{
	YajlContext *yajl_context = (YajlContext *) ctx;
	TokenParam token_param =
	{
		.string = {
			.str = (char const *) str,
			.str_len = len,
		},
	};
	// Object key may mean different tokens for the parser, each schema keyword
	// is a distinct token for the parser.
	const struct JsonSchemaKeyword *k = json_schema_keyword_lookup(str, len);
	JsonSchemaParser(yajl_context->parser,
	                 k ? k->token : TOKEN_KEY_NOT_KEYWORD, token_param,
	                 &yajl_context->parser_ctxt);
	return yajl_context->parser_ctxt.error == SEC_OK;
}
Exemplo n.º 2
0
	// Move parsed features to the validators
	validator_apply_features(v);
	// Combine type validator and other validators contaiters (allOf, anyOf, etc.)
	validator_combine(v);

	if (uri_resolver)
		validator_collect_uri(v, root_scope, uri_resolver);

	// Substitute every SchemaParsing by its type validator for every node
	// in the AST.
	return validator_finalize_parse(v);
}

bool jschema_builder_key(jschema_builder *builder, const char *str, size_t len)
{
	TokenParam token_param =
	{
		.string = {
			.str = (char const *) str,
			.str_len = len,
		},
	};
	// Object key may mean different tokens for the parser, each schema keyword
	// is a distinct token for the parser.
	const struct JsonSchemaKeyword *k = json_schema_keyword_lookup(str, len);
	JsonSchemaParser(builder->parser,
	                 k ? k->token : TOKEN_KEY_NOT_KEYWORD, token_param,
	                 &builder->parser_ctxt);
	return builder->parser_ctxt.error == SEC_OK;
}