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 enums w/o needing to manually specify variations #97

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

shane-tw
Copy link
Contributor

@shane-tw shane-tw commented Dec 11, 2024

Fixes #89

It will only attempt to figure out the variations if type:"enum" is specified and len(enums) is 0.
i.e. if someone uses the {enum} comment, or, for some reason, {enum: }.

The only edge cases I can think of here are in our own code, where we sometimes might not want "all" or "" exposed as enum options in the API even though they technically exist. In which case we'd still need to manually specify all the fields like we were doing prior to now.

@shane-tw shane-tw marked this pull request as ready for review December 11, 2024 04:47
@coveralls
Copy link

coveralls commented Dec 11, 2024

Pull Request Test Coverage Report for Build 12270279849

Details

  • 35 of 51 (68.63%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.6%) to 56.902%

Changes Missing Coverage Covered Lines Changed/Added Lines %
docparse/jsonschema.go 35 51 68.63%
Files with Coverage Reduction New Missed Lines %
docparse/jsonschema.go 1 54.09%
Totals Coverage Status
Change from base Build 10494982151: 0.6%
Covered Lines: 1113
Relevant Lines: 1956

💛 - Coveralls

Copy link

@pawel-banach pawel-banach left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Contributor

@rafaeljusto rafaeljusto left a comment

Choose a reason for hiding this comment

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

Nice work with this feature request 👏

Copy link

@aodhom aodhom left a comment

Choose a reason for hiding this comment

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

Nice one on helping open source 😆

@shane-tw shane-tw merged commit da5d378 into master Dec 11, 2024
3 checks passed
@shane-tw shane-tw deleted the enums branch December 11, 2024 15:05
@shane-tw
Copy link
Contributor Author

shane-tw commented Dec 11, 2024

Despite the tests passing, this isn't working. My assumption is it's because we don't have any tests covering field types defined in another package/file. Investigating.

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.

Attempt retrieving enum automatically
5 participants