Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
fix: do not display long regexps (Redocly#1295)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Cerman committed Jun 19, 2020
1 parent 354a87b commit 5c2c07d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/Fields/FieldDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ import { FieldDetail } from './FieldDetail';
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() {
const { showExamples, field, renderDiscriminatorSwitch } = this.props;
const { enumSkipQuotes } = this.context;
Expand Down Expand Up @@ -58,7 +62,9 @@ export class FieldDetails extends React.PureComponent<FieldProps> {
{/*{schema.title && <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 5c2c07d

Please sign in to comment.