Skip to content

AddBasePath appends / to routes #2

@polds

Description

@polds

I think this is a Hureg issue because Huma doesn't appear to do this. I was creating a "custom method" endpoint per Google's AIP-136 spec. Namely /collection:customAction. In a Huma Operation if I set the route to /collection:customAction it correctly sets that exact route. However if I use Hureg + AddBasePath and set /collection as the base path and then attempt to create an operation with a route :customAction I was surprised to see the spec be updated to be /collection/:customAction.

You can see it here:

api = api.AddBasePath("/collection")

op := huma.Operation{
   OperationID: "customAction",
   Method:      http.MethodGet,
   Path:        ":customAction", // Expected to live at `/collection:customAction`
}

hureg.Register(api, op, nil)

Is it possible to keep the intended /collection:customAction while still leveraging the AddBasePath method?

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