Skip to content

Conversation

eiixy
Copy link
Contributor

@eiixy eiixy commented Jul 10, 2025

@sashabaranov sashabaranov requested a review from Copilot July 10, 2025 13:18
Copy link

codecov bot commented Jul 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.41%. Comparing base (1bf77f6) to head (fef366a).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1033      +/-   ##
==========================================
+ Coverage   87.26%   87.41%   +0.14%     
==========================================
  Files          43       43              
  Lines        2387     2415      +28     
==========================================
+ Hits         2083     2111      +28     
  Misses        284      284              
  Partials       20       20              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot

This comment was marked as outdated.

@eiixy eiixy marked this pull request as draft July 10, 2025 13:34
@eiixy eiixy marked this pull request as ready for review July 10, 2025 14:12
@sashabaranov sashabaranov requested a review from Copilot July 10, 2025 14:40
Copy link
Contributor

@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 removes the top‐level $ref from generated schemas and flattens definitions, adjusting tests to validate the new behavior.

  • Insert logic in GenerateSchemaForType to detect and remove a root $ref, merging its definitions into the root schema.
  • Introduce a containsRef helper to detect circular references when flattening.
  • Extend TestStructToSchema with new types (Person, MyStructuredResponse, User, Order) and corresponding expected JSON schemas.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
jsonschema/json.go Implement root $ref removal and add containsRef helper.
jsonschema/json_test.go Add tests for Person, MyStructuredResponse, User, and Order schema output.

@sashabaranov
Copy link
Owner

@eiixy please lmk if copilot suggestions are legit, otherwise lgtm!

eiixy and others added 2 commits July 11, 2025 09:54
@eiixy
Copy link
Contributor Author

eiixy commented Jul 11, 2025

@eiixy please lmk if copilot suggestions are legit, otherwise lgtm!

The suggestion about field order isn’t an issue — we convert the structToMap before comparing via reflect.DeepEqual, so the order doesn’t affect the result.

@sashabaranov sashabaranov merged commit a0c185f into sashabaranov:master Jul 11, 2025
3 checks passed
Rosenberg96 pushed a commit to lunarway/go-openai that referenced this pull request Aug 18, 2025
* support $ref and $defs in JSON Schema

* update

* removed root $ref from JSON Schema

* Update json.go

* Update json_test.go

* Update jsonschema/json.go

Co-authored-by: Copilot <[email protected]>

* Update jsonschema/json.go

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
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.

2 participants