Skip to content

Commit 51989aa

Browse files
diyaayayjdesrosiers
authored andcommitted
Exposed getDialect
1 parent 6657013 commit 51989aa

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,9 @@ These are available from the `@hyperjump/json-schema/experimental` export.
585585
* **getDialectIds**
586586
587587
This function retrieves the identifiers of all loaded JSON Schema dialects.
588+
* **getDialect**: (dialectId: string) => Record<string, string>;
589+
590+
This function retrieves all the keywords appropriate for a particular dialect.
588591
* **Validation**: Keyword
589592
590593
A Keyword object that represents a "validate" operation. You would use this

lib/experimental.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export const loadDialect: (dialectId: string, dialect: Record<string, boolean>,
6666
export const unloadDialect: (dialectId: string) => void;
6767
export const hasDialect: (dialectId: string) => boolean;
6868
export const getDialectIds: () => string[];
69+
export const getDialect: (dialectId: string) => Record<string, string>;
6970

7071
export type Keyword<A> = {
7172
id: string;

lib/experimental.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export { compile, interpret, BASIC, DETAILED } from "./core.js";
22
export {
33
addKeyword, getKeyword, getKeywordByName, getKeywordName, getKeywordId,
44
defineVocabulary,
5-
loadDialect, unloadDialect, hasDialect, getDialectIds
5+
loadDialect, unloadDialect, hasDialect, getDialectIds, getDialect
66
} from "./keywords.js";
77
export { getSchema, toSchema, canonicalUri, buildSchemaDocument } from "./schema.js";
88
export { default as Validation } from "./keywords/validation.js";

lib/keywords.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const getKeywordName = (dialectId, keywordId) => {
5353
}
5454
};
5555

56-
const getDialect = (dialectId) => {
56+
export const getDialect = (dialectId) => {
5757
if (!(dialectId in _dialects)) {
5858
throw Error(`Encountered unknown dialect '${dialectId}'`);
5959
}

0 commit comments

Comments
 (0)