You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 13, 2023. It is now read-only.
* feat: add refMap to resolve result
* test: cover and demonstrate all immutability rules
* docs(readme): add more examples
* docs(types): more comments
* refactor: remove debug prop
-**Performant**: Hot paths are memoized, remote authorities are resolved concurrently, and the minimum surface area is crawled and resolved.
13
13
-**Caching**: Results from remote authorities are cached.
14
-
-**Immutable**: The original object is not changed, and structural sharing is used to only change relevant bits.
15
-
-**Reference equality:** Pointers to the same location will resolve to the same object in memory.
14
+
-**Immutable**: The original object is not changed, and structural sharing is used to only change relevant bits.[example test](src/__tests__/resolver.spec.ts#L139-L143)
15
+
-**Reference equality:** Pointers to the same location will resolve to the same object in memory.[example test](src/__tests__/resolver.spec.ts#L145)
16
16
-**Flexible:** Bring your own readers for `http://`, `file://`, `mongo://`, `custom://`... etc.
17
17
-**Reliable:** Well tested to handle all sorts of circular reference edge cases.
// Indicate where the `sourceData` being resolved lives, so that relative remote references can be fetched and resolved.
235
+
authority: newURI(sourcePath)
236
+
});
237
+
238
+
expect(resolved.result).toEqual({
239
+
user: {
240
+
// ... the user object defined in `../models/user.json`
241
+
}
242
+
});
121
243
```
122
244
245
+
In the above example, the user \$ref will resolve to `/models/user.json`, because `../models/user.json` is resolved against the authority of the current document (which was indicated at `/specs/api.json`). Relative references will not work if the source document has no authority set.
0 commit comments