Skip to content

Commit ee7271d

Browse files
diyaayayjdesrosiers
authored andcommitted
Exposed getDialect
1 parent 13aafd4 commit ee7271d

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
@@ -568,6 +568,9 @@ These are available from the `@hyperjump/json-schema/experimental` export.
568568
* **getDialectIds**
569569
570570
This function retrieves the identifiers of all loaded JSON Schema dialects.
571+
* **getDialect**: (dialectId: string) => Record<string, string>;
572+
573+
This function retrieves all the keywords appropriate for a particular dialect.
571574
* **Validation**: Keyword
572575
573576
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
@@ -64,6 +64,7 @@ export const loadDialect: (dialectId: string, dialect: { [vocabularyId: string]:
6464
export const unloadDialect: (dialectId: string) => void;
6565
export const hasDialect: (dialectId: string) => boolean;
6666
export const getDialectIds: () => string[];
67+
export const getDialect: (dialectId: string) => Record<string, string>;
6768

6869
export type Keyword<A> = {
6970
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 } 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
@@ -50,7 +50,7 @@ export const getKeywordName = (dialectId, keywordId) => {
5050
}
5151
};
5252

53-
const getDialect = (dialectId) => {
53+
export const getDialect = (dialectId) => {
5454
if (!(dialectId in _dialects)) {
5555
throw Error(`Encountered unknown dialect '${dialectId}'`);
5656
}

0 commit comments

Comments
 (0)