mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-12 16:00:33 +03:00
Fix minimum/maximum zero not rendered (fixes #123)
This commit is contained in:
parent
02b061cbd8
commit
04d56f59e1
|
@ -137,16 +137,16 @@ const injectors = {
|
||||||
check: (propertySchema) => (propertySchema.type === 'integer' || propertySchema.type === 'number'),
|
check: (propertySchema) => (propertySchema.type === 'integer' || propertySchema.type === 'number'),
|
||||||
inject: (injectTo, propertySchema = injectTo) => {
|
inject: (injectTo, propertySchema = injectTo) => {
|
||||||
var range = '';
|
var range = '';
|
||||||
if (propertySchema.minimum && propertySchema.maximum) {
|
if (propertySchema.minimum != null && propertySchema.maximum != null) {
|
||||||
range += propertySchema.exclusiveMinimum ? '( ' : '[ ';
|
range += propertySchema.exclusiveMinimum ? '( ' : '[ ';
|
||||||
range += propertySchema.minimum;
|
range += propertySchema.minimum;
|
||||||
range += ' .. ';
|
range += ' .. ';
|
||||||
range += propertySchema.maximum;
|
range += propertySchema.maximum;
|
||||||
range += propertySchema.exclusiveMaximum ? ' )' : ' ]';
|
range += propertySchema.exclusiveMaximum ? ' )' : ' ]';
|
||||||
} else if (propertySchema.maximum) {
|
} else if (propertySchema.maximum != null) {
|
||||||
range += propertySchema.exclusiveMaximum? '< ' : '<= ';
|
range += propertySchema.exclusiveMaximum? '< ' : '<= ';
|
||||||
range += propertySchema.maximum;
|
range += propertySchema.maximum;
|
||||||
} else if (propertySchema.minimum) {
|
} else if (propertySchema.minimum != null) {
|
||||||
range += propertySchema.exclusiveMinimum ? '> ' : '>= ';
|
range += propertySchema.exclusiveMinimum ? '> ' : '>= ';
|
||||||
range += propertySchema.minimum;
|
range += propertySchema.minimum;
|
||||||
}
|
}
|
||||||
|
@ -160,11 +160,11 @@ const injectors = {
|
||||||
check: propertySchema => (propertySchema.type === 'string'),
|
check: propertySchema => (propertySchema.type === 'string'),
|
||||||
inject: (injectTo, propertySchema = injectTo) => {
|
inject: (injectTo, propertySchema = injectTo) => {
|
||||||
var range;
|
var range;
|
||||||
if (propertySchema.minLength && propertySchema.maxLength) {
|
if (propertySchema.minLength != null && propertySchema.maxLength != null) {
|
||||||
range = `[ ${propertySchema.minLength} .. ${propertySchema.maxLength} ]`;
|
range = `[ ${propertySchema.minLength} .. ${propertySchema.maxLength} ]`;
|
||||||
} else if (propertySchema.maxLength) {
|
} else if (propertySchema.maxLength != null) {
|
||||||
range = '<= ' + propertySchema.maxLength;
|
range = '<= ' + propertySchema.maxLength;
|
||||||
} else if (propertySchema.minLength) {
|
} else if (propertySchema.minLength != null) {
|
||||||
range = '>= ' + propertySchema.minLength;
|
range = '>= ' + propertySchema.minLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user