forked from ajv-validator/ajv
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add uriresolver option (ajv-validator#1862)
* feat: add uriresolver option * fix: review * fix: prettier * fix: lint * fix: param order * fix: test * fix: test * fix: test * fix: order * feat: bump version * feat: bump version Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
- Loading branch information
1 parent
8b993dc
commit 0e47ab4
Showing
14 changed files
with
428 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import {resolveUrl, normalizeId, getFullPath} from "./resolve" | ||
import type {UriResolver} from "../types" | ||
|
||
export default class MissingRefError extends Error { | ||
readonly missingRef: string | ||
readonly missingSchema: string | ||
|
||
constructor(baseId: string, ref: string, msg?: string) { | ||
constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string) { | ||
super(msg || `can't resolve reference ${ref} from id ${baseId}`) | ||
this.missingRef = resolveUrl(baseId, ref) | ||
this.missingSchema = normalizeId(getFullPath(this.missingRef)) | ||
this.missingRef = resolveUrl(resolver, baseId, ref) | ||
this.missingSchema = normalizeId(getFullPath(resolver, this.missingRef)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import * as uri from "uri-js" | ||
|
||
type URI = typeof uri & {code: string} | ||
;(uri as URI).code = 'require("ajv/dist/runtime/uri").default' | ||
|
||
export default uri as URI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.