func nameFromRef(ref swspec.Ref) string { u := ref.GetURL() if u.Fragment != "" { return swag.ToJSONName(path.Base(u.Fragment)) } if u.Path != "" { bn := path.Base(u.Path) if bn != "" && bn != "/" { ext := path.Ext(bn) if ext != "" { return swag.ToJSONName(bn[:len(bn)-len(ext)]) } return swag.ToJSONName(bn) } } return swag.ToJSONName(strings.Replace(u.Host, ".", " ", -1)) }