Skip to content

[feature] Allow templates in .Schemes(...) #624

@fenollp

Description

@fenollp

Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is - e.g. "I'm always frustrated when [...]"

I maintain an OpenAPI lib which provides a Mux router. The OpenAPIv3 spec allows variables in the scheme part of the URL but today .Schemes(...) do not support templating.

Describe the solution you'd like

What would the feature look like? How would it work? How would it change the API?

For Router and Router: I'd like Schemes() to accept a template with zero or more scheme variables enclosed by {}. Variable names shall be unique in a given route. They should be retrieved calling mux.Vars(request). Basically .Host() templating behavior but for schemes.

Describe alternatives you've considered

Are there alternatives you've tried, and/or workarounds in-place?

We have a workaround in place at getkin/kin-openapi#337 but it doesn't allow retrieving the values of variables defined for the scheme.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions