@hyperjump/json-schema 1.7.3 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/lib/experimental.d.ts +1 -0
- package/lib/experimental.js +5 -1
- package/lib/keywords.js +5 -0
- package/lib/schema.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -566,6 +566,10 @@ These are available from the `@hyperjump/json-schema/experimental` export.
|
|
|
566
566
|
`$vocabulary` keyword in the meta-schema. The only time you would need to
|
|
567
567
|
load a dialect manually is if you're creating a distinct version of JSON
|
|
568
568
|
Schema rather than creating a dialect of an existing version of JSON Schema.
|
|
569
|
+
* **unloadDialect**: (dialectId: string) => void
|
|
570
|
+
|
|
571
|
+
Remove a dialect. You shouldn't need to use this function. It's called for
|
|
572
|
+
you when you call `unregisterSchema`.
|
|
569
573
|
* **Validation**: Keyword
|
|
570
574
|
|
|
571
575
|
A Keyword object that represents a "validate" operation. You would use this
|
package/lib/experimental.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ export const getKeywordByName: <A>(keywordName: string, dialectId: string) => Ke
|
|
|
63
63
|
export const getKeywordId: (keywordName: string, dialectId: string) => string;
|
|
64
64
|
export const defineVocabulary: (id: string, keywords: { [keyword: string]: string }) => void;
|
|
65
65
|
export const loadDialect: (dialectId: string, dialect: { [vocabularyId: string]: boolean }, allowUnknownKeywords?: boolean) => void;
|
|
66
|
+
export const unloadDialect: (dialectId: string) => void;
|
|
66
67
|
export const hasDialect: (dialectId: string) => boolean;
|
|
67
68
|
|
|
68
69
|
export type Keyword<A> = {
|
package/lib/experimental.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { compile, interpret, BASIC, DETAILED, VERBOSE } from "./core.js";
|
|
2
|
-
export {
|
|
2
|
+
export {
|
|
3
|
+
addKeyword, getKeyword, getKeywordByName, getKeywordName, getKeywordId,
|
|
4
|
+
defineVocabulary,
|
|
5
|
+
loadDialect, unloadDialect, hasDialect
|
|
6
|
+
} from "./keywords.js";
|
|
3
7
|
export { getSchema, toSchema, canonicalUri, buildSchemaDocument } from "./schema.js";
|
|
4
8
|
export { default as Validation } from "./keywords/validation.js";
|
package/lib/keywords.js
CHANGED
package/lib/schema.js
CHANGED
|
@@ -3,7 +3,7 @@ import { get as browserGet } from "@hyperjump/browser";
|
|
|
3
3
|
import { Reference } from "@hyperjump/browser/jref";
|
|
4
4
|
import { append } from "@hyperjump/json-pointer";
|
|
5
5
|
import { resolveIri, toAbsoluteIri, normalizeIri } from "@hyperjump/uri";
|
|
6
|
-
import { getKeywordName, loadDialect } from "./keywords.js";
|
|
6
|
+
import { getKeywordName, loadDialect, unloadDialect } from "./keywords.js";
|
|
7
7
|
import { uriFragment, jsonStringify, jsonTypeOf, toRelativeIri } from "./common.js";
|
|
8
8
|
|
|
9
9
|
|
|
@@ -52,7 +52,9 @@ export const registerSchema = (schema, retrievalUri, contextDialectId) => {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
export const unregisterSchema = (uri) => {
|
|
55
|
-
|
|
55
|
+
const normalizedUri = toAbsoluteIri(uri);
|
|
56
|
+
unloadDialect(normalizedUri);
|
|
57
|
+
delete schemaRegistry[normalizedUri];
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
export const buildSchemaDocument = (schema, id, dialectId, embedded = {}) => {
|