static inline bool jstring_to_string_append (jvalue_ref jref, JStreamRef generating) { bool result = (generating->string (generating, jstring_deref(jref)->m_data) != NULL); if (UNLIKELY(!result)) { PJ_LOG_ERR("Schema validation error, string '%s' did not validate against schema", jstring_deref(jref)->m_data.m_str); } return result; }
//Helper function for jobject_to_string_append() static bool key_value_to_string_append (jobject_key_value key_value, JStreamRef generating) { //jvalue_to_string_append is enough for the key if schema validation isn't needed. //->o_key is called for validation. //jvalue_to_string_append (key_value.key, generating); if(generating->o_key(generating, jstring_deref(key_value.key)->m_data)) { //Key was OK - now process the value. if(UNLIKELY(!jvalue_to_string_append (key_value.value, generating))) { return false; } } else { PJ_LOG_ERR("Schema validation error with key: '%s'", jstring_get_fast(key_value.key).m_str); return false; } return true; }
static bool inject_default_jstring(void *ctxt, jvalue_ref ref) { JSAXContextRef context = (JSAXContextRef)ctxt; raw_buffer raw = jstring_deref(ref)->m_data; return context->m_handlers->yajl_string(context, (unsigned char*)raw.m_str, raw.m_len); }