mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 16:46:34 +03:00
Render max/minCharacters (#42)
This commit is contained in:
parent
4c923682ba
commit
4bde2f7894
|
@ -225,5 +225,22 @@ const injectors = {
|
|||
injectTo._range = range;
|
||||
}
|
||||
}
|
||||
},
|
||||
string: {
|
||||
check: propertySchema => (propertySchema.type === 'string'),
|
||||
inject: (injectTo, propertySchema = injectTo) => {
|
||||
var range;
|
||||
if (propertySchema.minLength && propertySchema.maxLength) {
|
||||
range = `[ ${propertySchema.minLength} .. ${propertySchema.maxLength} ]`;
|
||||
} else if (propertySchema.maxLength) {
|
||||
range = '<= ' + propertySchema.maxLength;
|
||||
} else if (propertySchema.minimum) {
|
||||
range = '>= ' + propertySchema.minLength;
|
||||
}
|
||||
|
||||
if (range) {
|
||||
injectTo._range = range + ' characters';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user