mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 12:37:49 +00:00
First sweep at cleaning up dead code
first round of a number I am sure, lots to clean. Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -57,54 +57,3 @@ func ExtractFileType(ref string) FileExtension {
|
||||
}
|
||||
return UNSUPPORTED
|
||||
}
|
||||
func ExtractRefValues(ref string) (location, id string) {
|
||||
split := strings.Split(ref, "#/")
|
||||
if len(split) > 1 && split[0] != "" {
|
||||
location = split[0]
|
||||
id = split[1]
|
||||
}
|
||||
if len(split) > 1 && split[0] == "" {
|
||||
id = split[1]
|
||||
}
|
||||
if len(split) == 1 {
|
||||
location = ref
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ExtractRefType(ref string) RefType {
|
||||
if strings.HasPrefix(ref, "http") {
|
||||
return HTTP
|
||||
}
|
||||
if strings.HasPrefix(ref, "/") {
|
||||
return File
|
||||
}
|
||||
if strings.HasPrefix(ref, "..") {
|
||||
return File
|
||||
}
|
||||
if strings.HasPrefix(ref, "./") {
|
||||
return File
|
||||
}
|
||||
split := strings.Split(ref, "#/")
|
||||
if len(split) > 1 && split[0] != "" {
|
||||
return File
|
||||
}
|
||||
if strings.HasSuffix(ref, ".yaml") {
|
||||
return File
|
||||
}
|
||||
if strings.HasSuffix(ref, ".json") {
|
||||
return File
|
||||
}
|
||||
return Local
|
||||
}
|
||||
|
||||
func ExtractRefs(content string) [][]string {
|
||||
|
||||
return refRegex.FindAllStringSubmatch(content, -1)
|
||||
|
||||
//var results []*ExtractedRef
|
||||
//for _, r := range res {
|
||||
// results = append(results, &ExtractedRef{Location: r[1], Type: ExtractRefType(r[1])})
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user