Skip to content

Commit

Permalink
fix: do not display long regexps (#1295)
Browse files Browse the repository at this point in the history
  • Loading branch information
stasiukanya authored Jun 9, 2020
1 parent 5bace30 commit 2ede22c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Fields/FieldDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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 && (
Expand Down

0 comments on commit 2ede22c

Please sign in to comment.