版本发布 8
## Hotfix * noexcept member-function custom support fix by @stephenberry in https://github.com/stephenberry/glaze/pull/2452 **Full Changelog**: https://github.com/stephenberry/glaze/compare/v7.3.1...v7.3.2
# Glaze v7.1.0 This release focuses on YAML maturity, networking reliability, container/generic behavior, and platform compatibility. > [!IMPORTANT] glz::generic now supports different underlying map types, but now defaults to a faster, ordered map, which preserves insertion order rather than sorting lexicographically. This ensures proper round tripping for unsorted JSON objects. See documentation for more details: https://stephenberry.github.io/glaze/generic-json ## YAML Maturity YAML support received major hardening and coverage improvements, including parser correctness, conformance, roundtrip behavior, and generic integration. Related pull requests: [#2289](https://github.com/stephenberry/glaze/pull/2289), [#2293](https://github.com/stephenberry/glaze/pull/2293), [#2297](https://github.com/stephenberry/glaze/pull/2297), [#2298](https://github.com/stephenberry/glaze/pull/2298), [#2300](https://github.com/stephenberry/glaze/pull/2300), [#2302](https://github.com/stephenberry/glaze/pull/2302), [#2305](https://github.com/stephenberry/glaze/pull/2305), [#2317](https://github.com/stephenberry/glaze/pull/2317), [#2324](https://github.com/stephenberry/glaze/pull/2324), [#2335](https://github.com/stephenberry/glaze/pull/2335). ## Networking Improvements HTTP/WebSocket behavior was improved across TLS support, handshake compatibility, CPU efficiency, and server internals. Related pull requests: [#2260](https://github.com/stephenberry/glaze/pull/2260), [#2284](https://github.com/stephenberry/glaze/pull/2284), [#2292](https://github.com/stephenberry/glaze/pull/2292), [#2321](https://github.com/stephenberry/glaze/pull/2321), [#2322](https://github.com/stephenberry/glaze/pull/2322), [#2323](https://github.com/stephenberry/glaze/pull/2323). ## Generic and Container Behavior Runtime generic behavior and ordered container support were improved, including insertion-order preservation and additional integer generic access support. Related pull requests: [#2318](https://github.com/stephenberry/glaze/pull/2318), [#2325](https://github.com/stephenberry/glaze/pull/2325), [#2334](https://github.com/stephenberry/glaze/pull/2334). ## Platform and Toolchain Compatibility Compatibility and CI coverage improved for MSVC and ARM targets, along with sanitizer/toolchain robustness fixes. Related pull requests: [#2273](https://github.com/stephenberry/glaze/pull/2273), [#2288](https://github.com/stephenberry/glaze/pull/2288), [#2303](https://github.com/stephenberry/glaze/pull/2303), [#2304](https://github.com/stephenberry/glaze/pull/2304), [#2309](https://github.com/stephenberry/glaze/pull/2309), [#2336](https://github.com/stephenberry/glaze/pull/2336), [#2337](https://github.com/stephenberry/glaze/pull/2337). ## Core Improvements and Fixes Core quality improvements include SIMD/reflection work and correctness fixes around key handling and string conversion behavior. Related pull requests: [#2270](https://github.com/stephenberry/glaze/pull/2270), [#2281](https://github.com/stephenberry/glaze/pull/2281), [#2290](https://github.com/stephenberry/glaze/pull/2290), [#2329](https://github.com/stephenberry/glaze/pull/2329). ## Full Changelog - https://github.com/stephenberry/glaze/compare/v7.0.2...v7.1.0
# v7.0.0 Highlights - Cleaner compiler errors with a smaller core `glz::opts` while still allowing the same compile time customization options. - Faster integer to string serialization using larger tables, but also added `optimization_level` to remove large tables and optimize for size for small, embedded devices. - Lazy parsers for JSON and BEVE - Much more ## Breaking Changes ### Options Refactoring Several options have been renamed and moved to the inheritable options pattern: - `number` → `string_as_number` (more descriptive name) - `raw` → `unquoted` (clearer semantics) - `write_member_functions` → `write_function_pointers` (reflects support for all function pointer types) Old names are preserved as deprecated aliases with clear `static_assert` messages guiding migration. ### Core Options Size Reduction The following options have been removed from `glz::opts` to reduce template instantiation sizes: - `indentation_char` - `indentation_width` - `new_lines_in_arrays` - `quoted_num` - `string_as_number` (formerly `number`) - `unquoted` (formerly `raw`) - `raw_string` - `structs_as_arrays` Users requiring these options should define them in custom structs that inherit from `glz::opts`. This change reduces compiler error verbosity and improves build performance for projects using default options. ### Context Field Rename The `glz::context` field `indentation_level` has been renamed to `depth` ([#2207](https://github.com/stephenberry/glaze/pull/2207)). This field tracks nesting depth during both reading (for stack overflow prevention) and writing (for indentation formatting). --- ## New Features ### Lazy JSON Parser ([#2211](https://github.com/stephenberry/glaze/pull/2211)) Introducing `glz::lazy_json`, a lazy JSON parser that performs **zero upfront processing**. Creating a `lazy_json` object is O(1)—it simply stores a pointer to the buffer. **Key Features:** - **On-demand parsing**: Only parses bytes when accessed - **Indexed views**: Build an index once in O(n) time, then achieve O(1) element retrieval - **Direct deserialization**: New `read_json` overload accepts lazy views directly, enabling ~49% faster single-pass struct deserialization - **Iterator support**: Full range-based for loop compatibility for arrays and objects **When to use:** Ideal for extracting a small number of fields from large JSON documents. **Basic Usage:** ```cpp std::string json = R"({"name":"John","age":30,"active":true})"; auto result = glz::lazy_json(json); if (result) { auto& doc = *result; auto name = doc["name"].get<std::string_view>(); // Only parses "name" auto age = doc["age"].get<int64_t>(); // Only parses "age" } ``` **Nested Access:** ```cpp std::string json = R"({"user":{"profile":{"email":"alice@example.com"}}})"; auto result = glz::lazy_json(json); if (result) { auto email = (*result)["user"]["profile"]["email"].get<std::string_view>(); } ``` **Array Iteration:** ```cpp std::string json = R"({"items":[{"id":1},{"id":2},{"id":3}]})"; auto result = glz::lazy_json(json); if (result) { int64_t sum = 0; for (auto item : (*result)["items"]) { if (auto id = item["id"].get<int64_t>()) { sum += *id; } } } ``` **Indexed Views for O(1) Random Access:** ```cpp auto users = (*result)["users"].index(); // Build index once - O(n) size_t count = users.size(); // O(1) auto user500 = users[500]; // O(1) direct access ``` ### Lazy BEVE Parser ([#2220](https://github.com/stephenberry/glaze/pull/2220)) `glz::lazy_beve` brings the same lazy parsing capabilities to BEVE binary format: - On-demand field access via `operator[]` - Type checking methods: `is_object()`, `is_array()`, `is_string()` - Value extraction through `get<T>()` - Forward iterators for container traversal - Random access indexing via `index()` method - Size queries without full parsing ### Query Parameter and URL Encoding Support ([#2233](https://github.com/stephenberry/glaze/pull/2233)) New `glaze/net/url.hpp` header with comprehensive URL handling: - **URL encoding/decoding**: Handles percent-encoding (`%20` to space, `+` to space) - **Query string parsing**: `parse_urlencoded()` for extracting `key=value` pairs - **URL component splitting**: `split_target()` to separate paths from query strings - **Automatic integration**: HTTP router populates `request.query` automatically - **Zero-allocation options**: High-performance parsing without heap allocations ### BEVE Size Precomputation ([#2206](https://github.com/stephenberry/glaze/pull/2206)) New `glz::beve_size(value)` function calculates exact serialization byte count without performing serialization: - `glz::beve_size()` for tagged serialization - `glz::beve_size_untagged()` for untagged scenarios - `glz::compressed_int_size()` for compressed integer encoding **Use case:** Efficient pre-allocation for shared memory IPC scenarios. ### BEVE Header Inspection ([#2212](https://github.com/stephenberry/glaze/pull/2212), [#2225](https://github.com/stephenberry/glaze/pull/2225)) Inspect BEVE buffer headers without full deserialization: - `glz::beve_peek_header()` returns tag, type, extension type, count, and header size - `glz::beve_peek_header_at()` for inspecting headers at specific offsets - Enables pre-allocation, structure validation, and type-based routing ### TOML: Array of Tables Support ([#2216](https://github.com/stephenberry/glaze/pull/2216)) Full TOML 1.0 specification compliance for array-of-tables: **Writing:** ```toml [[products]] name = "Hammer" sku = 738594937 [[products]] name = "Nail" sku = 284758393 ``` **Reading:** Parser handles `[[array_name]]` sections with proper nesting support. **Override:** `glz::inline_table<&T::member>` wrapper forces inline `{key = value}` syntax. ### Variant Custom Types ([#2208](https://github.com/stephenberry/glaze/pull/2208)) Automatic JSON type deduction for custom types in `std::variant`: ```cpp std::variant<std::string, Amount> v; glz::read_json(v, "42.5"); // Automatically parses as Amount ``` Glaze now infers JSON types by examining the second parameter of custom read lambdas. ### Static Function Pointer Support ([#2223](https://github.com/stephenberry/glaze/pull/2223)) Function pointers are now fully supported: - Works in `glz::meta` definitions and JSON-RPC registries - Serialization to type signature strings with `write_function_pointers` enabled - Fixes stack overflow when registering JSON-RPC methods using static member functions --- ## Improvements ### Performance #### Optimization Levels ([#2214](https://github.com/stephenberry/glaze/pull/2214)) New `optimization_level` option for binary size vs. performance tradeoff: - **Normal (default):** Large lookup tables (40KB) for maximum performance - **Size:** Compact 400-byte tables, ~277KB binary savings for embedded systems #### Faster Integer Serialization Specialized `itoa` routines for 8/16-bit integer types provide performance improvements for these common types. #### Reduced Template Instantiations ([#2200](https://github.com/stephenberry/glaze/pull/2200)) Core template instantiation optimizations reduce compile times and binary sizes. ### Security #### Runtime Size Limits ([#2199](https://github.com/stephenberry/glaze/pull/2199)) Runtime constraints for BEVE and CBOR deserialization: ```cpp struct my_context : glz::context { size_t max_string_length = 1024; size_t max_array_size = 100; size_t max_map_size = 50; }; ``` #### Runtime allocate_raw_pointers ([#2213](https://github.com/stephenberry/glaze/pull/2213)) The `allocate_raw_pointers` option can now be set at runtime for more flexible memory allocation control. ### Compatibility #### Float Format Fallback ([#2204](https://github.com/stephenberry/glaze/pull/2204)) `float_format` now falls back to `snprintf` on platforms without full `std::to_chars` floating-point support. --- ## Bug Fixes - Fixed HTTP POST body additional read issue ([#2235](https://github.com/stephenberry/glaze/pull/2235)) - Fixed `renamed_key_size` calculation ([#2226](https://github.com/stephenberry/glaze/pull/2226)) - Fixed BEVE string key detection and number key parsing in objects (included in [#2220](https://github.com/stephenberry/glaze/pull/2220)) --- ## Migration Guide ### Options Changes If you use custom formatting options, update your code to inherit from `glz::opts`: ```cpp // Before (v6.x) constexpr glz::opts my_opts{.indentation_width = 4}; // After (v7.0.0) struct my_opts : glz::opts { static constexpr uint8_t indentation_width = 4; }; ``` ### Renamed Options ```cpp // Before glz::opts{.number = true} glz::opts{.raw = true} glz::opts{.write_member_functions = true} // After struct my_opts : glz::opts { bool string_as_number = true; }; struct my_opts : glz::opts { bool unquoted = true; }; struct my_opts : glz::opts { bool write_function_pointers = true; }; ``` **Full Changelog**: https://github.com/stephenberry/glaze/compare/v6.5.1...v7.0.0
New formatting controls, TOML enum support, extended binary format validation, and SSL/TLS networking improvements. ## Features ### Float Formatting Control New `float_format` option provides flexible control over floating-point precision in JSON output using C++23 `std::format` specifiers. **Global Option:** ```cpp struct my_opts : glz::opts { static constexpr std::string_view float_format = "{:.2f}"; }; double pi = 3.14159265358979; glz::write<my_opts{}>(pi); // "3.14" ``` **Per-Member Wrapper:** ```cpp template <> struct glz::meta<my_type> { using T = my_type; static constexpr auto value = glz::object( "lat", glz::float_format<&T::latitude, "{:.4f}">, "lon", glz::float_format<&T::longitude, "{:.4f}"> ); }; ``` [#2179](https://github.com/stephenberry/glaze/pull/2179) ### TOML Enum Support Adds enum serialization and deserialization for TOML format, matching existing JSON enum functionality. ```cpp enum class Status { Pending, Active, Completed }; template <> struct glz::meta<Status> { using enum Status; static constexpr auto value = glz::enumerate(Pending, Active, Completed); }; Status s = Status::Active; auto toml = glz::write_toml(s); // Returns: "Active" Status parsed; glz::read_toml(parsed, R"("Completed")"); // parsed == Status::Completed ``` [#2181](https://github.com/stephenberry/glaze/pull/2181) ### `error_on_missing_keys` for BEVE and MessagePack The `error_on_missing_keys` option now works with BEVE and MessagePack formats, not just JSON. When enabled, deserialization fails with a `missing_key` error if required fields are absent. Optional/nullable fields (`std::optional`, `std::unique_ptr`) are still allowed to be missing. [#2184](https://github.com/stephenberry/glaze/pull/2184) ### SSL WebSocket and HTTPS Streaming Support SSL/TLS support for WebSockets (WSS) and HTTPS streaming. **Key Features:** - WSS server support for secure WebSocket connections - HTTPS streaming with `streaming_connection_interface` type erasure - `websocket_connection_interface` for socket-type agnostic handlers - SSL verify mode configuration for WebSocket clients - ASIO 1.32+ compatibility fix for SSL streams ```cpp websocket_client client; client.set_ssl_verify_mode(asio::ssl::verify_none); // For self-signed certs client.connect("wss://localhost:8443/ws"); ``` [#2165](https://github.com/stephenberry/glaze/pull/2165) ## Improvements - **API Consistency:** Added `glz::read_beve_untagged` to match `write_beve_untagged` naming convention. `read_binary_untagged` is now deprecated. [#2178](https://github.com/stephenberry/glaze/pull/2178) - **`GLIBCXX_USE_CXX11_ABI=0` Support:** Glaze can now be used and tested with the legacy GCC ABI. [#2160](https://github.com/stephenberry/glaze/pull/2160) - **MessagePack Fuzz Testing:** Added fuzz testing for MessagePack format. [#2159](https://github.com/stephenberry/glaze/pull/2159) ## Bug Fixes - **Tagged Variant with Empty Structs:** Fixed roundtrip failure for tagged variants containing empty struct types. [#2180](https://github.com/stephenberry/glaze/pull/2180) - **BEVE `std::array<bool, N>` Compilation:** Fixed constexpr compilation error when serializing `std::array<bool, N>` with BEVE format. [#2177](https://github.com/stephenberry/glaze/pull/2177) - **Invalid Control Code Parsing:** Fixed parsing of strings containing invalid control character sequences. [#2169](https://github.com/stephenberry/glaze/pull/2169) - **BEVE Skip Logic:** Fixed bug where boolean and string typed arrays were handled incorrectly when skipping unknown keys in BEVE format. [#2184](https://github.com/stephenberry/glaze/pull/2184) **Full Changelog:** [v6.4.0...v6.4.1](https://github.com/stephenberry/glaze/compare/v6.4.0...v6.4.1)
# CBOR, MessagePack, generic_i64, generic_u64 This release adds support for **CBOR** and **MessagePack** along with enhanced runtime JSON manipulation capabilities and new generic JSON integer types. ## New Formats ### CBOR (Concise Binary Object Representation) Glaze now provides comprehensive support for [CBOR](https://cbor.io/) (RFC 8949). CBOR is an IETF standard that enables excellent interoperability with other languages and systems. #2145 ```c++ #include "glaze/cbor.hpp" my_struct s{}; std::string buffer{}; glz::write_cbor(s, buffer); my_struct result{}; glz::read_cbor(result, buffer); ``` **Key Features:** - **RFC 8949 compliance** - Core CBOR specification support - **RFC 8746 typed arrays** - Bulk memory operations for contiguous numeric containers (vectors, arrays) - **Multi-dimensional arrays** - Row-major (tag 40) and column-major (tag 1040) support - **Eigen matrix support** - Native serialization of fixed and dynamic Eigen matrices - **Complex numbers** - IANA-registered tags (43000, 43001) for single and array complex types - **Floating-point preferred serialization** - Automatically uses the smallest representation (half/single/double) - **Exceptions API** - `glz::ex::write_cbor` / `glz::ex::read_cbor` for exception-based error handling - **Fuzz tested** - Comprehensive fuzzing for robustness #2149 ### MessagePack [MessagePack](https://msgpack.org/) support. #2015 ```c++ #include "glaze/msgpack.hpp" my_struct s{}; std::string buffer{}; glz::write_msgpack(s, buffer); my_struct result{}; glz::read_msgpack(result, buffer); ``` **Key Features:** - **Spec 2.0 compliance** - Core types, extension types, and timestamp extension - **Timestamp extension** - Type -1 per the MessagePack spec with all three formats (32, 64, 96 bit) - **`std::chrono::system_clock::time_point` integration** - **`glz::msgpack::ext`** - Direct handling of MessagePack extension values - **Binary buffers** - Compact `bin*` tags for `std::vector<std::byte>` and similar types - **Partial read/write** - JSON pointer support for selective serialization - **File helpers** - `glz::write_file_msgpack` / `glz::read_file_msgpack` - **Options support** - Works with standard Glaze options --- To use the new formats, include the appropriate headers: - CBOR: `#include "glaze/cbor.hpp"` - MessagePack: `#include "glaze/msgpack.hpp"` --- ## Generic JSON Integer Types New generic JSON types preserve integer precision beyond the 2^53 limit of `double`. #2057 | Type | Number Storage | Use Case | |------|---------------|----------| | `glz::generic` | `double` | Fast, JavaScript-compatible (default) | | `glz::generic_i64` | `int64_t` then `double` | Signed integer precision up to 2^63-1 | | `glz::generic_u64` | `uint64_t` then `int64_t` then `double` | Full unsigned 64-bit range | ```c++ glz::generic_u64 json{}; std::string buffer = R"({"big_id": 18446744073709551615})"; glz::read_json(json, buffer); // Maximum uint64_t preserved exactly assert(json["big_id"].get<uint64_t>() == 18446744073709551615ULL); ``` ## Runtime JSON Manipulation ### Runtime JSON Pointer Support JSON pointer paths can now be defined at runtime. #2150 ```c++ std::string buffer = R"({"action":"DELETE","data":{"x":10}})"; std::string path = "/action"; auto ec = glz::write_at(path, R"("GO!")", buffer); // Result: {"action":"GO!","data":{"x":10}} ``` ### Runtime Partial Write (`write_json_partial`) Specify which fields to serialize at runtime using a whitelist approach. #2153 ```c++ my_struct obj{}; std::vector<std::string> keys = {"name", "x"}; std::string buffer; glz::write_json_partial(obj, keys, buffer); // Only "name" and "x" fields are serialized ``` **Features:** - Output key order matches input container order - Works with `std::vector<std::string>`, `std::vector<std::string_view>`, `std::array`, etc. - Supports standard Glaze options like `prettify` ### Runtime Exclude Write (`write_json_exclude`) Specify which fields to exclude at runtime using a blacklist approach. #2154 ```c++ my_struct obj{}; std::vector<std::string> exclude = {"password", "internal_id"}; std::string buffer; glz::write_json_exclude(obj, exclude, buffer); // All fields except "password" and "internal_id" are serialized ``` ## Networking Improvements ### Templated HTTP Router `basic_http_router` is now templated for custom handler types. #2151 ```c++ // Use custom handler types with the HTTP router glz::basic_http_router<MyCustomHandler> router; ``` ## Additional Improvements - **`raw` option support for `time_point`** - Serialize time points as raw integer values #2147 - **Documentation improvements** - Added `simple_enum` callout and updated documentation website links ## Fixes - **Fixed `raw` and `raw_string` combined options** - Correct behavior when both options are specified #2148 - **MSVC compatibility fix** - Resolved build issues on MSVC #2158 --- **Full Changelog**: https://github.com/stephenberry/glaze/compare/v6.3.0...v6.4.0
# v6.2.0 Major networking and RPC enhancements, including JSON RPC 2.0 registry support, zero-copy REPE handling, and a standardized ABI-stable plugin interface for REPE. ## Breaking Changes * Move `append_arrays` and `error_on_const_read` options out of `glz::opts` by @stephenberry in https://github.com/stephenberry/glaze/pull/2110 - These options are now inheritable options that must be added to a custom options struct. - See [How to Use Inheritable Options](https://github.com/stephenberry/glaze/blob/main/docs/options.md#how-to-use-inheritable-options) * WebSocket Client: `ctx_` changed to `context()` method by @stephenberry in https://github.com/stephenberry/glaze/pull/2106 ```cpp // Before (won't compile) client.ctx_->stop(); // After client.context()->stop(); ``` ## Highlights ### JSON RPC 2.0 Registry Support Added support for [JSON RPC 2.0](https://www.jsonrpc.org/specification) protocol to the registry, enabling standard JSON-based remote procedure calls alongside REPE. ```cpp struct my_api { int counter = 0; std::string greet() { return "Hello, World!"; } int add(int value) { counter += value; return counter; } }; // Create a JSON-RPC registry glz::registry<glz::opts{}, glz::JSONRPC> server{}; my_api api{}; server.on(api); // Call a function auto response = server.call(R"({"jsonrpc":"2.0","method":"greet","id":1})"); // Returns: {"jsonrpc":"2.0","result":"Hello, World!","id":1} // Read a variable response = server.call(R"({"jsonrpc":"2.0","method":"counter","id":2})"); // Returns: {"jsonrpc":"2.0","result":0,"id":2} // Call a function with parameters response = server.call(R"({"jsonrpc":"2.0","method":"add","params":10,"id":3})"); // Returns: {"jsonrpc":"2.0","result":10,"id":3} ``` * https://github.com/stephenberry/glaze/pull/2098 ### REPE Plugin Interface A new standardized plugin interface for REPE enables ABI-stable dynamic plugin systems that work seamlessly with `glz::registry` and `glz::asio_server`. This includes: - Pure C header (`plugin.h`) for cross-compiler compatibility - C++ helper (`plugin_helper.hpp`) for implementing plugins using `glz::registry` - Interface versioning for safe plugin loading ```cpp extern "C" { uint32_t repe_plugin_interface_version() { return REPE_PLUGIN_INTERFACE_VERSION; } const char* repe_plugin_name() { return "calculator"; } repe_buffer repe_plugin_call(const char* request, uint64_t request_size) { return glz::repe::plugin_call(registry, request, request_size); } } ``` * https://github.com/stephenberry/glaze/pull/2097 ### Zero-Copy REPE Handling True zero-copy implementation for the REPE RPC protocol, eliminating unnecessary memory allocations and copies in the hot path: - `parse_request` returns views into the original buffer - `response_builder` writes directly to output buffer ```cpp server.call = [](std::span<const char> request, std::string& response_buffer) { auto result = glz::repe::parse_request(request); // req.query and req.body are views into request registry.call(request, response_buffer); // Zero-copy }; ``` * https://github.com/stephenberry/glaze/pull/2108 ### Indexed `rename_key` API A new indexed `rename_key` API allows transforming JSON keys based on member type information at compile time. This is useful for automatically using enum type names as JSON keys: ```cpp template <> struct glz::meta<AppContext> { template <size_t Index> static constexpr auto rename_key() { using MemberType = glz::member_type_t<AppContext, Index>; if constexpr (std::is_enum_v<MemberType>) { return glz::name_v<MemberType>; } else { return glz::member_nameof<Index, AppContext>; } } }; ``` Output: `{"num":42,"MyEnum":"Second","MyFlag":"Yes"}` * https://github.com/stephenberry/glaze/pull/2083 ### New Compile Time Options * `skip_null_members_on_read` - Skip null values when reading, preserving existing values by @stephenberry in https://github.com/stephenberry/glaze/pull/2086 * `skip_self_constraint` - Disable self constraint validation via a compile time option by @stephenberry in https://github.com/stephenberry/glaze/pull/2121 ## Improvements * asio_server custom call handler for routing and middleware by @stephenberry in https://github.com/stephenberry/glaze/pull/2096 * `glz::merge` support for the registry by @stephenberry in https://github.com/stephenberry/glaze/pull/2088 * REPE buffer helpers by @stephenberry in https://github.com/stephenberry/glaze/pull/2095 * Simplify REPE plugin initialization by @stephenberry in https://github.com/stephenberry/glaze/pull/2119 * CMake improvements by @stephenberry in https://github.com/stephenberry/glaze/pull/2112 * Use `weak_ptr` rather than `shared_ptr` for server lifetime safety by @stephenberry in https://github.com/stephenberry/glaze/pull/2113 * Extract `decode_index_unknown_key` by @stephenberry in https://github.com/stephenberry/glaze/pull/2111 * `std::span` serialization tests by @stephenberry in https://github.com/stephenberry/glaze/pull/2109 * Better client socket connection handling by @stephenberry in https://github.com/stephenberry/glaze/pull/2105 * Safer `unique_socket`, delete copy constructor and assignment by @stephenberry in https://github.com/stephenberry/glaze/pull/2104 * Improve asio client `connected()` status by @stephenberry in https://github.com/stephenberry/glaze/pull/2103 * `repe_plugin_data` struct by @stephenberry in https://github.com/stephenberry/glaze/pull/2099 ## Fixes * WebSocket Client: Fix shared context and improve lifetime safety by @stephenberry in https://github.com/stephenberry/glaze/pull/2106 * Fix concurrent WebSocket connections (thread-safe write queue, RFC 6455 close handshake) by @stephenberry in https://github.com/stephenberry/glaze/pull/2092 * Fix MSVC with `std::uniform_int_distribution<unsigned int>` by @stephenberry in https://github.com/stephenberry/glaze/pull/2085 * Fix GCC warnings in tests by @stephenberry in https://github.com/stephenberry/glaze/pull/2094 * Fix Clang build warnings for unit tests and bump asio dependency versions by @stephenberry in https://github.com/stephenberry/glaze/pull/2107 * Don't export `-Wno-missing-braces` for languages other than C and C++ by @stephenberry in https://github.com/stephenberry/glaze/pull/2076 * Cleanup broken tests by @stephenberry in https://github.com/stephenberry/glaze/pull/2118 ## Testing * Test `error_on_missing_keys` with JSON schema generation by @stephenberry in https://github.com/stephenberry/glaze/pull/2093 * More registry tests by @stephenberry in https://github.com/stephenberry/glaze/pull/2087 ## Documentation Extensive documentation added: - [ASIO Setup Guide](https://github.com/stephenberry/glaze/blob/main/docs/networking/asio-setup.md) - [REPE Plugin Interface](https://github.com/stephenberry/glaze/blob/main/docs/rpc/repe-plugin.md) - [REPE Buffer API](https://github.com/stephenberry/glaze/blob/main/docs/rpc/repe-buffer.md) - [JSON-RPC Registry](https://github.com/stephenberry/glaze/blob/main/docs/rpc/jsonrpc-registry.md) - [Rename Keys](https://github.com/stephenberry/glaze/blob/main/docs/rename-keys.md) - [Compile Time Options](https://github.com/stephenberry/glaze/blob/main/docs/options.md) - WebSocket client documentation updates **Full Changelog**: https://github.com/stephenberry/glaze/compare/v6.1.0...v6.2.0
## New Features * `skip_if` runtime value skipping in https://github.com/stephenberry/glaze/pull/2029 [`skip_if` documentation](https://stephenberry.github.io/glaze/skip-keys/?h=skip_if#value-based-skipping-with-skip_if) ```c++ 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 https://github.com/stephenberry/glaze/pull/2026 ## Improvements * Support for nullable_value_t with BEVE in https://github.com/stephenberry/glaze/pull/2021 * Prevent Clang missing braces warnings in https://github.com/stephenberry/glaze/pull/2024 ## Fixes * Fix websocket closing code and make it more robust by @stephenberry in https://github.com/stephenberry/glaze/pull/2020 * Fix a typo of a field declaration in unknown-keys.md by @ivanka2012 in https://github.com/stephenberry/glaze/pull/2017 * Fix integer UB by @stephenberry in https://github.com/stephenberry/glaze/pull/2023 * Write member functions when `write_member_functions = true` by @stephenberry in https://github.com/stephenberry/glaze/pull/2028 **Full Changelog**: https://github.com/stephenberry/glaze/compare/v6.0.1...v6.0.2
## Better Support for Raw Pointer and Pure Reflection * Raw pointers now follow the `skip_null_members` option for reflected structs * Fixes a segfault for raw pointers with purely reflected structs (now skips or writes out `null` based on options) * Better support for pure reflection and raw pointers by @stephenberry in https://github.com/stephenberry/glaze/pull/1927 ## Improvements * New `glz::has_reflect` concept to check if `glz::reflect<T>` is applicable in https://github.com/stephenberry/glaze/pull/1929 * Variant tag validation for auto-deduced structs by @stephenberry in https://github.com/stephenberry/glaze/pull/1919 * Support for read_binary_untagged with static tags by @stephenberry in https://github.com/stephenberry/glaze/pull/1928 * Support for tagged variants with default case by @stephenberry in https://github.com/stephenberry/glaze/pull/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](https://stephenberry.github.io/glaze/variant-handling) for more documentation ## Fixes * Fix for partial_read when error_on_missing_keys is true by @stephenberry in https://github.com/stephenberry/glaze/pull/1922 **Full Changelog**: https://github.com/stephenberry/glaze/compare/v5.6.1...v5.7.0