Skip to content

Commit b0fc19a

Browse files
authored
Merge pull request #18 from michaelbeaumont/patch-1
Don't throw exception if `properties` not defined for `object`. Instead, use empty object.
2 parents b9e7473 + 75ae7cc commit b0fc19a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

docs/lib/JSONSchemaMarkdown.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,7 @@ class JSONSchemaMarkdown {
255255
*/
256256
typeObject(name, data, level, path) {
257257
const required = data.required ?? [];
258-
if (this.empty(data.properties)) {
259-
throw "`object` missing properties at " + path;
260-
}
258+
const properties = data.properties || {};
261259
this.writeAdditionalProperties(data.additionalProperties, level);
262260

263261
if (this.notEmpty(data.minProperties) || this.notEmpty(data.maxProperties)) {
@@ -269,9 +267,9 @@ class JSONSchemaMarkdown {
269267
this.writePropertyNames(data.propertyNames, level);
270268
this.writeSectionName("Properties", level, path);
271269
path += "/properties";
272-
for (var propName in data.properties) {
270+
for (var propName in properties) {
273271
var propPath = path + this.pathDivider + propName;
274-
var property = data.properties[propName];
272+
var property = properties[propName];
275273
var isRequired = (required.indexOf(propName) > -1);
276274
this.writePropertyName(propName, level + 1, propPath, isRequired);
277275
this.generateChildren(propName, property, level + 2, propPath);

0 commit comments

Comments
 (0)