Feature/dictionary json schema ignore#18
Merged
IvanMurzak merged 5 commits intomainfrom Oct 23, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances JSON schema generation by adding proper dictionary type detection and handling, while also improving schema validation and ensuring restricted types are not referenced incorrectly.
- Introduces new utility methods (
IsDictionaryandGetDictionaryGenericArguments) for reliable dictionary type detection - Updates schema generation to properly handle dictionaries with
additionalPropertiesinstead of treating them as arrays - Adds validation to prevent restricted types (string, DateTime, etc.) from appearing as
$refreferences
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ReflectorNet/src/Utils/TypeUtils.cs | Adds dictionary detection and generic argument extraction methods |
| ReflectorNet/src/Utils/Json/JsonSchema.cs | Implements dictionary-specific schema generation with additionalProperties and conditional property assignment |
| ReflectorNet/src/Utils/Json/JsonSchema.Internal.cs | Adjusts property assignment order to only add when properties exist |
| ReflectorNet/src/Convertor/Json/SerializedMemberListConverter.cs | Adds SerializedMemberList to defined types list |
| ReflectorNet/src/Convertor/Json/SerializedMemberConverter.cs | Adds SerializedMember to defined types list |
| ReflectorNet.Tests/SchemaTests/SchemaTestBase.cs | Introduces restricted type validation for schema references |
| ReflectorNet.Tests/SchemaTests/CollectionsTests.cs | Updates test assertions to differentiate between array and dictionary schemas |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
This pull request introduces improvements to JSON schema generation and validation logic, especially around handling dictionary types and restricted types, as well as some updates to type definitions in converters. The changes ensure that dictionary types are correctly identified and processed, restricted types are not referenced in schema definitions, and schema properties are set more reliably.
Dictionary Type Handling and Schema Generation
TypeUtils.IsDictionaryandTypeUtils.GetDictionaryGenericArgumentsmethods to reliably detect dictionary types and extract their generic arguments. (ReflectorNet/src/Utils/TypeUtils.cs)AdditionalProperties. (ReflectorNet/src/Utils/Json/JsonSchema.cs)ReflectorNet.Tests/SchemaTests/CollectionsTests.cs)Restricted Type Reference Validation
string,object,DateTime, etc.) that should not appear as$refreferences in schemas. (ReflectorNet.Tests/SchemaTests/SchemaTestBase.cs)$refreferences or$defsdefinitions. (ReflectorNet.Tests/SchemaTests/SchemaTestBase.cs) [1] [2]Schema Property Initialization and Converter Definitions
ReflectorNet/src/Utils/Json/JsonSchema.Internal.cs,ReflectorNet/src/Utils/Json/JsonSchema.cs) [1] [2] [3]SerializedMemberandSerializedMemberListto the list of defined types in their respective converters for completeness. (ReflectorNet/src/Convertor/Json/SerializedMemberConverter.cs,ReflectorNet/src/Convertor/Json/SerializedMemberListConverter.cs) [1] [2]