Skip to content

Commit f72cd60

Browse files
fix: export Schema and additional schemas (#197)
1 parent 3364808 commit f72cd60

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

declarations/index.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
export type Schema = import("./validate").Schema;
2+
export type JSONSchema4 = import("./validate").JSONSchema4;
3+
export type JSONSchema6 = import("./validate").JSONSchema6;
4+
export type JSONSchema7 = import("./validate").JSONSchema7;
5+
export type ExtendedSchema = import("./validate").ExtendedSchema;
16
import { validate } from "./validate";
27
import { ValidationError } from "./validate";
38
import { enableValidation } from "./validate";

declarations/validate.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ export type JSONSchema4 = import("json-schema").JSONSchema4;
22
export type JSONSchema6 = import("json-schema").JSONSchema6;
33
export type JSONSchema7 = import("json-schema").JSONSchema7;
44
export type ErrorObject = import("ajv").ErrorObject;
5-
export type Extend = {
5+
export type ExtendedSchema = {
66
formatMinimum?: (string | number) | undefined;
77
formatMaximum?: (string | number) | undefined;
88
formatExclusiveMinimum?: (string | boolean) | undefined;
99
formatExclusiveMaximum?: (string | boolean) | undefined;
1010
link?: string | undefined;
1111
undefinedAsNull?: boolean | undefined;
1212
};
13-
export type Schema = (JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend;
13+
export type Schema = (JSONSchema4 | JSONSchema6 | JSONSchema7) & ExtendedSchema;
1414
export type SchemaUtilErrorObject = ErrorObject & {
1515
children?: Array<ErrorObject>;
1616
};

src/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/** @typedef {import("./validate").Schema} Schema */
2+
/** @typedef {import("./validate").JSONSchema4} JSONSchema4 */
3+
/** @typedef {import("./validate").JSONSchema6} JSONSchema6 */
4+
/** @typedef {import("./validate").JSONSchema7} JSONSchema7 */
5+
/** @typedef {import("./validate").ExtendedSchema} ExtendedSchema */
6+
17
const {
28
validate,
39
ValidationError,

src/validate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const getAjv = memoize(() => {
5050
/** @typedef {import("ajv").ErrorObject} ErrorObject */
5151

5252
/**
53-
* @typedef {Object} Extend
53+
* @typedef {Object} ExtendedSchema
5454
* @property {(string | number)=} formatMinimum
5555
* @property {(string | number)=} formatMaximum
5656
* @property {(string | boolean)=} formatExclusiveMinimum
@@ -59,7 +59,7 @@ const getAjv = memoize(() => {
5959
* @property {boolean=} undefinedAsNull
6060
*/
6161

62-
/** @typedef {(JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend} Schema */
62+
/** @typedef {(JSONSchema4 | JSONSchema6 | JSONSchema7) & ExtendedSchema} Schema */
6363

6464
/** @typedef {ErrorObject & { children?: Array<ErrorObject> }} SchemaUtilErrorObject */
6565

0 commit comments

Comments
 (0)