mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-07 21:40:32 +03:00
parent
e76bcc3329
commit
d175a4d6ae
|
@ -59,6 +59,16 @@ describe('Spec Helper', () => {
|
||||||
SchemaHelper.runInjectors(schema, schema, '#/');
|
SchemaHelper.runInjectors(schema, schema, '#/');
|
||||||
schema._range.should.be.equal('5 characters');
|
schema._range.should.be.equal('5 characters');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should show range as non-empty for minLength == 1', () => {
|
||||||
|
let schema:any = {
|
||||||
|
type: 'string',
|
||||||
|
minLength: 1
|
||||||
|
};
|
||||||
|
|
||||||
|
SchemaHelper.runInjectors(schema, schema, '#/');
|
||||||
|
schema._range.should.be.equal('non-empty');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -151,19 +151,21 @@ const injectors = {
|
||||||
var range;
|
var range;
|
||||||
if (propertySchema.minLength != undefined && propertySchema.maxLength != undefined) {
|
if (propertySchema.minLength != undefined && propertySchema.maxLength != undefined) {
|
||||||
if (propertySchema.minLength === propertySchema.maxLength) {
|
if (propertySchema.minLength === propertySchema.maxLength) {
|
||||||
range = `${propertySchema.minLength}`;
|
range = `${propertySchema.minLength} characters`;
|
||||||
} else {
|
} else {
|
||||||
range = `[ ${propertySchema.minLength} .. ${propertySchema.maxLength} ]`;
|
range = `[ ${propertySchema.minLength} .. ${propertySchema.maxLength} ] characters`;
|
||||||
}
|
}
|
||||||
} else if (propertySchema.maxLength != undefined) {
|
} else if (propertySchema.maxLength != undefined) {
|
||||||
range = '<= ' + propertySchema.maxLength;
|
range = `<= ${propertySchema.maxLength} characters`;
|
||||||
} else if (propertySchema.minLength != undefined) {
|
} else if (propertySchema.minLength != undefined) {
|
||||||
range = '>= ' + propertySchema.minLength;
|
if (propertySchema.minLength === 1) {
|
||||||
|
range = 'non-empty';
|
||||||
|
} else {
|
||||||
|
range = `>= ${propertySchema.minLength} characters`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (range) {
|
injectTo._range = range;
|
||||||
injectTo._range = range + ' characters';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
file: {
|
file: {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user