Skip to content

Default value handling for parameters#29

Description

@shota3506

Hello 馃憢

We are using the OapiRequestValidator middleware for validation.

kin-openapi handles default values for parameters by adding value to *http.Request.URL.RawQuery if a parameter is not set.

However, the server code generated by oapi-codegen parses parameters before applying the middleware. This means that any changes made to *http.Request within the middleware (like setting default values via kin-openapi) will not be reflected in the parsed parameters.

I was hoping that using middleware could help with default value handling, based on this comment:
oapi-codegen/oapi-codegen#138 (comment)
Is there a workaround for this issue? Specifically, how can we ensure that default values set by kin-openapi's validator are set in the params generated by oapi-codegen?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions