Issue with generics
- Dominant language
- Go
- Stars
- 952
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
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:
```go
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by inspecting jsonschema.Reflector, its default Namer, and the reference-generation path to see where generic type names containing `/` are produced. Add coverage for a generic type whose generated reference name contains a slash, and verify that the resulting JSON Schema references are valid and slash-safe.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100