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

Issue with generics #121

Open
safareli opened this issue Dec 18, 2023 · 0 comments
Open

Issue with generics #121

safareli opened this issue Dec 18, 2023 · 0 comments

Comments

@safareli
Copy link

if you use generics in some type for which schema is generated, in reference generated name will contain path of the generic argument. Which is an issue as in json schema references / is used to identify the reference. I fixed it with this snippet:

r := new(jsonschema.Reflector)
r.Namer = func(t reflect.Type) string {
  return strings.ReplaceAll(t.Name(), "/", "__")
}

Tho this is something that should probably be done by default.

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

1 participant