Skip to content
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

Add support for 'enum' tag to JSON schema generation #912

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Dieg0Code
Copy link

@Dieg0Code Dieg0Code commented Dec 6, 2024

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]

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.69%. Comparing base (774fc9d) to head (fe5cc78).
Report is 77 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #912      +/-   ##
==========================================
+ Coverage   98.46%   98.69%   +0.23%     
==========================================
  Files          24       26       +2     
  Lines        1364     1761     +397     
==========================================
+ Hits         1343     1738     +395     
- Misses         15       16       +1     
- Partials        6        7       +1     

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

@sashabaranov
Copy link
Owner

Hello, thank you for the PR!

The PR description screams hints that it is AI-generated and it's hard to trust the code.

Could you please:

  1. Remove the test.mp3 file as it is generated by tests
  2. Add tests for enums

Thank you!

@Dieg0Code
Copy link
Author

Hi, thanks for checking my PR, I will implement what you say, although the tests for jsonschema are already broken.

…d Comparasion test for manual created schema and struct-generated one | Also modify previous tests
@Dieg0Code
Copy link
Author

Hello, thank you for the PR!

The PR description screams hints that it is AI-generated and it's hard to trust the code.

Could you please:

  1. Remove the test.mp3 file as it is generated by tests
  2. Add tests for enums

Thank you!

Hey there! I’ve made some updates to the repository. Please take a look and let me know if you have any feedback.

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