Skip to content

Replace yajl with vendored yyjson for JSON parsing - #134

Open
mattjala wants to merge 5 commits into
HDFGroup:masterfrom
mattjala:yajl_to_yyjson
Open

Replace yajl with vendored yyjson for JSON parsing#134
mattjala wants to merge 5 commits into
HDFGroup:masterfrom
mattjala:yajl_to_yyjson

Conversation

@mattjala

Copy link
Copy Markdown
Collaborator

The REST VOL depended on the unmaintained lloyd/yajl library to parse HSDS's JSON responses. Its ancient CMakeLists (cmake_minimum_required 2.6) fails under CMake 4.x, which broke the Windows CI job that builds yajl from source.

This PR entirely replaces lloyd/yajl with the actively-maintained yyjson library. More specifically:

  • Add JSON helpers in rest_vol.c/.h using yyjson: RV_json_parse, RV_json_get, RV_json_obj_key_at/RV_json_obj_val_at, and RV_json_get_/RV_json_is_ accessors.
  • Port all yajl usage to the new routines.

Some associated build changes:

  • CMake: drop find_package(YAJL) and the yajl link, add yyjson.c to sources, remove the unused CMake/FindYAJL.cmake, its install rule, and the HDF5_VOL_REST_RESOURCES_MOD_DIR variable.
  • Autotools: add yyjson.c to src/Makefile.am, remove -lyajl, the YAJL install-dir flags, the libyajl check and --with-yajl from configure.ac.

mattjala and others added 2 commits July 27, 2026 17:14
The REST VOL depended on the unmaintained lloyd/yajl library to parse
HSDS's JSON responses. Its ancient CMakeLists (cmake_minimum_required 2.6)
fails under CMake 4.x, which broke the Windows CI job that builds yajl from
source.

This PR entirely replaces lloyd/yajl with the actively-maintained
yyjson library. More specifically:

- Add JSON helpers in rest_vol.c/.h using yyjson: RV_json_parse,
  RV_json_get, RV_json_obj_key_at/RV_json_obj_val_at,
  and RV_json_get_*/RV_json_is_* accessors.
- Port all yajl usage to the new routines.

Build changes:
- CMake: drop find_package(YAJL) and the yajl link, add yyjson.c to sources,
  remove the unused CMake/FindYAJL.cmake, its install rule, and the
  HDF5_VOL_REST_RESOURCES_MOD_DIR variable.
- Autotools: add yyjson.c to src/Makefile.am, remove -lyajl, the YAJL
  install-dir flags, the libyajl check and --with-yajl from
  configure.ac.
@mattjala
mattjala requested a review from jhendersonHDF as a code owner July 27, 2026 22:15
Comment thread src/yyjson.c Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a first comment, we should avoid vendoring any dependencies where we can since it will just result in maintenance burden. yyjson appears to ship a CMake .config file, so a simple find_package() call should be enough to setup what we need.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Are we still concerned with supporting autotools builds for the REST VOL, or can we drop it since HDF5 has?

mattjala added 2 commits July 29, 2026 09:11
The connector supported both CMake and Autotools builds, but the Autotools
path was Linux-only and effectively unused. Drop it in favor of CMake as the
single build system.
Replace the vendored copy of yyjson with CMake-based acquisition. Build
uses an installed yyjson if one is found, otherwise FetchContent downloads and
builds a pinned version (0.12.0).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants