-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
add enum tag to jsonschema #962
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #962 +/- ##
===========================================
- Coverage 98.46% 85.25% -13.21%
===========================================
Files 24 43 +19
Lines 1364 2259 +895
===========================================
+ Hits 1343 1926 +583
- Misses 15 312 +297
- Partials 6 21 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I'm not sure why code coverage went down. Maybe adding more tests from Github Action? |
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.
Great stuff, thank you for the PR!
* fix jsonschema tests * ensure all run during PR Github Action * add test for struct to schema * add support for enum tag * support nullable tag
add enum tag to jsonschema (sashabaranov#962)
There is another issue, #912. It seems to have been abandoned.
Describe the change
When creating a JSON schema from a
struct
, a new tagenum
can be used to see theEnum
field.For example,
This will see the
Enum
on the field definition would beEnum = []string{"red","green","blue"}
.This is implementation is being used.
Provide OpenAI documentation link
Provide a relevant API doc from https://platform.openai.com/docs/api-reference
Describe your solution
See change above.
Tests
json_test.go
. This also required adding some other tests for struct to schema definition.omitempty
, I've updated the tests to reflect this.Additional context
n/a