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

fix: move CLI to its own package, deprecate huma.NewCLI #291

Merged
merged 5 commits into from
Mar 11, 2024
Merged

Conversation

danielgtaylor
Copy link
Owner

This PR moves the built-in optional CLI functionality into its own humacli package and updates all examples & docs. The existing CLI functionality stays but is marked as deprecated to give people time to move to the new package. Switching is fairly easy:

  • huma.NewCLIhumacli.New
  • huma.CLIhumacli.CLI
  • huma.Hookshumacli.Hooks
  • huma.WithOptionshumacli.WithOptions

The plan is to remove the old functionality a few releases from now. This will be a small breaking change to facilitate the removal of some dependencies that are not used by everyone, but will be treated as a bug fix.

Related to #290. This doesn't fix it yet, but sets us on the track to doing so soon.

Copy link

codecov bot commented Mar 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.07%. Comparing base (77be0e2) to head (90125f7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #291      +/-   ##
==========================================
+ Coverage   95.04%   95.07%   +0.02%     
==========================================
  Files          18       19       +1     
  Lines        2726     2739      +13     
==========================================
+ Hits         2591     2604      +13     
  Misses         98       98              
  Partials       37       37              

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

cli.go Outdated Show resolved Hide resolved
cli.go Outdated Show resolved Hide resolved
humacli/humacli.go Outdated Show resolved Hide resolved
@leonklingele
Copy link
Contributor

leonklingele commented Mar 10, 2024 via email

danielgtaylor and others added 4 commits March 10, 2024 08:44
Co-authored-by: leonklingele <git@leonklingele.de>
Co-authored-by: leonklingele <git@leonklingele.de>
@danielgtaylor danielgtaylor merged commit 13acb69 into main Mar 11, 2024
5 checks passed
@danielgtaylor danielgtaylor deleted the move-cli branch March 11, 2024 16:26
@simonfr
Copy link

simonfr commented May 1, 2024

Hi,
Sorry but it's a bit strange : you choose to "deprecate" huma.NewCLI but you just delete it from the old package. Looks like a breaking no ?
Also is this really a fix ?

@danielgtaylor
Copy link
Owner Author

@simonfr thanks for the feedback. Please take a look at https://github.com/danielgtaylor/huma/releases/tag/v2.13.0

The huma.NewCLI call was deprecated for several releases with a note about migrating to the new humacli package, giving users some time to migrate before removal. While removing it in v2.13.0 is technically a breaking change, it is treated as a fix because it is the only way to remove the underlying hard dependency requirement from the codebase for users who do not want to use the CLI functionality. It turns out this is important for security purposes and in certain organizations like government agencies and NGOs with extremely strict dependency and auditing requirements.

This wasn't a decision taken lightly due to the potential of upsetting people with a small breaking change, however the call was made that it was worth it to enable more people to use Huma. Even if you disagree with this change, I hope you can understand why it was done.

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.

None yet

4 participants