Skip to content

Add support for JSON Schema $defs, definitions, $ref, oneOf, anyOf and others in PropertyDefinition #726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

repko-artem
Copy link

@repko-artem repko-artem commented Jun 14, 2025

This PR extends PropertyDefinition to support additional JSON Schema draft-07 elements:

These additions improve compatibility with more complex JSON Schema structures.

…opertyDefinition

This PR extends PropertyDefinition to support additional JSON Schema draft-07 elements:

$defs (for schema definitions)
definitions
$ref (schema references)
anyOf (combining subschemas)
These additions improve compatibility with more complex JSON Schema structures.
@repko-artem
Copy link
Author

@dotnet-policy-service agree

@repko-artem repko-artem changed the title Add support for JSON Schema $defs, definitions, $ref, and anyOf in PropertyDefinition Add support for JSON Schema $defs, definitions, $ref, oneOf, anyOf and others in PropertyDefinition Jun 15, 2025
@kayhantolga kayhantolga requested a review from Copilot June 15, 2025 17:18
Copy link

@Copilot 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 extends PropertyDefinition to support additional JSON Schema keywords from both draft-07 and 2020-12 specifications for richer schema definitions and validation.

  • Removed the hardcoded "object" default on Type and made it nullable
  • Added support for const, title, minimum, maximum, and legacy definitions / $defs
  • Introduced $ref, anyOf, and oneOf properties for schema composition
Comments suppressed due to low confidence (2)

OpenAI.SDK/ObjectModels/SharedModels/FunctionParameters.cs:26

  • Removing the default "object" value may break existing consumers that rely on a default type; consider providing a fallback or retaining the default assignment.
public string? Type { get; set; }

OpenAI.SDK/ObjectModels/SharedModels/FunctionParameters.cs:135

  • Consider adding unit tests to verify serialization and validation behavior for the newly added anyOf, oneOf, and other schema composition properties.
public IList<PropertyDefinition>? AnyOf { get; set; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant