43 Commits
Author SHA1 Message Date
Andrii Zora 0224018b14 get rid of Resource class
:Release Notes:
remove redundant Resource in JSchema

:Detailed Notes:
Resource reference counter caused concurrency bug

:Testing Performed:
unit tests

:QA Notes:

:Issues Addressed:
[BHV-9935] pbnjson resources reference counting is not thread-safe

Open-webOS-DCO-1.0-Signed-off-by: Andrii Zora <andrii.zora@lge.com>

Change-Id: I3acd5bc92e1697da4b69ffee7202baf11f853bbb
Reviewed-on: https://g2g.palm.com/5917
Reviewed-by: DCO Verification
Reviewed-by: Andrii Zora <andrii.zora@lge.com>
Tested-by: Andrii Zora <andrii.zora@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2014-06-10 02:30:03 -07:00
Andrii Zora 8224ff2aee fix resolving in cross referenced schemas
:Release Notes:
fix resolving in cross referenced schemas

:Detailed Notes:
fix resolving,
add sufficient tests

:Testing Performed:
unit tests

:QA Notes:

:Issues Addressed:
[BHV-9511] libpbnjson: fix resolving in cross referenced schemas

Open-webOS-DCO-1.0-Signed-off-by: Andrii Zora <andrii.zora@lge.com>

Change-Id: Id8c9e2831b3465b937dd9be7a57cf300ab7d00af
Reviewed-on: https://g2g.palm.com/5911
Reviewed-by: DCO Verification
Reviewed-by: Andrii Zora <andrii.zora@lge.com>
Tested-by: Andrii Zora <andrii.zora@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2014-06-10 02:23:33 -07:00
Andrii Zora b10a7d3045 Fix local URI resolution
:Release Notes:
Fix local URI resolution

:Detailed Notes:
fix root_scope when parsing schema from the file
fix local URI resolution in referenced file

:Testing Performed:
unit tests

:QA Notes:

:Issues Addressed:
[BHV-1568] [api] Fix local URI resolution

Open-webOS-DCO-1.0-Signed-off-by: Andrii Zora <andrii.zora@lge.com>

Change-Id: I59c095e64026a9c3000ecc9e7c27c86b4d4e6857
Reviewed-on: https://g2g.palm.com/5801
Reviewed-by: DCO Verification
Reviewed-by: Andrii Zora <andrii.zora@lge.com>
Tested-by: Andrii Zora <andrii.zora@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2014-05-30 02:49:07 -07:00
Nikolay Orliuk 5c3db70d95 drop fragments stack
:Release Notes:

:Detailed Notes:
- removed unused stack of fragments with associated tests
- escape_json_pointer changed to work with non-ASCIIz strings
- fixed compiler/gcc/builtins.h to be able included alone without others
- factored out uri_scope_get_uri_unsafe as access to top of uri_scope
  with expectation that it present

:Testing Performed:
unit tests under desktop

:QA Notes:

:Issues Addressed:
[BHV-8631] libpbnjson: fix 'oneOf' behaviour for fragments without id's

Open-webOS-DCO-1.0-Signed-off-by: Nikolay Orliuk <nikolay.orliuk@lge.com>

Change-Id: Ic9256d8388b3ab35fd4b588cadb6c59864302570
Reviewed-on: https://g2g.palm.com/5797
Reviewed-by: DCO Verification
Reviewed-by: Nikolay Orliuk <nikolay.orliuk@lge.com>
Tested-by: Nikolay Orliuk <nikolay.orliuk@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2014-05-29 03:56:55 -07:00
Alekseyev Oleksandr 6f703a11e3 Provide mechanism to add default values to jvalue
:Release Notes:
Add functional to insert default values to existing jvalues
Default values are defined in schema

:Detailed Notes:

:Testing Performed:
Unit tests + MiniBat

:QA Notes:

:Issues Addressed:
[BHV-3142] Provide possibility to fill-up default values in jvalue according to schema

