Releases: stephenberry/glaze
v6.0.2
New Features
skip_ifruntime value skipping in #2029
struct user_settings_t {
std::string theme = "light";
int volume = 50;
};
template <>
struct glz::meta<user_settings_t> {
template <class T>
static constexpr bool skip_if(T&& value, std::string_view key, const
glz::meta_context&) {
using V = std::decay_t<T>;
if constexpr (std::same_as<V, std::string>) {
return key == "theme" && value == "light";
}
else if constexpr (std::same_as<V, int>) {
return key == "volume" && value == 50;
}
return false;
}
};- REPE to/from JSON RPC 2.0 in #2026
Improvements
Fixes
- Fix websocket closing code and make it more robust by @stephenberry in #2020
- Fix a typo of a field declaration in unknown-keys.md by @ivanka2012 in #2017
- Fix integer UB by @stephenberry in #2023
- Write member functions when
write_member_functions = trueby @stephenberry in #2028
Full Changelog: v6.0.1...v6.0.2
v6.0.1
Improvements
- Strong ID and deeper cast support for use with map keys with BEVE by @stephenberry in #2002
- Improve parsing for TOML integers by @friedkeenan in #2007
- Better TOML skipping and thus unknown key handling by @stephenberry in #2013
Fixes
- Checking for Opts.comments when skipping ws to fix JSONC parse issue by @stephenberry in #2005
- Fixed read_constraint optional handling with missing-key option by @stephenberry in #2010
Full Changelog: v6.0.0...v6.0.1
v6.0.0
Breaking Changes
- Removed the experimental language interop from
v5.6.0. Allinclude/glaze/interop/*headers, thesrc/interoptarget, and associated tests have been deleted, and theglaze_BUILD_INTEROPCMake option no longer exists. #1976 - Renamed the dynamically typed
glz::json_ttoglz::generic(include/glaze/json/generic.hpp). #1984 - Streaming HTTP clients now surface server-side failures as category-aware
std::error_codeinstances viaglz::http_status_category(). Handlers that assumed generic networking errors should read the status code withglz::http_status_from.
Highlights
Reflection & Metadata
glz::meta::modify
- New
glz::meta<T>::modify, letting you rename fields, add aliases, or append computed keys without re-declaring the full object (include/glaze/core/meta.hpp). See modify reflection guide.
Self Constraints
- Validate the aggregate after deserialization by attaching a
glz::self_constraint, which runs once all members have been populated and reports friendly messages on failure (include/glaze/core/constraint.hpp).
struct cross_constrained
{
int age{};
std::string name{};
};
template <>
struct glz::meta<cross_constrained>
{
using T = cross_constrained;
static constexpr auto combined = [](const T& v) {
return ((v.name.starts_with('A') && v.age > 10) || v.age > 5);
};
static constexpr auto value = object(&T::age, &T::name);
static constexpr auto self_constraint = glz::self_constraint<combined, "Age/name combination invalid">;
};glz::as_array wrapper
- Use
glz::as_array<&T::member>when declaring metadata to serialize/deserialize aggregate members as positional arrays while keeping struct storage.
- by @stephenberry in #1992
Improvements
- More detailed status for http errors by @stephenberry in #1970
- Skip member functions when serializing. by @stephenberry in #1969
- Test gcc15 by @stephenberry in #1979
- glz::skip support for CSV format by @stephenberry in #1983
- CSV char parsing support by @stephenberry in #1989
- Make the return type of TOML match JSON code by @stephenberry in #1995
- CORS preflight requests succeed w/o user stubs by @stephenberry in #1997
Fixes
- Fix CSV parsing for signed integral min and named enums by @stephenberry in #1977
- jmespath fix for unterminated object by @stephenberry in #1978
- Use member_names to support modify and rename together by @stephenberry in #2000
Full Changelog: v5.7.2...v6.0.0
v5.7.2
Improvements
- Support other string key types in handle_unknown by @stephenberry in #1958
- Added PUT request support to HTTP client. by @klaussilveira in #1961
- Add Boost.Asio workflow by @azais-corentin in #1887
- Document with_signals for HTTP server by @stephenberry in #1952
- CSV support when lacking header by @stephenberry in #1945
- Extend csv fuzzer to cover also rowvise operations by @pauldreik in #1827
- Add fuzzer for json jmespath by @pauldreik in #1815
- Construct string_view explicitly by @CrackedMatter in #1963
Fixes
- made stencil spacing preservation more consistent inside section iteration ({{#items}} ... {{/items}}) by @StormLord07 in #1947
- Boost asio compatibility by @azais-corentin in #1948
- Fixed compile error when including both toml and json by @StormLord07 in #1949
- Bounds checking CSV read by @stephenberry in #1954
- Empty string char decoding by @stephenberry in #1957
- Add
usemethod for http_server by @stephenberry in #1968
Full Changelog: v5.7.1...v5.7.2
v5.7.1
Improvements
- Faster BEVE compile time known key writing in #1933
- Prettify support for whitespace by @stephenberry in #1934
- This enables prettified
glz::raw_jsonto be used withinglz::pretiffy_jsoncalls
- This enables prettified
Fixes
- Treat HTTP header names as case-insensitive by @stephenberry in #1940
- Fix quick start doc error handling example by @stephenberry in #1941
- ID preservation for REPE errors by @stephenberry in #1946
Full Changelog: v5.7.0...v5.7.1
v5.7.0
Better Support for Raw Pointer and Pure Reflection
- Raw pointers now follow the
skip_null_membersoption for reflected structs - Fixes a segfault for raw pointers with purely reflected structs (now skips or writes out
nullbased on options) - Better support for pure reflection and raw pointers by @stephenberry in #1927
Improvements
- New
glz::has_reflectconcept to check ifglz::reflect<T>is applicable in #1929 - Variant tag validation for auto-deduced structs by @stephenberry in #1919
- Support for read_binary_untagged with static tags by @stephenberry in #1928
- Support for tagged variants with default case by @stephenberry in #1921
Glaze now supports a default/catch-all variant type by making the ids array shorter than the number of variant alternatives. The first unlabeled type (without a corresponding ID) becomes the default handler for unknown tags.
See Variant Handling for more documentation
Fixes
- Fix for partial_read when error_on_missing_keys is true by @stephenberry in #1922
Full Changelog: v5.6.1...v5.7.0
v5.6.1
Better std::variant support
Read the updated documentation for handling variants
- Support purely reflected structs in variants by @stephenberry in #1913
- Support variant determination via parsability by @stephenberry in #1916
Other Improvements
- Properly specifying REPE formats and validating by @stephenberry in #1908
- Support for std::optional with glz::cast by @stephenberry in #1910
Full Changelog: v5.6.0...v5.6.1
v5.6.0
New Features
C shared library interop (FFI) using Glaze and modern C++ reflection in #1890
Documentation: https://stephenberry.github.io/glaze/interop/
Key transformers in #1889
struct my_struct {
int user_id = 123;
std::string first_name = "John";
};
// Apply camelCase transformation
template <>
struct glz::meta<my_struct> : glz::camel_case {};// JSON output: {"userId":123,"firstName":"John"}
8 Naming Convention Transformers:
camel_case: snake_case → camelCase
pascal_case: snake_case → PascalCase
snake_case: camelCase/PascalCase → snake_case
screaming_snake_case: any → SCREAMING_SNAKE_CASE
kebab_case: any → kebab-case
screaming_kebab_case: any → SCREAMING-KEBAB-CASE
lower_case: any → lowercase
upper_case: any → UPPERCASE
Zero Runtime Overhead: All transformations occur at compile-time through constexpr functions
Use smallest object when encountering ambiguous variants in #1903
Previously, when multiple variant types had overlapping fields (e.g., one type being a subset of
another), Glaze would fail with error_code::no_matching_variant_type. This was particularly
problematic for common patterns like:
- Progressive detail levels (BasicInfo → DetailedInfo → FullInfo)
- Optional field patterns where simpler types are subsets of complex ones
- API versioning where newer types extend older ones
The resolution strategy:
During JSON parsing, when multiple object types in a variant match all their required fields, the type with the minimum field count is automatically selected. This ensures the most specific/appropriate type is chosen.
Improvements
- Remove unneeded CMake VS Code extension from devcontainer by @kaladron in #1893
- devcontainer version updates by @kaladron in #1894
- Update Dockerfile to use official devcontainer image by @kaladron in #1897
- Update CMakePresets.json to use system GCC and G++ compilers by @kaladron in #1899
- glz::json_t struct assignment by @stephenberry in #1902
- Add title and required to generated JSON schema by @oleid in #1850
Full Changelog: v5.5.5...v5.6.0
v5.5.5
Improvements
- Add support for the Boost version of Asio by @azais-corentin in #1863
- Openapi schema by @stephenberry in #1864
- REPE Spec Updates by @stephenberry in #1869
- Faster BEVE serialization for complex typed arrays by @stephenberry in #1872
- JSON: Support reading tuples in variants by @makekryl in #1874
- Network Signal Handling by @stephenberry in #1882
Fixes
- Fix usage of removed function in newer asio versions by @azais-corentin in #1861
- Fix incorrect error message on missing required key by @oleid in #1867
- Read toml tests fixes by @StormLord07 in #1876
- undef Windows.h DELETE macro by @stephenberry in #1878
- Fix MSVC errors by @stephenberry in #1879
Full Changelog: v5.5.4...v5.5.5
v5.5.4
Improvements
- const paths for registry and support for const variables in registry by @stephenberry in #1855
- OpenAPI endpoint for
glz::http_server@stephenberry in #1856
Fixes
- Fix use after move in websocket handshake method by @TheCoconutChef in #1857
- write_beve_untagged(T&&) fix by @stephenberry in #1859
Full Changelog: v5.5.3...v5.5.4