externalPackageFor returns the imported Go package name for a `$ref` that targets a file outside the current spec. Returns an empty string when the ref is empty, points within the current spec, or has no import-mapping.
(ref string)
| 62 | // targets a file outside the current spec. Returns an empty string when the |
| 63 | // ref is empty, points within the current spec, or has no import-mapping. |
| 64 | func externalPackageFor(ref string) string { |
| 65 | if ref == "" { |
| 66 | return "" |
| 67 | } |
| 68 | parts := strings.SplitN(ref, "#", 2) |
| 69 | if pack, ok := globalState.importMapping[parts[0]]; ok { |
| 70 | return pack.Name |
| 71 | } |
| 72 | return "" |
| 73 | } |
| 74 | |
| 75 | // ensureExternalRefsInSchema ensures that when an externalRef (`$ref` that points to a file that isn't the current spec) is encountered, we make sure we update our underlying `RefType` to make sure that we point to that type. |
| 76 | // |
no outgoing calls
no test coverage detected