Skip to content

Extensions/json serialization - #96

Draft
sergio-eld wants to merge 16 commits into
masterfrom
extensions/json-serialization
Draft

sergio-eld wants to merge 16 commits into
masterfrom
extensions/json-serialization

Conversation

@sergio-eld

Copy link
Copy Markdown
Owner

No description provided.

…data

Replace the draft parameterized policy cases with engine-independent pseudo tables, including limits, recovery, and policy interactions. Keep the existing standalone interface checks executable.

Skip optional and expected wrapper metadata while retaining discovery of their value and error records, with coverage for those protocols.
Express duplicate-field cases as a heterogeneous tuple using D(...) >> expect(...), with reusable models and expectation helpers. Record the intended aggregate of named case collections for engine and benchmark reuse.

Move diagnostic codes and value categories into omni::json, defining them independently of parser backends and destination storage types. Export compat::nullopt_t for explicit no-value expectations.
Bind the heterogeneous duplicate cases to an explicitly configured engine, erasing only the model values for GTest registration. Transform diagnostics and compare the complete result in TEST_P with readable failure output. Keep raw typed cases reusable by benchmarks and rename the result transform to transform_diagnostics.
Turn unknown-field, warning/error limit, missing-field recovery and policy-interaction examples into engine-bound DSL cases. Retain heterogeneous model types, explicit engine defaults and readable expected diagnostics. Share the existing TEST_P comparison across groups and cover nested paths, unavailable defaults, non-default-constructible fields and invalid optional/container elements.
Configure unknown-field acceptance through transform_settings instead of the removed strategy builder. Preserve the existing assertions that static storage is neither required nor modified.
Move value erasure, engine binding, and comparison helpers below the conformance case descriptions. Keep registration adapters outside the DSL namespace and remove standalone tests and their dedicated helpers from the conformance suite.
Use reflection to compare model members and the JSON serializer to print erased values, keeping registration adapters below the case descriptions. Spell unknown-field diagnostics in each case through shared helpers and use descriptive model names. Disable optional-model cases with a high-priority FIXME until JSON serialization supports optional fields. Clarify diagnostics tree ownership and clean up formatting.
Cover whole-object and sequence duplicate selection without merging, error and warning budgets shared across nested records, missing versus empty recovery inputs, and valid JSON roots that cannot map to records.
Map scalar roots directly and discover record elements through one reflected_call for the leaf type, including nested and empty vectors. Reuse the mapping context for diagnostics, limits, and recovery; reject empty tree roots with diagnostics before accessing invalid nodes.

Add coverage for scalar values, vector<bool>, nested vectors, record elements, empty sequences, empty trees, and element error paths. Verified the C++11 and C++23 serialization suites.
Move the example into serialization/guide and organize 20 GTest cases around the default interface, local settings, policies, lazy diagnostics, supported mappings, and input ownership. Compare serialization against explicit JSON and YAML documents and document unsupported mappings as commented examples with high-priority TODOs.

Update CMake and README references, support standalone GTest discovery, and retain the json_serialization target. All guide cases passed alongside the C++11/C++23 serialization checks.
Emit null for empty optional roots and record fields, unwrap populated values, and omit null-producing optional sequence elements while retaining zero, false, empty strings, and empty containers. Discover record types through optional wrappers and restore the conformance cases previously blocked by optional writing.

Cover JSON and YAML emission, nested optionals, optional records, and all-empty sequences. Note the proposed as_tree/transform_tree customization path. The C++11 and C++23 serialization suites pass.
Use guide.json for both the CMake target and CTest entry. Replace the private test-header dependency with a local document-normalization helper, and compare explicit JSON/YAML outputs independently of deserialization.

Add optional field and sequence examples and refresh the contents. All 22 guide cases pass.

This branch has not been deployed

No deployments
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.

1 participant