Open-webOS-DCO-1.0-Signed-off-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>

Change-Id: Idf7909ea2223e82b70354c902bb00be0edbd8c05
Reviewed-on: https://g2g.palm.com/5687
Reviewed-by: DCO Verification
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Tested-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Reviewed-by: Nikolay Orliuk <nikolay.orliuk@lge.com>
Reviewed-by: Sergiy Kryvonos <sergiy.kryvonos@lge.com>
2014-05-22 03:03:25 -07:00
Andrii Zora 5a19d2ce6d Fix compatibility with 2.6 version of pbnjson
:Release Notes:
resolve external references in DomParser

:Detailed Notes:
add reference resolving to support the old interface

:Testing Performed:
unit tests, build

:QA Notes:

:Issues Addressed:
[BHV-1564] Resolve referred schemas right after parsing

Open-webOS-DCO-1.0-Signed-off-by: Andrii Zora <andrii.zora@lge.com>

Change-Id: Ia7b585c63bd271fcc8b0b2324eca2d78fdd84c86
Reviewed-on: https://g2g.palm.com/5664
Reviewed-by: DCO Verification
Reviewed-by: Andrii Zora <andrii.zora@lge.com>
Tested-by: Andrii Zora <andrii.zora@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2014-05-16 06:17:27 -07:00
Andrii Zora 11b3b3631a Add compatibility with 2.6 version of pbnjson
:Release Notes:
add back compatibility

:Detailed Notes:
add deleted virtual methods, mark them deprecated
fix tests

:Testing Performed:
Unit tests, build starfish

:QA Notes:

:Issues Addressed:
[BHV-2621] Develop a command line tool to validate JSON against schema

Open-webOS-DCO-1.0-Signed-off-by: Andrii Zora <andrii.zora@lge.com>

Change-Id: Ib066f36d69db093bfc32f082cd6c72d133868941
Reviewed-on: https://g2g.palm.com/5614
Reviewed-by: DCO Verification
Reviewed-by: Andrii Zora <andrii.zora@lge.com>
Tested-by: Andrii Zora <andrii.zora@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2014-05-12 08:14:53 -07:00
Andrii Zora 01debbf3f0 Merge branch bhv-2621-validator into master
:Release Notes:
Parse JSON to validate against a schema

:Detailed Notes:
Conflicts:
	include/public/pbnjson/cxx/JSchemaFile.h
	src/pbnjson_cxx/JSchemaFile.cpp

:Testing Performed:
Unit tests, starfish build

:QA Notes:

:Issues Addressed:
[BHV-2621] Develop a command line tool to validate JSON against schema

Open-webOS-DCO-1.0-Signed-off-by: Andrii Zora <andrii.zora@lge.com>

Change-Id: Id4f72f76496b03ace94b07e2de521b6893aa0f31
2014-05-08 16:25:20 +03:00
Andrii Zora 0a214cf26c Resolve referred schemas right after parsing
:Release Notes:
Perform resolving references process right after the schema parsing

:Detailed Notes:
change the API
change unit tests

:Testing Performed:
Unit tests

:QA Notes:

:Issues Addressed:
[BHV-1564] Resolve referred schemas right after parsing

Open-webOS-DCO-1.0-Signed-off-by: Andrii Zora <andrii.zora@lge.com>

Change-Id: Id9012b319af14deb10819b8fb9435dc48841410e
Reviewed-on: https://g2g.palm.com/5426
Reviewed-by: DCO Verification
Reviewed-by: Sergiy Kryvonos <sergiy.kryvonos@lge.com>
Reviewed-by: Andrii Zora <andrii.zora@lge.com>
Tested-by: Andrii Zora <andrii.zora@lge.com>
Reviewed-by: Nikolay Orliuk <nikolay.orliuk@lge.com>
2014-05-07 08:35:25 -07:00
Anatolii Sakhnik d66e2ba06c Allow reporting schema parsing errors in C++
:Release Notes:
Allow specifying error callbacks for JSchemaFile.

