这是indexloc提供的服务,不要输入任何密码
Skip to content

autopatch: Use "huma.GenerateOperationID" to generate operation ID #914

@leonklingele

Description

@leonklingele

We overwrite huma.GenerateOperationID to use camel-case instead of the default kabab-case.

autopatch currently doesn't rely on huma.GenerateOperationID to generate the operation ID. Instead, the operation ID is generated in kebab-case-naming, always:

huma/autopatch/autopatch.go

Lines 174 to 180 in c7a8a79

// Guess a name for this patch operation based on the GET operation.
var name string
parts := casing.Split(get.OperationID)
if len(parts) > 1 && (strings.ToLower(parts[0]) == "get" || strings.ToLower(parts[0]) == "fetch") {
parts = parts[1:]
}
name = casing.Join(parts, "-")

This makes all auto generated patch-routes use a different naming schema as any other route.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions