swaggest / rest

Web services with OpenAPI and JSON Schema done quick in Go
https://pkg.go.dev/github.com/swaggest/rest
MIT License
335 stars 17 forks source link

Response headers defined in embedded struct are ignored #139

Closed pboguslawski closed 1 year ago

pboguslawski commented 1 year ago

Describe the bug

When Test response header is defined using embedded struct like this

type MyEmbedded struct {
    Test string          `header:"Test" json:"-"`
}

type MyResponse struct {
    MyEmbedded
    Other string          `json:"other"`
}

such header is not present in API response. No such problem when header is defined directly i.e.

type MyResponse struct {
    Test string          `header:"Test" json:"-"`
    Other string          `json:"other"`
}

Expected behavior Response header defined using embedded struct should be present in response.