fix: do not display long regexps (#1295)

This commit is contained in:
Anna Stasiuk 2020-06-09 13:36:43 +03:00 committed by GitHub
parent 5bace3008f
commit 2ede22c45c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,8 @@ import { Badge } from '../../common-elements/';
import { l } from '../../services/Labels';
import { OptionsContext } from '../OptionsProvider';
const MAX_PATTERN_LENGTH = 45;
export class FieldDetails extends React.PureComponent<FieldProps> {
static contextType = OptionsContext;
render() {
@ -62,7 +64,9 @@ export class FieldDetails extends React.PureComponent<FieldProps> {
{schema.title && !hideSchemaTitles && <TypeTitle> ({schema.title}) </TypeTitle>}
<ConstraintsView constraints={schema.constraints} />
{schema.nullable && <NullableLabel> {l('nullable')} </NullableLabel>}
{schema.pattern && <PatternLabel> {schema.pattern} </PatternLabel>}
{schema.pattern && schema.pattern.length < MAX_PATTERN_LENGTH && (
<PatternLabel> {schema.pattern} </PatternLabel>
)}
{schema.isCircular && <RecursiveLabel> {l('recursive')} </RecursiveLabel>}
</div>
{deprecated && (