Skip to content

Replace go-swagger with huma #33685

Open
Open
@TheFox0x7

Description

Feature Description

Disclaimer: I'm working on it currently to see if it's doable and so far I think it is. If this gets accepted I'd like to author it.


I'd like to suggest dropping go-swagger based generation in favor of automatically generated docs from code with huma

This would bring following benefits:

  • No need to update swagger comments
  • Always up to date spec with current api
  • Autogenerated openapi 3.1 and 3.0 (in both json and yaml formats) plus json schema for it
  • Works with chi and few other frameworks/routers so it's more portable

Downsides:

  • A rather larger work to get this up
  • Drops openapi 2.0 support unless we also provide a converter for it
  • Some endpoints might be harder to convert (but could possibly be registered anyway despite not being managed by huma)
  • Contexts would need to be examined as function signature is func (context.Context, *struct) (*struct, error), context being the std lib one.1

Screenshots

No response

Footnotes

  1. Semi related: I find current router system with multiple different functions and contexts being accepted really confusing so maybe it's an area that can be simplified a bit?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions