| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
| |
json_serializable_default_deserialize_property() fails when called
with an uninitialized value.
This violates the API since value is marked as an out parameter.
Fixes https://gitlab.gnome.org/GNOME/json-glib/issues/39
|
|\
| |
| |
| |
| | |
meson: add tests option
See merge request GNOME/json-glib!19
|
| |
| |
| |
| | |
Give an option to meson to disable `tests` build
|
|/ |
|
|
|
|
|
| |
`json_serializable_serialize_property()` can return NULL, so make that
clear in the documentation (and to GIR).
|
|
|
|
|
| |
We shouldn't rely on g-ir-scanner doing pattern matching on the name of
the function to determine if it's a constructor or not.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is an error to use the following with a missing member:
• json_object_get_int_member
• json_object_get_double_member
• json_object_get_boolean_member
• json_object_get_null_member
• json_object_get_string_member
• json_object_get_array_member
• json_object_get_object_member
Doing so will lead to CRITICALs like these:
Json-CRITICAL **: json_object_get_string_member: assertion
'node != NULL' failed
Instead one of these should be used to determine the existence of the
member:
• json_object_get_member
• json_object_has_member
Or, when available, one can use the corresponding
json_object_get_<type>_member_with_default.
https://gitlab.gnome.org/GNOME/json-glib/issues/24
|
|
|
|
|
|
|
|
|
|
| |
We should use more idiomatic Meson:
- improve the coding style
- ensure that the `json_glib_dep` dependency object also includes
the introspection data, if enabled
- add a separate option for the man page generation
- ensure that json-glib can be used as a subproject
|
|
|
|
|
|
| |
We should allow redirecting the output of the format utility to a file,
instead of dumping everything on the standard output. This makes it
easier to use json-glib-format inside a build system or a CI pipeline.
|
|\
| |
| |
| |
| |
| |
| | |
Add JsonObject getters with fallback value
Closes #4
See merge request GNOME/json-glib!4
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When using the typed getters for JsonObject, the existing API will
automatically fail if the member requested is not present. This is
generally good practice, because JSON data typically does not have a
schema, and thus is has to be validated "on the go"; a JSON object
member that contains `null`, or `0`, or `false`, is indistinguishable
from a JSON object member that does not exist, so we cannot simply
return a scalar value and be done with it.
We can provide an escape hatch, though, for the crowd writing parsers
for JSON data; by using Python as the model, we can add methods that
take a default value as a parameter, and return it as a fallback value
if the requested object member does not exist, or if it's set to `null`.
|
| | |
|
|\ \
| | |
| | |
| | |
| | | |
Leak fix
See merge request GNOME/json-glib!6
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We can’t do this by porting to g_autoptr(), because json-glib needs to
be buildable using MSVC. Sad panda.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://gitlab.gnome.org/GNOME/json-glib/issues/30
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Small leak. With some additional fixes to the tests themselves, this
makes all the tests run valgrind-clean. (See the following commit.)
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://gitlab.gnome.org/GNOME/json-glib/issues/30
|
|\ \ \
| |/ /
|/| |
| | |
| | | |
json-parser: Fix getting immutable root nodes from empty input
See merge request GNOME/json-glib!8
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
If parsing an empty document, it’s allowed to return NULL from
json_parser_get_root(). This was broken for immutable parsers when
immutability support was added (an assertion fails). Fix that, and also
document that json_parser_get_root() may return NULL.
Do the same for json_parser_steal_root() too, which is another way that
the root node may be NULL.
Add a unit test.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Despite my efforts in commit 011c1e424b7 (parts of which were completely
incorrect), the JsonNode documentation still wasn’t particularly helpful
about differentiating between methods which return NULL if the JsonNode
is not of the right type, and methods which emit a critical warning.
Try and improve that across the board, hopefully without saying
blatantly incorrect things this time.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
|
| |
| |
| |
| |
| |
| | |
json_node_unref was added after the autoptr macros were written.
This fixes an assertion failure if using autoptr and json_node_ref.
|
|/ |
|
|
|
|
|
|
| |
Direct comparison should never be used for floating point values.
Fixes #27 and #28.
|
|
|
|
|
| |
We do compare floating point values elsewhere in our code, so we should
ensure that we're doing that with a certain amount of fuzziness.
|
|
|
|
|
| |
Drop the Autotool-isms, and use something more in line with what Meson
expects for configuration options.
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of using `disable_introspection=false`, flip the condition
around, and use `enable-introspection=true`. This avoids the double
negative.
Additionally, we should drop the cross-compilation check; it's entirely
possible to cross-compile introspection data for different platforms and
architectures; this allows the Yocto project to drop a patch for
JSON-GLib.
|
|\ |
|
| |
| |
| |
| |
| |
| | |
This allows callers to avoid extra allocations
when dumping to a preexisting string.
https://bugzilla.gnome.org/show_bug.cgi?id=773504
|
| |
| |
| |
| |
| |
| |
| | |
Use JsonObject's private members_ordered
GQueue instead. This avoids a g_list_copy().
https://bugzilla.gnome.org/show_bug.cgi?id=773504
|
| |
| |
| |
| |
| |
| |
| |
| | |
This makes the list always ordered
and removes the g_list_reverse()
in json_object_get_members().
https://bugzilla.gnome.org/show_bug.cgi?id=773504
|
| |
| |
| |
| |
| | |
We're going to replace it once we bump the dependency on GObject, to
avoid a nasty ifdef hell.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Instead of assuming some compiler and linker flags will work depending
on the platform, we should test them all.
Additionally, we should move all the compiler and linker flag checks in
the same place.
|
| |
| |
| |
| | |
We are only interested in warnings and errors.
|
| | |
|
|/
|
|
|
|
| |
In order to be resilient towards future API bumps, we should have very
few places that deal with the API version encoded inside paths and file
names.
|
|
|
|
|
| |
Avoid cluttering the source directories, and makes finding things
easier.
|
|
|
|
| |
Use variables for common values, instead of duplicating them.
|
|
|
|
|
|
| |
GTest can use environment variables to find the test data in the source
and build directory, so we don't need to copy files around using Python
scripts.
|
|
|
|
|
|
|
| |
This allows finding Python3 on Windows, in order to build and run the
tests.
https://bugzilla.gnome.org/show_bug.cgi?id=780550
|
|
|
|
|
| |
We need to point to the binary, but we're using the wrong name for the
Exec key.
|
|
|
|
|
|
|
|
|
| |
If a JsonObject has no members, json_object_get_members() and
json_object_get_values() will return NULL, so this commit makes that
behavior clear in the docs. It also adds the (nullable) annotation in a
few places in the same file.
https://bugzilla.gnome.org/show_bug.cgi?id=769206
|
|
|
|
|
|
|
|
| |
In json_from_string, just pass the user-provided GError** to
json_parser_load_from_data. Otherwise json_from_string will never
propagate any parser errors back to the caller.
https://bugzilla.gnome.org/show_bug.cgi?id=766281
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
methods
json_builder_add_boolean_value
json_builder_add_double_value
json_builder_add_int_value
json_builder_add_null_value
json_builder_add_string_value
json_builder_add_value
json_builder_begin_array
json_builder_begin_object
json_builder_end_array
json_builder_end_object
json_builder_get_root
json_builder_set_member_name
json_generator_get_root
json_reader_get_error
json_reader_get_member_name
json_reader_get_value
json_serializable_find_property
json_serializable_find_property
json_boxed_serialize
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=758580
|
|
|
|
|
|
| |
matches the json_reader_is_value check.
https://bugzilla.gnome.org/show_bug.cgi?id=758580
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The doc for json-glib misstates the meaning of the JsonPath set notation
operator, as in
$.store.book[0,2]
This does not mean elements 0 to 2 (a range) but rather just elements 0
and 2.
This is correctly handled in the library; it's just the doc that is
wrong.
https://bugzilla.gnome.org/show_bug.cgi?id=768788
|
| |
|
|
|
|
|
|
|
| |
Instead share a single GString in all
dump functions.
https://bugzilla.gnome.org/show_bug.cgi?id=773504
|
|
|
|
|
| |
GLib already has a convenient API for stealing pointer values and
replacing them with NULL, so let's use it.
|
|
|
|
|
|
| |
This avoids copying the root node for the parse-to-node use-case.
https://bugzilla.gnome.org/show_bug.cgi?id=774688
|