(local: StringMap, localPath: Ref, ref: Ref)
| 238 | } |
| 239 | |
| 240 | function lookupRef(local: StringMap, localPath: Ref, ref: Ref): [StringMap, Ref] { |
| 241 | const first = ref.first(); |
| 242 | if (first === undefined) { |
| 243 | return [local, localPath]; |
| 244 | } |
| 245 | const rest = ref.rest(); |
| 246 | if (first.kind === PathElementKind.Root) { |
| 247 | return lookupRef(root, List([first]), ref.rest()); |
| 248 | } |
| 249 | localPath = localPath.push(first); |
| 250 | switch (first.kind) { |
| 251 | case PathElementKind.Definition: |
| 252 | return lookupRef(lookupDefinition(local, first.name), localPath, rest); |
| 253 | case PathElementKind.OneOf: |
| 254 | return lookupRef(indexArray(local.oneOf, first.index), localPath, rest); |
| 255 | case PathElementKind.AnyOf: |
| 256 | return lookupRef(indexArray(local.anyOf, first.index), localPath, rest); |
| 257 | case PathElementKind.Property: |
| 258 | return lookupRef(lookupProperty(local, first.name), localPath, rest); |
| 259 | case PathElementKind.AdditionalProperty: |
| 260 | return lookupRef(checkStringMap(local.additionalProperties), localPath, rest); |
| 261 | case PathElementKind.Items: |
| 262 | return lookupRef(checkStringMap(local.items), localPath, rest); |
| 263 | default: |
| 264 | return assertNever(first); |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | function makeClass( |
| 269 | schema: StringMap, |
no test coverage detected
searching dependent graphs…