json-2-joi 2.3.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +203 -203
- package/README.md +359 -358
- package/index.js +14 -14
- package/lib/resolver.js +669 -651
- package/package.json +54 -54
- package/CHANGELOG.md +0 -210
package/package.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "json-2-joi",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"license": "Apache 2.0",
|
|
5
|
-
"description": "Converts json-schema to Joi schema. (Enhanced enjoi)",
|
|
6
|
-
"main": "./index.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "tape test/*.js",
|
|
9
|
-
"cover": "nyc --reporter=lcov --lines 100 npm test && nyc report",
|
|
10
|
-
"lint": "eslint index.js lib/resolver.js"
|
|
11
|
-
},
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git://github.com/kenspirit/json-2-joi.git"
|
|
15
|
-
},
|
|
16
|
-
"engines": {
|
|
17
|
-
"node": ">=12"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"json-to-joi",
|
|
21
|
-
"json-2-joi",
|
|
22
|
-
"joi",
|
|
23
|
-
"json-schema",
|
|
24
|
-
"json",
|
|
25
|
-
"schema",
|
|
26
|
-
"validation",
|
|
27
|
-
"conversion",
|
|
28
|
-
"hapi",
|
|
29
|
-
"enjoi"
|
|
30
|
-
],
|
|
31
|
-
"author": "Ken Chen <chengusky@gmail.com>",
|
|
32
|
-
"bugs": {
|
|
33
|
-
"url": "https://github.com/kenspirit/json-2-joi/issues"
|
|
34
|
-
},
|
|
35
|
-
"homepage": "https://github.com/kenspirit/json-2-joi",
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"@hapi/bourne": "^3.0.0",
|
|
38
|
-
"@hapi/hoek": "^9.3.0",
|
|
39
|
-
"debug": "^4.3.4"
|
|
40
|
-
},
|
|
41
|
-
"peerDependencies": {
|
|
42
|
-
"joi": "^17.6.0"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"joi": "^17.6.0",
|
|
46
|
-
"eslint": "^6.8.0",
|
|
47
|
-
"nyc": "^15.1.0",
|
|
48
|
-
"tape": "^5.5.3"
|
|
49
|
-
},
|
|
50
|
-
"files": [
|
|
51
|
-
"lib/**/*.js",
|
|
52
|
-
"index.js"
|
|
53
|
-
]
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "json-2-joi",
|
|
3
|
+
"version": "2.4.0",
|
|
4
|
+
"license": "Apache 2.0",
|
|
5
|
+
"description": "Converts json-schema to Joi schema. (Enhanced enjoi)",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "tape test/*.js",
|
|
9
|
+
"cover": "nyc --reporter=lcov --lines 100 npm test && nyc report",
|
|
10
|
+
"lint": "eslint index.js lib/resolver.js"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git://github.com/kenspirit/json-2-joi.git"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=12"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"json-to-joi",
|
|
21
|
+
"json-2-joi",
|
|
22
|
+
"joi",
|
|
23
|
+
"json-schema",
|
|
24
|
+
"json",
|
|
25
|
+
"schema",
|
|
26
|
+
"validation",
|
|
27
|
+
"conversion",
|
|
28
|
+
"hapi",
|
|
29
|
+
"enjoi"
|
|
30
|
+
],
|
|
31
|
+
"author": "Ken Chen <chengusky@gmail.com>",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/kenspirit/json-2-joi/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/kenspirit/json-2-joi",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@hapi/bourne": "^3.0.0",
|
|
38
|
+
"@hapi/hoek": "^9.3.0",
|
|
39
|
+
"debug": "^4.3.4"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"joi": "^17.6.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"joi": "^17.6.0",
|
|
46
|
+
"eslint": "^6.8.0",
|
|
47
|
+
"nyc": "^15.1.0",
|
|
48
|
+
"tape": "^5.5.3"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"lib/**/*.js",
|
|
52
|
+
"index.js"
|
|
53
|
+
]
|
|
54
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
### 2.3.1
|
|
2
|
-
|
|
3
|
-
- Fix `noDefaults` options validation issue.
|
|
4
|
-
|
|
5
|
-
### 2.3.0
|
|
6
|
-
|
|
7
|
-
- If `noDefaults` is set `true`, `default()` will not be set to Joi schema and allow it overridable.
|
|
8
|
-
|
|
9
|
-
### 2.2.0
|
|
10
|
-
|
|
11
|
-
- Add `forbidArrayNull`, `strictRequired` option.
|
|
12
|
-
|
|
13
|
-
### 2.1.0
|
|
14
|
-
|
|
15
|
-
- Fix the issue that `enum` is only applied to `string` type or when missing type info.
|
|
16
|
-
- Add `strictEnum` and `enableEnum` option.
|
|
17
|
-
- Allow override options when calling `convert` api.
|
|
18
|
-
|
|
19
|
-
### 2.0.2
|
|
20
|
-
|
|
21
|
-
- Remove `min` setting from JOI schema if `minLength` is not defined in JSON schema.
|
|
22
|
-
- Allow `null` value as Array's item if `allowNull` option is set to true.
|
|
23
|
-
|
|
24
|
-
### 2.0.1
|
|
25
|
-
|
|
26
|
-
- Set correct examples data for Array type field.
|
|
27
|
-
|
|
28
|
-
### 2.0.0
|
|
29
|
-
|
|
30
|
-
* [BREAKING] Remove `useDefaults` and `strictMode` options
|
|
31
|
-
|
|
32
|
-
### 1.1.0
|
|
33
|
-
|
|
34
|
-
- Support providing `joiOptions` for JOI default instance creation.
|
|
35
|
-
- Support directly passing a Joi instance for schema building.
|
|
36
|
-
|
|
37
|
-
### 1.0.0
|
|
38
|
-
|
|
39
|
-
- Provided `refineDescription(schema)`, `allowNull` options
|
|
40
|
-
- Change cycle reference resovling without self-generating id and rely on $id if defined in JSON schema
|
|
41
|
-
- Support `const` keyword in JSON schema
|
|
42
|
-
- Support `example` setting for Joi based on JSON schema's `examples`, `default` or `enum`
|
|
43
|
-
- Support `contains` keyword in JSON schema using Joi's `has` method
|
|
44
|
-
- Support `$anchor` keyword in JSON schema
|
|
45
|
-
- Remove `defaults` API. Please refer to section **Reuse JOI Schema Resolver** for similar usage.
|
|
46
|
-
- **Big Change** on `$ref` and `subSchemas`. Please refer to [test/test-references.js](test/test-references.js) for detail usage. Currently, four format of `$ref` are supported:
|
|
47
|
-
* id
|
|
48
|
-
* [baseUri]#anchor
|
|
49
|
-
* [baseUri]#/$defs/shared
|
|
50
|
-
* [baseUri]#/$defs/shared/properties/level1
|
|
51
|
-
|
|
52
|
-
**subSchemas will be modified** for two reason:
|
|
53
|
-
* If any subSchema does not have `$id` field, it will be added using the corresponding key in `subSchemas` object.
|
|
54
|
-
* New key-value pair will be added into it if the schema or any its subschema being parsed has `$id` field.
|
|
55
|
-
|
|
56
|
-
## Before Fork
|
|
57
|
-
|
|
58
|
-
### 9.0.1
|
|
59
|
-
|
|
60
|
-
* #112 Use joi.link to only resolve strictly recursive self-references
|
|
61
|
-
|
|
62
|
-
### 9.0.0
|
|
63
|
-
|
|
64
|
-
* #100 Allow extension constructors
|
|
65
|
-
* #101 Keep string enum type
|
|
66
|
-
* #104 Allow allOf, anyOf, oneOf to be combined with base schema
|
|
67
|
-
* #107 Cycles in schema refs (fixed #106)
|
|
68
|
-
* #108 Handle `not` properly
|
|
69
|
-
* #109 Defaults options
|
|
70
|
-
|
|
71
|
-
### 8.0.0
|
|
72
|
-
|
|
73
|
-
* [BREAKING] Switched from @hapi/joi to joi (#94)
|
|
74
|
-
* Added refineSchema function (#92)
|
|
75
|
-
|
|
76
|
-
### 7.0.0
|
|
77
|
-
|
|
78
|
-
* [BREAKING] Updated to Joi@17
|
|
79
|
-
* [BREAKING] Custom types moved to being defined under `extensions`
|
|
80
|
-
* [BREAKING] Extensions definitions to follow Joi@17
|
|
81
|
-
|
|
82
|
-
### 6.0.2
|
|
83
|
-
|
|
84
|
-
* Correct usage of joi `validate` function. joiSchema.validate(obj) instead of Joi.validate(obj, joiSchema).
|
|
85
|
-
|
|
86
|
-
### 6.0.1
|
|
87
|
-
|
|
88
|
-
* #83 differentiate between undefined and falsy
|
|
89
|
-
* #73 updated fix
|
|
90
|
-
|
|
91
|
-
### 6.0.0
|
|
92
|
-
|
|
93
|
-
* Do not set empty string as valid for all string types (#73)
|
|
94
|
-
* Updated joi and hoek to latest, drop Node 6 support (#76)
|
|
95
|
-
|
|
96
|
-
### v5.0.1
|
|
97
|
-
|
|
98
|
-
* #69
|
|
99
|
-
|
|
100
|
-
### v5.0.1
|
|
101
|
-
|
|
102
|
-
* #66
|
|
103
|
-
|
|
104
|
-
### v5.0.0
|
|
105
|
-
|
|
106
|
-
* [BREAKING] Addresses #63 : date format to follow RFC3339 as per JSON-Schema.
|
|
107
|
-
|
|
108
|
-
### v4.1.1
|
|
109
|
-
|
|
110
|
-
* Fixes `oneOf` requiring (#61).
|
|
111
|
-
|
|
112
|
-
### v4.1.0
|
|
113
|
-
|
|
114
|
-
* Added support for string formats `uuid` (v4) and `guid`.
|
|
115
|
-
|
|
116
|
-
### v4.0.0
|
|
117
|
-
|
|
118
|
-
* [BREAKING] export interface changed. Call `Enjoi.schema` instead of `Enjoi`.
|
|
119
|
-
* [BREAKING] `joi` is a peer.
|
|
120
|
-
* Added `extensions` support.
|
|
121
|
-
* `types` can also contain function values to do complex resolving of custom types.
|
|
122
|
-
* Added support for `Enjoi.defaults` which returns a new Enjoi with default options.
|
|
123
|
-
|
|
124
|
-
### v3.2.5
|
|
125
|
-
|
|
126
|
-
* Fixed allOf support (#53)
|
|
127
|
-
|
|
128
|
-
### v3.2.4
|
|
129
|
-
|
|
130
|
-
* Support for allOf
|
|
131
|
-
* Bug fixes
|
|
132
|
-
|
|
133
|
-
### v3.2.3
|
|
134
|
-
|
|
135
|
-
* Security fix to resolve https://nodesecurity.io/advisories/566
|
|
136
|
-
|
|
137
|
-
### v3.2.2
|
|
138
|
-
|
|
139
|
-
* Documentation fixes.
|
|
140
|
-
|
|
141
|
-
### v3.2.1
|
|
142
|
-
|
|
143
|
-
* Support array:additionalItems false setting.
|
|
144
|
-
|
|
145
|
-
### v3.2.0
|
|
146
|
-
|
|
147
|
-
* Added `strictMode` support and resolves #34.
|
|
148
|
-
|
|
149
|
-
### v3.1.0
|
|
150
|
-
|
|
151
|
-
* Added a refineType function option.
|
|
152
|
-
|
|
153
|
-
### v3.0.0
|
|
154
|
-
|
|
155
|
-
* [BREAKING] supports Joi 13.x (required Node 6+)
|
|
156
|
-
* Fixed additional properties https://github.com/tlivings/enjoi/pull/31
|
|
157
|
-
* Adds support for ordered and items https://github.com/tlivings/enjoi/pull/38
|
|
158
|
-
|
|
159
|
-
### v2.2.4
|
|
160
|
-
|
|
161
|
-
* Fixes mutating `options` to add `stripUnknown`.
|
|
162
|
-
|
|
163
|
-
### v2.2.3
|
|
164
|
-
|
|
165
|
-
* Fix #25 by supporting array for type (e.g. ['string', 'null']).
|
|
166
|
-
* Additional formats: hostname, uri, ipv4, ipv6.
|
|
167
|
-
|
|
168
|
-
### v2.2.2
|
|
169
|
-
|
|
170
|
-
* Added @jsdevel's additionalProperties (#14) fixes (thanks!)
|
|
171
|
-
|
|
172
|
-
### v2.2.1
|
|
173
|
-
|
|
174
|
-
* Add default value (#30).
|
|
175
|
-
|
|
176
|
-
### v2.2.0
|
|
177
|
-
|
|
178
|
-
* Added support for directly passing a `string` instead of a schema to indicate type.
|
|
179
|
-
|
|
180
|
-
### v2.1.0
|
|
181
|
-
|
|
182
|
-
* added support for mapping title (to label in joi).
|
|
183
|
-
* added support for mapping description.
|
|
184
|
-
* fixed engine version.
|
|
185
|
-
|
|
186
|
-
### v2.0.0
|
|
187
|
-
|
|
188
|
-
* updated `joi` to ^9.
|
|
189
|
-
* requires node 4 minimum.
|
|
190
|
-
|
|
191
|
-
### v1.0.4
|
|
192
|
-
|
|
193
|
-
* when undefined `minLength` should default to 0.
|
|
194
|
-
|
|
195
|
-
### v1.0.3
|
|
196
|
-
|
|
197
|
-
* Validate when `additionalProperties` is boolean.
|
|
198
|
-
|
|
199
|
-
### v1.0.2
|
|
200
|
-
|
|
201
|
-
* Support for `oneOf`.
|
|
202
|
-
|
|
203
|
-
### v1.0.1
|
|
204
|
-
|
|
205
|
-
* Support for `format` in string types.
|
|
206
|
-
|
|
207
|
-
### v1.0.0
|
|
208
|
-
|
|
209
|
-
* [BREAKING] `subSchemas` is now passed as a property in `options`.
|
|
210
|
-
* Support for custom types using `options.types`.
|