:Detailed Notes:

:Testing Performed:
Build and unit tests

:QA Notes:

:Issues Addressed:
[BHV-2621] Develop a command line tool to validate JSON against schema

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: Id29a80c6bbfb719c66fa6274706e791fb5073e53
Reviewed-on: https://g2g.palm.com/5470
Reviewed-by: DCO Verification
Reviewed-by: Sergiy Kryvonos <sergiy.kryvonos@lge.com>
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Reviewed-by: Oleksii Rudenko <oleksii.rudenko@lge.com>
Tested-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
2014-05-07 06:44:37 -07:00
Andrii Zora 23e96d0a15 Provide JSON value type in C++ API
:Release Notes:
Provide getType() method for JSON value.

:Detailed Notes:
Add getType() method to JValue class.
Add new method to unit tests.

:Testing Performed:
Unit tests

:QA Notes:

:Issues Addressed:
[BHV-36] pbnjson: Provide JSON value type in C++ API

Open-webOS-DCO-1.0-Signed-off-by: Andrii Zora <andrii.zora@lge.com>

Change-Id: Ib326b95df46d75bcd3d9647dbb4a29d6cf1ab3cc
Reviewed-on: https://g2g.palm.com/5224
Reviewed-by: DCO Verification
Reviewed-by: Andrii Zora <andrii.zora@lge.com>
Tested-by: Andrii Zora <andrii.zora@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2014-04-08 03:18:49 -07:00
Nikolay Orliuk 1164956c4a introduce schema building by traversing jvalue
:Release Notes:
New API to parse schema from jvalue.

:Detailed Notes:
- tie together jtraverse and jschema_builder
- expose schema builder and parsing callbacks in public API
- add unit-tests for parsing schema from jvalue

:Testing Performed:
unit-tests

:QA Notes:

:Issues Addressed:
[BHV-3085] Provide pbnjson API for schema construction from jvalue

Open-webOS-DCO-1.0-Signed-off-by: Nikolay Orliuk <nikolay.orliuk@lge.com>

Change-Id: Ica96a9e7e6826487996e66e63785c49df2e6816c
Reviewed-on: https://g2g.palm.com/5145
Reviewed-by: DCO Verification
Reviewed-by: Nikolay Orliuk <nikolay.orliuk@lge.com>
Tested-by: Nikolay Orliuk <nikolay.orliuk@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2014-04-07 05:51:29 -07:00
Anatolii Sakhnik 4902eeb68b Fix minor issues detected by cppcheck
:Release Notes:
Fix too wide scope of local variables, useless initialization, and
other minor issues.

:Detailed Notes:

:Testing Performed:
Unit tests on desktop

:QA Notes:

:Issues Addressed:
[ANG-849] pbnjson: Investigate and fix issues found by cppcheck

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: I62f3e9981df73db2012dcbfaa1ede0fd4790776e
Reviewed-on: https://g2g.palm.com/4666
Reviewed-by: DCO Verification
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
2014-02-12 05:55:11 -08:00
Alekseyev Oleksandr 178cb73bb7 Add stream sax/dom parsers
:Release Notes:
Add new json parsers with ablility to parse streams

:Detailed Notes:

:Testing Performed:
Unit tests

:QA Notes:

:Issues Addressed:
[ANG-304] pbnjson: Enhance SAX parser API to handle chunked input

Open-webOS-DCO-1.0-Signed-off-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>

Change-Id: If768889ce6097c8a3973c8b62b85172ebea54c5b
Reviewed-on: https://g2g.palm.com/4535
Reviewed-by: DCO Verification
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Tested-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2014-02-12 04:43:45 -08:00
Nikolay Orliuk 453d05fe0a introduce jinvalid value
:Release Notes:
Made a difference between jnull() and invalid value by introducing
jinvalid().

