Skip to content

Commit

Permalink
Merge pull request #217 from qdongxu/dup2
Browse files Browse the repository at this point in the history
log accurate error message when there's duplicate registry name
  • Loading branch information
danielgtaylor authored Jan 24, 2024
2 parents ecdf5a4 + b6ee970 commit f524213
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ func (r *mapRegistry) Schema(t reflect.Type, allowRef bool, hint string) *Schema
if s, ok := r.schemas[name]; ok {
if _, ok := r.seen[t]; !ok {
// Name matches but type is different, so we have a dupe.
panic(fmt.Errorf("duplicate name %s does not match existing type. New type %s, have existing types %+v", name, t, r.seen))

panic(fmt.Errorf("duplicate name: %s, new type: %s, existing type: %s", name, t, r.types[name]))
}
if allowRef {
return &Schema{Ref: r.prefix + name}
Expand Down

0 comments on commit f524213

Please sign in to comment.