@squiz/json-schema-library
Version:
Customizable and hackable json-validator and json-schema utilities for traversal, data generation and validation
13 lines (11 loc) • 400 B
text/typescript
import { Draft } from "./draft";
import { JSONSchema } from "./types";
/**
* register a json-schema to be referenced from another json-schema
* @param url base-url of json-schema (aka id)
* @param schema
*/
export default function addRemoteSchema(draft: Draft, url: string, schema: JSONSchema): void {
schema.id = schema.id || url;
draft.remotes[url] = draft.compileSchema(schema);
}