:Detailed Notes:
- added jis_valid to check answer for erroneous result
- extended jis_null to cover jinvalid() also
- jinvalid() returns JV_NULL value

:Testing Performed:
unit tests and performance test on desktop

:QA Notes:

:Issues Addressed:
[ANG-547] pbnjson: clash between error and null-value as result of jdom_parse

Open-webOS-DCO-1.0-Signed-off-by: Nikolay Orliuk <nikolay.orliuk@lge.com>

Change-Id: I85b57891976a4bd6a8ef4ed74fec99d8f0b816ec
Reviewed-on: https://g2g.palm.com/4538
Reviewed-by: DCO Verification
Reviewed-by: Nikolay Orliuk <nikolay.orliuk@lge.com>
Tested-by: Nikolay Orliuk <nikolay.orliuk@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2014-02-03 07:09:47 -08:00
Mykola Kryvonos 45dba1f5d0 Add JSON Schema validation error reporting
:Release Notes:
Added calls of schemaInfo->m_errHandler's functions when validation
against schema failed in C API. Extended JValidation::isValid() API to
provide error handling. Added validation error calls on CPP parsing API.

:Detailed Notes:

:Testing Performed:
Unit tests with valgrind

:QA Notes:

:Issues Addressed:
[GF-43955] pbnjson: Provide information about validation error

Open-webOS-DCO-1.0-Signed-off-by: Mykola Kryvonos <mykola.kryvonos@lge.com>

Change-Id: Ic78b60c7baeed756089ec1f9bd3446c62fa4e8e1
Reviewed-on: https://g2g.palm.com/3874
Reviewed-by: Build Verification
Reviewed-by: Mykola Kryvonos <mykola.kryvonos@lge.com>
Tested-by: Mykola Kryvonos <mykola.kryvonos@lge.com>
Reviewed-by: Keith Derrick <keith.derrick@lge.com>
2013-11-15 14:50:37 -08:00
Mykola Kryvonos 212205b3e7 Add comparison functions to JSON C API
:Release Notes:
Implemented jvalue_equal comparison function for JSON value in C API.

:Detailed Notes:

:Testing Performed:
Unit test with valgrind

:QA Notes:

:Issues Addressed:
[GF-44132] pbnjson: Expand jvalue C API to support JSON values
           comparison

Open-webOS-DCO-1.0-Signed-off-by: Mykola Kryvonos <mykola.kryvonos@lge.com>

Change-Id: I68200e9b6c16bfc01395976175a191f1b752d6c0
Reviewed-on: https://g2g.palm.com/3752
Reviewed-by: Build Verification
Reviewed-by: Mykola Kryvonos <mykola.kryvonos@lge.com>
Tested-by: Mykola Kryvonos <mykola.kryvonos@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
2013-11-01 04:19:04 -07:00
Anatolii Sakhnik d319bbfe0b Document schema validation
:Release Notes:

:Detailed Notes:
Create comments for Doxygen in header files.
Document validation internals.

:Testing Performed:
Doxygen generation succeeded

:QA Notes:

:Issues Addressed:
[GF-38364] pbnjson: Document schema validation

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: Id26d0f0b26d34b3cd31b9309ebdc6247b1e5d062
Reviewed-on: https://g2g.palm.com/3438
Reviewed-by: Build Verification
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
2013-10-17 09:32:17 -07:00
Anatolii Sakhnik 249595d688 Redesign JSON validation against schema
:Release Notes:
Remove previous schema implementation, remove useless tests.
Integrate new schema implementation, add temporary support for "extends"
and type "any". Deliver schema parsing errors somehow.

:Detailed Notes:
Legacy implementation was the bottle-neck for validation performance.
Since jvalue was validated during parsing and generation, it impacted
the performance drastically. The key problems of it were: parsing
schema into jvalue, then interpreting it allocating much memory even
without need.

