Skip to content

Conversation

liuzengh
Copy link
Contributor

@liuzengh liuzengh commented Sep 30, 2025

Implement $ref and $defs in schema generator to handle recursive and mutually recursive data structures.

https://json-schema.org/draft/2020-12/json-schema-core#name-schema-re-use-with-defs

Implement $ref and $defs in schema generator to handle recursive and mutually recursive data structures.
@codecov
Copy link

codecov bot commented Sep 30, 2025

Codecov Report

❌ Patch coverage is 81.48148% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.82443%. Comparing base (48378be) to head (65f9371).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
internal/tool/tool.go 81.48148% 34 Missing and 6 partials ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##                main        #447         +/-   ##
===================================================
- Coverage   74.83858%   74.82443%   -0.01415%     
===================================================
  Files            195         195                 
  Lines          29891       30045        +154     
===================================================
+ Hits           22370       22481        +111     
- Misses          6339        6375         +36     
- Partials        1182        1189          +7     
Flag Coverage Δ
unittests 74.82443% <81.48148%> (-0.01415%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@liuzengh liuzengh changed the title WIP tool: add recursive structure support in JSON schema WIP: tool: add recursive structure support in JSON schema Sep 30, 2025
}

// generateJSONSchemaWithContextInternal generates a JSON schema with recursion handling
func generateJSONSchemaWithContextInternal(t reflect.Type, ctx *schemaContext, isRoot bool) *tool.Schema {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cyclomatic complexity 21 of func generateJSONSchemaWithContextInternal is high (> 20) (gocyclo)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 PR 还有点实现的问题,修复好了之后,我主动找你看下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@liuzengh liuzengh changed the title WIP: tool: add recursive structure support in JSON schema tool: add recursive structure support in JSON schema Oct 22, 2025
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