Skip to content

Commit

Permalink
Exposed getDialect
Browse files Browse the repository at this point in the history
  • Loading branch information
diyaayay authored and jdesrosiers committed Jul 1, 2024
1 parent cafff20 commit cfcb692
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,9 @@ These are available from the `@hyperjump/json-schema/experimental` export.
* **getDialectIds**
This function retrieves the identifiers of all loaded JSON Schema dialects.
* **getDialect**: (dialectId: string) => Record<string, string>;
This function retrieves all the keywords appropriate for a particular dialect.
* **Validation**: Keyword
A Keyword object that represents a "validate" operation. You would use this
Expand Down
1 change: 1 addition & 0 deletions lib/experimental.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const loadDialect: (dialectId: string, dialect: { [vocabularyId: string]:
export const unloadDialect: (dialectId: string) => void;
export const hasDialect: (dialectId: string) => boolean;
export const getDialectIds: () => string[];
export const getDialect: (dialectId: string) => Record<string, string>;

export type Keyword<A> = {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion lib/experimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export { compile, interpret, BASIC } from "./core.js";
export {
addKeyword, getKeyword, getKeywordByName, getKeywordName, getKeywordId,
defineVocabulary,
loadDialect, unloadDialect, hasDialect, getDialectIds
loadDialect, unloadDialect, hasDialect, getDialectIds, getDialect
} from "./keywords.js";
export { getSchema, toSchema, canonicalUri, buildSchemaDocument } from "./schema.js";
export { default as Validation } from "./keywords/validation.js";
2 changes: 1 addition & 1 deletion lib/keywords.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const getKeywordName = (dialectId, keywordId) => {
}
};

const getDialect = (dialectId) => {
export const getDialect = (dialectId) => {
if (!(dialectId in _dialects)) {
throw Error(`Encountered unknown dialect '${dialectId}'`);
}
Expand Down

0 comments on commit cfcb692

Please sign in to comment.