New implementation on the other hand, parses JSON schema directly
into a dedicated hierarchical data structure Validator, which is aware
of validation. The validator is biased for fast validation in expense
of preprocessing during construction. Advanced techniques are used:
LALR(1) parser generation with LEMON, gperf for keyword recognition,
glib for basic containers implementation.

:Testing Performed:
Unit tests passed, unit tests with memory checker passed.
Smoke test on TV passed.

:QA Notes:

:Issues Addressed:
[GF-13496] pbnjson: Redesign validation against schema
[GF-35713] Make new validator compatible with the old one.
[GF-35717] Fix small issues after validator integration.
[GF-8140] Upgrade libpbnjson to YAJL-2

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: I890063e635b304e61ff9fc62e50e346eb4418dea
Reviewed-on: https://g2g.palm.com/3323
Reviewed-by: Build Verification
Reviewed-by: Mykola Kryvonos <mykola.kryvonos@lge.com>
Tested-by: Mykola Kryvonos <mykola.kryvonos@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Keith Derrick <keith.derrick@lge.com>
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
2013-09-20 02:03:42 -07:00
Anatolii Sakhnik acef3b1474 Update to YAJL-2.0
:Release Notes:
Fix build with YAJL-2.0
Build with clang

:Detailed Notes:

:Testing Performed:
Build succeeded. All unit tests passed

:QA Notes:

:Issues Addressed:
[GF-8140] Upgrade libpbnjson to YAJL-2

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: I6f95cef8cf3cb47ad53aaf28d3372805e568ffa2
Reviewed-on: https://g2g.palm.com/3016
Reviewed-by: Build Verification
Tested-by: Mykola Kryvonos <mykola.kryvonos@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2013-09-02 06:36:17 -07:00
Alekseyev Oleksandr be508ab1a0 Add ability to remove key/value pairs from JValue
:Release Notes:
Add ability to remove key/value pairs from JValue

:Detailed Notes:

:Testing Performed:
New unit test was written.
Unit tests were successfully run with memory error detection

:QA Notes:

:Issues Addressed:
[GF-3287] Support removing properties on pbnjson objects

Open-webOS-DCO-1.0-Signed-off-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>

Change-Id: I6b2b664c5d9feaebea951d6a4d7476b09b4d592f
Reviewed-on: https://g2g.palm.com/3157
Reviewed-by: Build Verification
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Tested-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
2013-08-23 07:54:49 -07:00
Alekseyev Oleksandr 3eefb10b3a Add API to verify jvalue against schema
:Release Notes:
Add C API jvalue_check_schema
Add CPP API JValidator::isValid
Remove a few low-level public C API

:Detailed Notes:
Add APIs to validate jvalue against schema

:Testing Performed:
Internal unit tests were extended to cover new functional
Internal unit tests were successully passed. Tests were run with
control of memory errors

:QA Notes:

:Issues Addressed:
[GF-2836] Validation of json objects against schemas in pbnjson

Open-webOS-DCO-1.0-Signed-off-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>

Change-Id: I0693cfe62e74e293453d45a9b72ec71b70cb8f87
Reviewed-on: https://g2g.palm.com/2854
Reviewed-by: Build Verification
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Tested-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2013-07-26 02:14:41 -07:00
Anatolii Sakhnik 2ebbe1086e Fix public API error checking
:Release Notes:
Check what is passed by the client code carefully to avoid
unexpected crashes.
Fix memory leaks in case of invalid operations on array and object.

:Detailed Notes:
Currently, assert() was used to check that arguments are in valid
ranges. But those asserts are compiled out in release builds and
thus ineffective for client applications. The library should use
explicit checks and error codes (or exceptions in C++) to inform
about incorrect arguments.

:Testing Performed:
Build succeeded.

:QA Notes:

