swaggo / gin-swagger

gin middleware to automatically generate RESTful API documentation with Swagger 2.0.
MIT License
3.66k stars 266 forks source link

json inline attribute ignored #305

Closed laurentcau closed 1 week ago

laurentcau commented 2 weeks ago

Hi,

Inline json attribute seems to be ignored. For example:

type A struct{
    Value int `json:"value"`
}

type B struct{
    A A `json:",inline"`
    Value int `json:"value"`
}

// @BasePath /api/v1

// PingExample godoc
// @Summary ping example
// @Schemes
// @Description do ping
// @Tags example
// @Accept json
// @Produce json
// @Success 200 {object} B
// @Router /example/helloworld [get]
func Helloworld(g *gin.Context)  {
   g.JSON(http.StatusOK,"helloworld")
}

generates: image

Is it intended or is there another attribute I have to use?

laurentcau commented 1 week ago

sorry, it seems inline doesn't in fact. Incorrect information from a web search.