-
Notifications
You must be signed in to change notification settings - Fork 33
tool: add recursive structure support in JSON schema #447
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
base: main
Are you sure you want to change the base?
Conversation
Implement $ref and $defs in schema generator to handle recursive and mutually recursive data structures.
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
internal/tool/tool.go
Outdated
} | ||
|
||
// generateJSONSchemaWithContextInternal generates a JSON schema with recursion handling | ||
func generateJSONSchemaWithContextInternal(t reflect.Type, ctx *schemaContext, isRoot bool) *tool.Schema { |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 PR 还有点实现的问题,修复好了之后,我主动找你看下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
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