go-openai icon indicating copy to clipboard operation
go-openai copied to clipboard

Add support for 'enum' tag to JSON schema generation

Open Dieg0Code opened this issue 11 months ago • 6 comments

This pull request includes enhancements to the jsonschema package, specifically adding support for enumerations in schema definitions and improving the test coverage for schema generation and comparison.

Enhancements to schema generation:

  • jsonschema/json.go: Added support for parsing enum tags in struct fields and including them in the generated schema. [1] [2]

Improvements to test coverage:

  • jsonschema/json_test.go: Added new tests to verify schema generation for types with enum tags and to compare struct-generated schemas with manually created schemas.
  • jsonschema/json_test.go: Updated existing tests to remove unnecessary properties fields from the expected JSON output. [1] [2] [3] [4] [5]

Dieg0Code avatar Dec 06 '24 09:12 Dieg0Code