-
-
{schema.typePrefix}
-
{schema.displayType}
- {schema.displayFormat && (
-
- {' '}
- <
- {schema.displayFormat}
- >{' '}
-
- )}
- {schema.contentEncoding && (
-
- {' '}
- <
- {schema.contentEncoding}
- >{' '}
-
- )}
- {schema.contentMediaType && (
-
- {' '}
- <
- {schema.contentMediaType}
- >{' '}
-
- )}
- {schema.title && !hideSchemaTitles &&
({schema.title}) }
-
- {schema.pattern && !hideSchemaPattern && (
- <>
-
- {patternShown || schema.pattern.length < MAX_PATTERN_LENGTH
- ? schema.pattern
- : `${schema.pattern.substr(0, MAX_PATTERN_LENGTH)}...`}
-
- {schema.pattern.length > MAX_PATTERN_LENGTH && (
-
- {patternShown ? 'Hide pattern' : 'Show pattern'}
-
- )}
- >
- )}
- {schema.isCircular &&
{l('recursive')} }
-
- {deprecated && (
-
- {l('deprecated')}
-
+
{schema.typePrefix}
+
{schema.displayType}
+ {schema.displayFormat && (
+
+ {' '}
+ <
+ {schema.displayFormat}
+ >{' '}
+
+ )}
+ {schema.contentEncoding && (
+
+ {' '}
+ <
+ {schema.contentEncoding}
+ >{' '}
+
)}
-
- {!renderDiscriminatorSwitch &&
}{' '}
- {renderedExamples}
- {
}
+ {schema.contentMediaType && (
+
+ {' '}
+ <
+ {schema.contentMediaType}
+ >{' '}
+
+ )}
+ {schema.title && !hideSchemaTitles &&
({schema.title}) }
+
+
+ {schema.isCircular &&
{l('recursive')} }
+ {isArrayType && schema.items &&
}
+
+ {deprecated && (
-
+ {l('deprecated')}
- {schema.externalDocs && (
-
- )}
- {(renderDiscriminatorSwitch && renderDiscriminatorSwitch(this.props)) || null}
- {(field.const &&
) || null}
+ )}
+
+ {!renderDiscriminatorSwitch && (
+
+ )}{' '}
+ {renderedExamples}
+
+
+
- );
- }
-}
-
-function Examples({ field }: { field: FieldModel }) {
- if (!field.examples) {
- return null;
- }
-
- return (
- <>
-
{l('examples')}:
-
- {Object.values(field.examples).map((example, idx) => {
- return (
-
- {getSerializedValue(field, example.value)} -{' '}
- {example.summary || example.description}
-
- );
- })}
-
- >
+ {schema.externalDocs && (
+
+ )}
+ {(renderDiscriminatorSwitch && renderDiscriminatorSwitch(props)) || null}
+ {(_const &&
) || null}
+
);
}
-function getSerializedValue(field: FieldModel, example: any) {
- if (field.in) {
- // decode for better readability in examples: see https://github.com/Redocly/redoc/issues/1138
- return decodeURIComponent(serializeParameterValue(field, example));
- } else {
- return example;
- }
-}
-
-const ExamplesList = styled.ul`
- margin-top: 1em;
- padding-left: 0;
- list-style-position: inside;
-`;
+export const FieldDetails = React.memo