Skip to content

Update/serialization deserialization#46

Merged
IvanMurzak merged 16 commits intomainfrom
update/serialization-deserialization
Jan 5, 2026
Merged

Update/serialization deserialization#46
IvanMurzak merged 16 commits intomainfrom
update/serialization-deserialization

Conversation

@IvanMurzak
Copy link
Copy Markdown
Owner

This pull request improves the serialization logic in the reflection-based converters, with a focus on better integration with custom JsonConverters and enhanced logging for debugging and traceability. The changes ensure that custom converters are used when available, provide more detailed trace logs, and expose the list of registered JSON converters for flexibility.

Enhancements to serialization and logging:

  • The base reflection converter now checks for a custom JsonConverter for the target type before proceeding with internal serialization. If a converter is found, it is used for serialization, and a detailed trace log is emitted. (BaseReflectionConverter.Serialize.cs)
  • The array reflection converter adds trace-level logging at the start of serialization and for each item in the enumerable, including type and index information. (ArrayReflectionConverter.cs) [1] [2]
  • When serializing non-recursively, the logger is now passed through to ensure consistent logging in all serialization paths. (ArrayReflectionConverter.cs)

Improvements to JSON converter management:

  • The JSON serializer exposes a new GetConverters() method, allowing retrieval of all currently registered JsonConverters. This supports dynamic inspection and management of converters. (JsonSerializer.cs)

…hance JsonSerializer to retrieve registered converters
@IvanMurzak IvanMurzak self-assigned this Jan 5, 2026
@IvanMurzak IvanMurzak added the enhancement New feature or request label Jan 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 5, 2026

Test Results

    2 files      2 suites   3m 24s ⏱️
  964 tests   964 ✅ 0 💤 0 ❌
1 928 runs  1 928 ✅ 0 💤 0 ❌

Results for commit 4e936e7.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request enhances the serialization and deserialization system with improved custom JsonConverter integration, enhanced logging, and better API design. The changes add trace-level logging throughout the serialization pipeline, check for custom JsonConverters before using reflection-based converters, and expose converter management capabilities.

Key changes:

  • Added GetConverters() method to expose registered JSON converters
  • Integrated custom JsonConverter checks in serialization/deserialization paths before falling back to reflection converters
  • Enhanced trace logging throughout the serialization pipeline with depth-based indentation
  • Refined the TryPopulate API to require a type parameter instead of optional fallback type

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
JsonSerializer.cs Added GetConverters() method to retrieve registered converters
JsonSchema.cs Added JsonSchemaExporterOptions configuration for null handling
Reflector.cs Added JsonConverter checks before reflection converter usage, improved logging, removed obsolete documentation
Reflector.Populate.cs Enhanced null checking and improved error message formatting
Reflector.Json.cs Converted expression-bodied members to block bodies
Reflector.Error.cs Added depth parameter to ToJson call
Reflector.CallMethod.cs Added depth parameter to ToJson call
SerializedMember.cs Added IsNull() helper method to check for null values
ExtensionsJson.cs Changed ToJson return type to nullable, added depth parameter, updated default value behavior
GenericReflectionConverter.cs Added depth parameter to ToJson call
BaseReflectionConverter.cs Added filtering for ignored fields and properties
BaseReflectionConverter.Serialize.cs Renamed parameter from type to fallbackType, improved log message formatting
BaseReflectionConverter.Populate.cs Changed fallbackType parameter to required type parameter, simplified type resolution
ArrayReflectionConverter.cs Enhanced trace logging for array serialization, added depth parameter
VersionJsonConverter.cs Added JSON schema support by implementing IJsonSchemaConverter
BigIntegerJsonConverter.cs Updated schema to use JsonSchema.Description constant
IReflectionConverter.cs Changed TryPopulate signature to require type parameter
SerializedMemberSchemaTests.cs Added null-forgiving operators for nullable ToJson return
SchemaSerializationValidationTests.cs Added null-forgiving operators for nullable ToJson return
SerializePopulateTests.cs Added success assertion and improved test output formatting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ReflectorNet/src/Extension/ExtensionsJson.cs Outdated
Comment thread ReflectorNet/src/Utils/Json/JsonSerializer.cs Outdated
Comment thread ReflectorNet/src/Converter/Reflection/ArrayReflectionConverter.cs Outdated
Comment thread ReflectorNet/src/Model/SerializedMember.cs Outdated
Comment thread ReflectorNet/src/Converter/Reflection/Base/BaseReflectionConverter.cs Outdated
Comment thread ReflectorNet/src/Converter/Reflection/Base/BaseReflectionConverter.cs Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ReflectorNet/src/Utils/Json/JsonSerializer.cs
Comment thread ReflectorNet/src/Converter/Reflection/Base/BaseReflectionConverter.cs Outdated
Comment thread ReflectorNet/src/Converter/Reflection/Base/BaseReflectionConverter.cs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@IvanMurzak IvanMurzak merged commit 6d38818 into main Jan 5, 2026
2 checks passed
@IvanMurzak IvanMurzak deleted the update/serialization-deserialization branch January 5, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants