Skip to content

Commit 3693ea4

Browse files
committed
Add json schema draft 06 typings
1 parent cc40cb5 commit 3693ea4

File tree

6 files changed

+206
-135
lines changed

6 files changed

+206
-135
lines changed

dist/ref-parser.js

Lines changed: 77 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ref-parser.js.map

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ref-parser.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ref-parser.min.js.map

Lines changed: 105 additions & 95 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.d.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { JSONSchema4, JSONSchema4Type } from 'json-schema'
1+
import { JSONSchema4, JSONSchema4Type, JSONSchema6, JSONSchema6Type } from 'json-schema'
22

33
export = $RefParser
44

@@ -14,7 +14,7 @@ declare class $RefParser {
1414
*
1515
* See https://github.com/BigstickCarpet/json-schema-ref-parser/blob/master/docs/ref-parser.md#schema
1616
*/
17-
schema: JSONSchema4
17+
schema: JSONSchema4 | JSONSchema6
1818

1919
/**
2020
* The $refs property is a `$Refs` object, which lets you access all of the externally-referenced files in the schema, as well as easily get and set specific values in the schema using JSON pointers.
@@ -36,9 +36,9 @@ declare class $RefParser {
3636
* @param options (optional)
3737
* @param callback (optional) A callback that will receive the dereferenced schema object
3838
*/
39-
dereference(path: string, schema: string | JSONSchema4, options?: $RefParser.Options, callback?: (err: Error | null, schema: JSONSchema4 | null) => any): Promise<JSONSchema4>
40-
dereference(path: string, options?: $RefParser.Options, callback?: (err: Error | null, schema: JSONSchema4 | null) => any): Promise<JSONSchema4>
41-
dereference(schema: JSONSchema4, options?: $RefParser.Options, callback?: (err: Error | null, schema: JSONSchema4 | null) => any): Promise<JSONSchema4>
39+
dereference(path: string, schema: string | JSONSchema4 | JSONSchema6, options?: $RefParser.Options, callback?: (err: Error | null, schema: JSONSchema4 | JSONSchema6 | null) => any): Promise<JSONSchema4 | JSONSchema6>
40+
dereference(path: string, options?: $RefParser.Options, callback?: (err: Error | null, schema: JSONSchema4 | JSONSchema6 | null) => any): Promise<JSONSchema4 | JSONSchema6>
41+
dereference(schema: JSONSchema4 | JSONSchema6, options?: $RefParser.Options, callback?: (err: Error | null, schema: JSONSchema4 | JSONSchema6 | null) => any): Promise<JSONSchema4 | JSONSchema6>
4242

4343
/**
4444
* Bundles all referenced files/URLs into a single schema that only has internal `$ref` pointers. This lets you split-up your schema however you want while you're building it, but easily combine all those files together when it's time to package or distribute the schema to other people. The resulting schema size will be small, since it will still contain internal JSON references rather than being fully-dereferenced.
@@ -52,10 +52,10 @@ declare class $RefParser {
5252
* @param callback (optional) A callback that will receive the bundled schema object
5353
*/
5454
bundle(
55-
schema: string | JSONSchema4,
55+
schema: string | JSONSchema4 | JSONSchema6,
5656
options?: $RefParser.Options,
57-
callback?: (err: Error | null, schema: JSONSchema4 | null) => any
58-
): Promise<JSONSchema4>
57+
callback?: (err: Error | null, schema: JSONSchema4 | JSONSchema6 | null) => any
58+
): Promise<JSONSchema4 | JSONSchema6>
5959

6060
/**
6161
* *This method is used internally by other methods, such as `bundle` and `dereference`. You probably won't need to call this method yourself.*
@@ -69,10 +69,10 @@ declare class $RefParser {
6969
* @param callback (optional) A callback that will receive the parsed schema object, or an error
7070
*/
7171
parse(
72-
schema: string | JSONSchema4,
72+
schema: string | JSONSchema4 | JSONSchema6,
7373
options?: $RefParser.Options,
74-
callback?: (err: Error | null, schema: JSONSchema4 | null) => any
75-
): Promise<JSONSchema4>
74+
callback?: (err: Error | null, schema: JSONSchema4 | JSONSchema6 | null) => any
75+
): Promise<JSONSchema4 | JSONSchema6>
7676

7777
/**
7878
* *This method is used internally by other methods, such as `bundle` and `dereference`. You probably won't need to call this method yourself.*
@@ -86,7 +86,7 @@ declare class $RefParser {
8686
* @param callback (optional) A callback that will receive a `$Refs` object
8787
*/
8888
resolve(
89-
schema: string | JSONSchema4,
89+
schema: string | JSONSchema4 | JSONSchema6,
9090
options?: $RefParser.Options,
9191
callback?: (err: Error | null, $refs: $RefParser.$Refs | null) => any
9292
): Promise<$RefParser.$Refs>
@@ -274,7 +274,7 @@ declare namespace $RefParser {
274274
*
275275
* @param types (optional) Optionally only return values from certain locations ("file", "http", etc.)
276276
*/
277-
values(...types: string[]): { [url: string]: JSONSchema4 }
277+
values(...types: string[]): { [url: string]: JSONSchema4 | JSONSchema6 }
278278

279279
/**
280280
* Returns `true` if the given path exists in the schema; otherwise, returns `false`
@@ -292,15 +292,15 @@ declare namespace $RefParser {
292292
*
293293
* @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
294294
*/
295-
get($ref: string): JSONSchema4Type
295+
get($ref: string): JSONSchema4Type | JSONSchema6Type
296296

297297
/**
298298
* Sets the value at the given path in the schema. If the property, or any of its parents, don't exist, they will be created.
299299
*
300300
* @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
301301
* @param value The value to assign. Can be anything (object, string, number, etc.)
302302
*/
303-
set($ref: string, value: JSONSchema4Type): void
303+
set($ref: string, value: JSONSchema4Type | JSONSchema6Type): void
304304
}
305305

306306
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
},
5050
"devDependencies": {
5151
"@types/json-schema": "^6.0.0",
52+
"@types/node": "^9.4.0",
5253
"bower": "^1.8.2",
5354
"chai": "^4.1.2",
5455
"codacy-coverage": "^2.0.3",

0 commit comments

Comments
 (0)