swaggo / swag

Automatically generate RESTful API documentation with Swagger 2.0 for Go.
MIT License
10.58k stars 1.19k forks source link

Fix global overrides for any/interface ref types #1835

Closed ezequiel closed 3 months ago

ezequiel commented 3 months ago

Closes #1834

Description

When overriding with any or interface{}, the code should prefer the "any" (empty) schema instead, not the object schema since that's different e.g.

.swaggo

replace json.RawMessage any

model.go

type Thing struct {
    data json.RawMessage `json:"data"`
}

Output

"model.Thing": {
    "type": "object",
    "properties": {
      "data": {}
    }
}

Test Plan

make all

ezequiel commented 3 months ago

cc @sdghchj

sharunkumar commented 3 months ago

:shipit: