| 167 | } |
| 168 | |
| 169 | private splitRef(ref: string, currentSource: string): { source: string; pointer: string } { |
| 170 | const [refSource, pointer = ""] = ref.split("#", 2); |
| 171 | if (!refSource) { |
| 172 | return { source: currentSource, pointer }; |
| 173 | } |
| 174 | |
| 175 | if (refSource.startsWith("http://") || refSource.startsWith("https://")) { |
| 176 | return { source: refSource, pointer }; |
| 177 | } |
| 178 | |
| 179 | if (currentSource.startsWith("http://") || currentSource.startsWith("https://")) { |
| 180 | return { source: new URL(refSource, currentSource).toString(), pointer }; |
| 181 | } |
| 182 | |
| 183 | return { source: path.resolve(path.dirname(currentSource), refSource), pointer }; |
| 184 | } |
| 185 | |
| 186 | private resolvePointer(document: unknown, pointer: string): unknown { |
| 187 | if (!pointer) { |