:Issues Addressed:
[GF-8147] libpbnjson: Check and fix type information in all public API

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: Ie40055e4c825fa8838a01ddb3d055126b9fb6811
Reviewed-on: https://g2g.palm.com/2870
Reviewed-by: Build Verification
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Keith Derrick <keith.derrick@lge.com>
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
2013-07-22 02:50:44 -07:00
Anatolii Sakhnik bef4f4cda9 Refactor jobject to use GHashTable
:Release Notes:
Use GHashTable to keep key-value pairs of a JSON object
Use strong djb2 string hash function
Reduce jobject iterators to two functions
Fix automatic tests
Advance version to 2.0.0

:Detailed Notes:
The change is meant to improve the code clarity first of all.
The idea comes from cjson, which uses hash table with double-
linked elements for sequential iteration. JSON doesn't require
any particular order for object members, thus, GHashTableIter
will serve well.

Supposedly, the refactored code will perform better on
JSON object access, and sequential iteration. The performance
of parsing is roughly the same as of the previous implementation.

:Testing Performed:
Built successfully.
Ran automatic tests successfully.
Smoke tested on QEMU and on a real device.

:QA Notes:
The version of the component is 2.0.0 because of incompatible changes
to the JSON object iterators.

:Issues Addressed:
[GF-6969] libpbnjson: Refactor jobject to use GHashTable instead of m_buckets

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: I52fa62a9d6056353bb36945d9b5227b04429071d
Reviewed-on: https://g2g.palm.com/2828
Reviewed-by: Build Verification
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
2013-07-18 04:18:52 -07:00
Tapani Mattila c5de8cd16e Add support of external references in JSON schema
:Release Notes:
Add support of external references in JSON schema.
Add C API jvalue_tostring_schemainfo with support of external resolver.

:Detailed Notes:
The schema parser did not resolve external references, as a result
schema validation failed to validate fields from externals.

:Testing Performed:
Checked using internal unit tests
Starfih-image was built and checked on virtualbox

:QA Notes:

:Issues Addressed:
[GF-4639] pbnjson "$ref" and "extends" keywords not working

Open-webOS-DCO-1.0-Signed-off-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>

Change-Id: I6a6882efe42d2c3abaf576880e3a15c6762dcbfd
Reviewed-on: https://g2g.palm.com/2840
Reviewed-by: Build Verification
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Tested-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2013-07-12 08:10:19 -07:00
Anatolii Sakhnik dc32cb2a05 Remove cosmetic white space errors in source code
:Release Notes:

:Detailed Notes:

:Testing Performed:
Built successfully

:QA Notes:

:Issues Addressed:
[GF-6969] libpbnjson: Refactor jobject to use GHashTable instead of

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: I67973a6dad6cc3c5cef680220f8e9d46673d2ba3
Reviewed-on: https://g2g.palm.com/2834
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Build Verification
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
2013-07-12 01:50:01 -07:00
Maksym Shevchenko c678673fac Assign Copyright to LG Electronics, Inc.
[GF-5644] Convert HP Copyright to LG

Open-webOS-DCO-1.0-Signed-off-by: Maksym Shevchenko <myshevchenko@luxoft.com>

Change-Id: Ia489f76f652d207f9fa1b107cd0a19cd153aeccd
Reviewed-on: https://g2g.palm.com/2626
Reviewed-by: Build Verification
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2013-07-10 01:39:25 -07:00
Alekseyev Oleksandr 83af6a3efb Add JGenerator::serialize without check a schema
:Release Notes:
Add another JGenerator::serialize without schema verification.
It allows to serialize JValue of any type eg. string, int, array, etc.

:Detailed Notes:
Current version of JGenerator::serialize provides json serialization with
schema verification. As a result simple json values, like string, int,
bool, can not be serialized due to the fact that there is no schema to
validate such json values. The new function will allow to serialize
JValue of any type.

:Testing Performed:
New unit test was implemented

:QA Notes:

:Issues Addressed:
[GF-8543] Provide one more JGenerator::serialize without schema verification

Open-webOS-DCO-1.0-Signed-off-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>

