Fix SerializedMember JSON Schema to accept any value type#36
Fix SerializedMember JSON Schema to accept any value type#36IvanMurzak merged 8 commits intomainfrom
Conversation
- Remove type constraint from 'value' property in SerializedMemberConverter.Schema - Add comprehensive tests in SerializedMemberSchemaTests - All 584 existing tests still pass Co-authored-by: IvanMurzak <9135028+IvanMurzak@users.noreply.github.com>
- Extract numeric detection logic into separate IsNumericJsonValue method - Add support for all numeric types (float, byte, short, uint, ulong, ushort, sbyte) Co-authored-by: IvanMurzak <9135028+IvanMurzak@users.noreply.github.com>
Test Results 3 files ± 0 3 suites ±0 3m 21s ⏱️ +28s For more details on these failures, see this check. Results for commit 7f0a91a. ± Comparison against base commit 99c52b1. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a JSON Schema mismatch where the SerializedMember.value property was constrained to type "object" but actual serialization produces any JSON value type (primitives, arrays, objects, or null) depending on the serialized data.
- Removed the hardcoded
type: "object"constraint from thevalueproperty schema - Added comprehensive test coverage validating schema flexibility and serialization behavior across all JSON value types
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ReflectorNet/src/Convertor/Json/SerializedMemberConverter.cs | Removed the type: "object" constraint from the value property schema definition, allowing it to accept any JSON value type |
| ReflectorNet.Tests/src/SchemaTests/SerializedMemberSchemaTests.cs | Added comprehensive test suite validating that the schema correctly accepts all value types (primitives, arrays, objects, null) and that serialization/deserialization works correctly for each type |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ctives and clean up whitespace
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The JSON Schema for
SerializedMemberhardcoded thevalueproperty as type"object", but actual serialization produces primitives (string, number, boolean), arrays, objects, or null depending on the serialized type.Example of the mismatch:
Changes
typeconstraint fromvalueproperty schema, allowing any JSON value typeThe schema now correctly represents the polymorphic nature of the
valuefield.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.