mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-07 13:30:33 +03:00
parent
e76bcc3329
commit
d175a4d6ae
|
@ -59,6 +59,16 @@ describe('Spec Helper', () => {
|
|||
SchemaHelper.runInjectors(schema, schema, '#/');
|
||||
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;
|
||||
if (propertySchema.minLength != undefined && propertySchema.maxLength != undefined) {
|
||||
if (propertySchema.minLength === propertySchema.maxLength) {
|
||||
range = `${propertySchema.minLength}`;
|
||||
range = `${propertySchema.minLength} characters`;
|
||||
} else {
|
||||
range = `[ ${propertySchema.minLength} .. ${propertySchema.maxLength} ]`;
|
||||
range = `[ ${propertySchema.minLength} .. ${propertySchema.maxLength} ] characters`;
|
||||
}
|
||||
} else if (propertySchema.maxLength != undefined) {
|
||||
range = '<= ' + propertySchema.maxLength;
|
||||
range = `<= ${propertySchema.maxLength} characters`;
|
||||
} 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 + ' characters';
|
||||
}
|
||||
injectTo._range = range;
|
||||
}
|
||||
},
|
||||
file: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user