Change-Id: Ib27f353d88c2471e122c7fe4858bb6ca8531ae6d
Reviewed-on: https://g2g.palm.com/2811
Reviewed-by: Build Verification
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Tested-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
2013-07-05 04:36:55 -07:00
Anatolii Sakhnik 6ed786b2ca libpbnjson: Fix memory leak in generator
:Release Notes:
Fix memory leak in JGenerator
Add memory leak samples to the regression tests

:Detailed Notes:
Any call to JGenerator's toString() or serialize() results in a memory
leak.
Reason: jvalue_ref are shared without reference counting, the stack of
the objects being parsed isn't unwinded on failure and so on.
Solution: accurately recycle unused memory.

:Testing Performed:
Valgrind memory check

:QA Notes:

:Issues Addressed:
[GF-7251] pbnjson::JGenerator::serialize leaks memory
[GF-8329] Memory leak in pbnjson

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: I3d8ebefb36a92e5aae4b52c3a67452b844a7bc28
Reviewed-on: https://g2g.palm.com/2793
Reviewed-by: Build Verification
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Tested-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
2013-07-04 09:52:11 -07:00
Alekseyev Oleksandr a2bdcc102c Prohibit change of JValue returned from operator[]
:Release Notes:
Prohibit change of JValue object that is returned from JValue::operator[]

:Detailed Notes:
The json library has other interfaces to change the internal structure or values of JValue object.
Due to the fact that JValue is just a reference to a real json object, using of the bracket
operator can confuse users of the library.

:Testing Performed:
Starfish image was built to detect if other projects were not affected by the change.
It was tested using internal unit tests.

:QA Notes:

:Issues Addressed:
[GF-6380] libpbnjson: Assigning to array or object with bracket operator is not working

Open-webOS-DCO-1.0-Signed-off-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>

Change-Id: I932e30d1894d7e3ce20231fc36590709d5df01cc
Reviewed-on: https://g2g.palm.com/2809
Reviewed-by: Build Verification
Reviewed-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Tested-by: Alekseyev Oleksandr <alekseyev.oleksandr@lge.com>
Reviewed-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>
2013-07-04 05:07:20 -07:00
Anatolii Sakhnik 42c1559c87 Implement JValue::duplicate()
The JValue should be regarded as a shared_ptr, copies of which all
  reference the same object. If a JSON value needs be cloned, it must be
  stated explicitly.

[GF-4132] libpbnjson: original value is changed when copied

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <anatolii.sakhnik@lge.com>

Change-Id: I0ec74271d93a98b9eb83381adf38c9f7638a8d22
2013-06-20 16:17:47 +03:00
Anatolii Sakhnik 8908244744 Added few regression tests for JArray
[GF-3349] Libpbnjson: examine and fix JValue::operator==

Open-webOS-DCO-1.0-Signed-off-by: Anatolii Sakhnik <asakhnik@luxoft.com>

Change-Id: I426e9f4bec9238ab45b77c1b077db023b5db58a6
2013-06-17 12:01:11 +03:00
Alekseyev Oleksandr 76a516cf2f Add one more overload for JValue::operator==
JValue::operator==(const char *) was added in order to prevent C++ resolve const char * to bool.

[GF-6378]libpbnjson: JValue tries to compare C strings as booleans

Open-webOS-DCO-1.0-Signed-off-by: Alekseyev Oleksandr <oalekseyev@luxoft.com>

Change-Id: I6dc9013f31b4d011d3a3b39acc32e3a41ffdb509
2013-06-14 14:50:47 +03:00
Alekseyev Oleksandr ef123c9b8d Add comparison of object`s size in JValue::operator==
One more api was added to perform object`s size calculation.

[GF-6379]libpbnjson: JValue::operator==(JValue) does not check objects' size

Open-webOS-DCO-1.0-Signed-off-by: Alekseyev Oleksandr <oalekseyev@luxoft.com>

