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

Type definition with internal underlying type leads to panic #508

Closed
greenpart opened this issue Sep 4, 2019 · 2 comments
Closed

Type definition with internal underlying type leads to panic #508

greenpart opened this issue Sep 4, 2019 · 2 comments

Comments

@greenpart
Copy link
Contributor

Describe the bug
swag panics trying to generate documentation for type defined with internal underlying type (e.g. sql.NullInt64).

panic: runtime error: invalid memory address or nil pointer dereference
…
exit status 2

To Reproduce
Steps to reproduce the behavior:

  1. create file in an empty directory and fill it with:
package main

import (
	"database/sql"
)

// @Success 200 {object}  main.Object "Response data"
func main() {
	_ = Object{}
}

type Object struct {
	ID NullableID
}

type NullableID sql.NullInt64
  1. run swag init --parseDependency in this directory
  2. See error panic: runtime error: invalid memory address or nil pointer dereference

Expected behavior
Swagger documentation successfully generated.

Your swag version
1.6.2

Your go version
1.12.3

Desktop (please complete the following information):

  • OS X 10.12.6
@easonlin404
Copy link
Member

it's should be use swagger type tag for non supporting type.

@greenpart
Copy link
Contributor Author

Tags are not applicable with type definitions like type NullableID sql.NullInt64.
We have some types like that and want to continue with them rather than convert to

type NullableID struct {
    sql.NullInt64 `swaggertype:"…"`
}

kirill-a-belov added a commit to paulcamper/swag that referenced this issue Sep 9, 2019
@ubogdan ubogdan closed this as completed Sep 28, 2021
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

No branches or pull requests

3 participants