@vingle/joi-to-json-schema
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -194,3 +194,3 @@ 'use strict'; | ||
schema.properties[property.key] = convert(property.schema); | ||
if (property.schema._flags.presence === 'required') { | ||
if (property.schema._flags.presence !== 'optional') { | ||
schema.required = schema.required || []; | ||
@@ -242,2 +242,6 @@ schema.required.push(property.key); | ||
if (joi._examples && joi._examples.length === 1) { | ||
schema.example = joi._examples[0]; | ||
} | ||
// Add the label as a title if it exists | ||
@@ -244,0 +248,0 @@ if (joi._settings && joi._settings.language && joi._settings.language.label) { |
{ | ||
"name": "@vingle/joi-to-json-schema", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Joi -> JSON Schema Converter", | ||
@@ -28,5 +28,5 @@ "main": "build/index.js", | ||
{ | ||
"name" : "MooYeol Prescott Lee", | ||
"email" : "mooyoul@gmail.com", | ||
"url" : "https://github.com/mooyoul" | ||
"name": "MooYeol Prescott Lee", | ||
"email": "mooyoul@gmail.com", | ||
"url": "https://github.com/mooyoul" | ||
} | ||
@@ -33,0 +33,0 @@ ], |
@@ -186,3 +186,3 @@ import assert from 'assert'; | ||
schema.properties[property.key] = convert(property.schema); | ||
if (property.schema._flags.presence === 'required') { | ||
if (property.schema._flags.presence !== 'optional') { | ||
schema.required = schema.required || []; | ||
@@ -230,2 +230,6 @@ schema.required.push(property.key); | ||
schema.examples = joi._examples; | ||
} | ||
if (joi._examples && joi._examples.length === 1) { | ||
schema.example = joi._examples[0]; | ||
} | ||
@@ -232,0 +236,0 @@ |
@@ -86,2 +86,3 @@ //@formatter:off | ||
additionalProperties: false, | ||
example: { key: 'value' }, | ||
examples: [{ key: 'value' }] | ||
@@ -88,0 +89,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
140671
23
1185