Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global override any type uses incorrect schema #1834

Open
ezequiel opened this issue Jun 22, 2024 · 1 comment · May be fixed by #1835
Open

Global override any type uses incorrect schema #1834

ezequiel opened this issue Jun 22, 2024 · 1 comment · May be fixed by #1835

Comments

@ezequiel
Copy link

Description

When specifying any as a global override in .swaggo, it seems to override with the object shema instead of the any schema

To Reproduce

.swaggo

replace json.RawMessage any

model.go

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

Expected behavior

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

Actual behavior

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

Your swag version

e.g. v1.16.3

Your go version

e.g. v1.22.4

@ezequiel
Copy link
Author

ezequiel commented Jun 22, 2024

Issue seems to stem from:

swag/operation.go

Lines 845 to 846 in 7204462

case refType == ANY:
return PrimitiveSchema(OBJECT), nil

We can probably use &spec.Schema{} here instead?

ezequiel added a commit to ezequiel/swag that referenced this issue Jun 25, 2024
@ezequiel ezequiel linked a pull request Jun 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant