Skip to content

post请求是否不支持绑定嵌套匿名结构体参数? #1454

Description

@FlameMida

Describe the Question

A clear and concise description of what the question is.

Reproducible Code

type SearchSchoolsReq struct {
	Keyword   string   `json:"keyword" label:"关键词"`
	request.PageInfo
}

type PageInfo struct {
	Page  int `json:"page" form:"page" query:"page" default:"1" vd:"min=1"`     // 页码
	Limit int `json:"limit" form:"limit" query:"limit" default:"15" vd:"min=1"` // 每页大小
}
{
"keyword":"",
"page":1,
"limit":2
}

使用BindAndValidate绑定参数,即使移除了 form,query tag依然无法绑定到

Hertz version:

v0.10.3

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