Skip to content

Add JSON schema generation for method return types#16

Merged
IvanMurzak merged 6 commits into
mainfrom
feature/output-schema
Oct 7, 2025
Merged

Add JSON schema generation for method return types#16
IvanMurzak merged 6 commits into
mainfrom
feature/output-schema

Conversation

@IvanMurzak
Copy link
Copy Markdown
Owner

This pull request introduces support for generating and exposing JSON schemas for method return types in the ReflectorNet library. This enhancement allows users to programmatically inspect the structure of method outputs, in addition to existing input schema support. The main changes involve adding new methods to generate return type schemas and updating the MethodWrapper class to provide access to these schemas.

Return type schema support:

  • Added a GetReturnSchema method to the Reflector class, which generates a JSON schema for a method's return type, returning null for void, Task, or ValueTask return types. [1] [2]
  • Implemented the underlying logic for GetReturnSchema in the JsonSchema utility class.

MethodWrapper enhancements:

  • Updated the MethodWrapper class to store and expose the output schema via a new OutputSchema property, initializing it in all relevant constructors. [1] [2] [3] [4]

Project metadata:

  • Bumped the package version from 2.0.0 to 2.1.0 in ReflectorNet.csproj to reflect the new feature.

Introduces the ability to generate and expose JSON Schemas for method return types in the ReflectorNet library. Adds OutputSchema property to MethodWrapper, implements GetReturnSchema in Reflector and JsonSchema, and bumps the package version to 2.1.0.
@IvanMurzak IvanMurzak requested a review from Copilot October 7, 2025 03:54
@IvanMurzak IvanMurzak self-assigned this Oct 7, 2025
@IvanMurzak IvanMurzak added the enhancement New feature or request label Oct 7, 2025
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 PR adds JSON schema generation for method return types to the ReflectorNet library, complementing the existing input schema support. Users can now programmatically inspect the structure of method outputs through new APIs.

  • Added GetReturnSchema method to both Reflector and JsonSchema classes for generating return type schemas
  • Enhanced MethodWrapper class with OutputSchema property to expose return type schemas
  • Bumped package version from 2.0.0 to 2.1.0 to reflect the new feature

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
ReflectorNet/src/Utils/Json/JsonSchema.cs Implements core logic for return schema generation with void/Task handling
ReflectorNet/src/Reflector/Reflector.Json.cs Adds public API method for return schema generation
ReflectorNet/src/Reflector/MethodWrapper.cs Integrates output schema support across all constructors
ReflectorNet/ReflectorNet.csproj Updates package version to 2.1.0

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread ReflectorNet/src/Reflector/Reflector.Json.cs Outdated
@IvanMurzak IvanMurzak requested a review from Copilot October 7, 2025 04:13
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 5 out of 5 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread ReflectorNet/src/Utils/Json/JsonSchema.cs Outdated
Comment thread ReflectorNet/src/Reflector/Reflector.Json.cs Outdated
@IvanMurzak IvanMurzak requested a review from Copilot October 7, 2025 04:15
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 5 out of 5 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@IvanMurzak IvanMurzak merged commit 17b18d0 into main Oct 7, 2025
1 check passed
@IvanMurzak IvanMurzak deleted the feature/output-schema branch October 7, 2025 04:17
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