forked from lantanagroup/FHIR.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidator.d.ts
44 lines (44 loc) · 1.56 KB
/
validator.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { ParseConformance } from './parseConformance';
import { ParsedProperty } from "./model/parsed-property";
export interface ValidatorOptions {
errorOnUnexpected?: boolean;
onBeforeValidateResource?: (resource: any) => ValidatorMessage[];
onBeforeValidateProperty?: (resource: any, property: ParsedProperty, treeDisplay: string, value: any) => ValidatorMessage[];
onError?: (message: ValidatorMessage) => void;
beforeCheckCode?: (valueSetUrl: string, code: string, system?: string) => boolean;
skipCodeValidation?: boolean;
}
export interface ValidatorMessage {
location?: string;
resourceId?: string;
severity?: Severities;
message?: string;
}
export interface ValidatorResponse {
valid: boolean;
messages: ValidatorMessage[];
}
export declare enum Severities {
Fatal = "fatal",
Error = "error",
Warning = "warning",
Information = "info"
}
export declare class Validator {
private isXml;
private obj;
private resourceId?;
readonly parser: ParseConformance;
readonly options: ValidatorOptions;
response: ValidatorResponse;
constructor(parser: ParseConformance, options: ValidatorOptions, resourceId?: string, isXml?: boolean, obj?: any);
validate(input: any): ValidatorResponse;
static getTreeDisplay(tree: any, isXml?: any, leaf?: any): string;
private checkCode;
private addError;
private addFatal;
private addWarn;
private addInfo;
private validateNext;
validateProperties(obj: any, properties: any, tree: any): void;
}