Repository navigation
fix(schema): unwrap Type::Description and Type::Deprecated in Avro and Cap'n Proto helpers - #252
Open
clockblocker wants to merge 1 commit into
Open
clockblocker wants to merge 1 commit into
clockblocker wants to merge 1 commit into
Conversation
…d Cap'n Proto helpers When a custom type exposes a `ReflectionType` (or `rfl::Reflector<T>::ReflType`) wrapped in `rfl::Description` or `rfl::Deprecated`, `Parser_default::make_reference` stores `Type::Description` or `Type::Deprecated` directly in `_definitions[name]`. While `type_to_avro_schema_type` and `type_to_capnproto_schema_type` already unwrapped both wrappers, three schema helper predicates did not: - `rfl::avro::is_named_type` (`src/rfl/avro/to_schema.cpp`): failed to recognize wrapped records/enums as named types, emitting duplicated anonymous `unnamed_N` definitions instead of named references. - `rfl::capnproto::is_named_type` (`include/rfl/capnproto/is_named_type.hpp`): failed to recognize wrapped structs/enums/unions/maps as named types (and was missing `#include <type_traits>` for standalone compilation). - `rfl::capnproto::string_map_to_capnproto_schema_type` (`src/rfl/capnproto/to_schema.cpp`): failed to detect wrapped `Type::Literal` values via `is_literal_type`, emitting invalid generic `Map(Enum)` instead of `ScalarMap`. Adds focused Avro and Cap'n Proto regression tests for `Description`- and `Deprecated`-wrapped custom `ReflectionType` definitions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a custom type wraps its
ReflectionTypeinrfl::Descriptionorrfl::Deprecated, schema definitions store the wrapper node directly.Three Avro and Cap'n Proto helper predicates fail to unwrap those nodes, misclassifying named records and literal enums during schema generation.
Summary
DescriptionandDeprecatednodes in the Avro and Cap'n Proto named-type and literal predicates to match the main schema converters.<type_traits>include toinclude/rfl/capnproto/is_named_type.hppfor standalone builds.For Agents
upstream-queue(8f506eaf) · Score72/100(est.) ·+31/-12(3f)queue-tests/avro/test_description_deprecated_named_type.cpp,queue-tests/capnproto/test_description_deprecated_named_type.cpp