Change-Id: I7100405fcad9ec9042dd98fe25cd0557e1f47ac0
2013-06-14 14:50:47 +03:00
Janne Hurskainen be7cc503bc Add rudimentary unit tests for JValue.cpp
Also removes NON_NULL from jvalue_copy and currently the NON_NULL in the
function definition causes the optimizer to remove all NULL checks from
that function, causing NULL dereferencing in worst case scenarios

[GF-6132] libpbnjson: Create unit tests for JValue

Open-webOS-DCO-1.0-Signed-off-by: Janne Hurskainen <janne.hurskainen@lge.com>

Change-Id: If0d78f995ff33d1e2b7e3247701a2ca8d69fa99d
2013-06-05 18:59:37 +03:00
Janne Hurskainen ec0e8949e3 Add schema validation to jgen_stream
[GF-2746] pbnjson::JGenerator::toString ignores schema

Open-webOS-DCO-1.0-Signed-off-by: Janne Hurskainen <janne.hurskainen@palm.com>

Change-Id: Id3712bd2cfc74df5564e08611c0fbc26a5dbc818
2013-05-22 12:35:40 +03:00
DongHeon Jang bc702f4bb9 add schema error reporting of unexpected data type
UNEXPECTED_TYPE is added to ErrorType in schema, so it can be exported
out as sax errorstate

[GF-3835] sam needs more robust error reporting for app parsing errors

Open-webOS-DCO-1.0-Signed-off-by: DongHeon Jang <dongheon.jang@lge.com>

Change-Id: If40dfc06da7c28777687203294c3127039a7cf78
2013-05-20 20:10:37 -07:00
seokjun.lee c4b0611639 add JErrorHandler implementation
Fix missing JErrorHandler constructor & destructor

[GF-3989] sam doc build warning
Open-webOS-DCO-1.0-Signed-off-by: seokjun.lee <sseokjun.lee@lge.com>

Change-Id: I0c2d3a1a0f6808a0314b4d18a89b7e0e12183ea9
2013-05-01 19:28:03 -07:00
seokjun.lee 82399ba9f3 pbnjson error handling
pass detail reason in case required key missing

[GF-2816] pbnjson error handling
Open-webOS-DCO-1.0-Signed-off-by: seokjun.lee <sseokjun.lee@lge.com>

Change-Id: Ia1e10df5dac920ffec10f74d55a3951e63a7e2e6
2013-04-01 11:03:33 -07:00
Nikolay Orlyuk 99b45ebba6 add support for yajl 2.0+
- detect pre yajl_version.h
- support for both yajl version
- use size_t in jtypes.h

Open-webOS-DCO-1.0-Signed-off-by: Nikolay Orliuk <norluk@luxoft.com>
Change-Id: I0846ba87efb52f5ca326dd4ee5cb9d46e65c0d2c
2013-02-17 01:55:36 +02:00
Herb Kuta fd7bc731c4 Add #include <unistd.h> to headers that reference ssize_t
Apparently it gets included implicitly when compiling with gcc 4.6.3 x86
but not when cross-compiling for ARM.

Open-webOS-DCO-1.0-Signed-off-by: Herb Kuta <herb.kuta@palm.com>
Change-Id: I5f010fb8f7583dd75299b0216e662b09622ee48f
2012-09-11 13:29:24 -07:00
Genisim Tsilker f17c3921f0 Correct copyright year range in license blocks
Also add license blocks to files without them (except to JSON files, to
which they can't be added).

Open-webOS-DCO-1.0-Signed-off-by: Herb Kuta <herb.kuta@palm.com>
Change-Id: I2b9a36192dca2d09793b676d7cce71661ed52fef
2012-09-07 12:47:12 -07:00
Genisim Tsilker 757b48a3e1 Move the public headers directory
- Move the public headers directory from src/api to include/public
  to match the recommended source layout.
- WARNING: No content changes; a subsequent commit is required in order
  for this component to be buildable

Change-Id: Ic4a55eadd5cad82297c9359492225f347902b511
2012-08-28 11:31:21 -07:00