fix: displaying nested items with type string

This commit is contained in:
Alex Varchuk 2024-12-30 15:50:06 +01:00
parent 639fd2c32c
commit 84ca1b1279
No known key found for this signature in database
GPG Key ID: 8A9260AE529FF454
2 changed files with 3 additions and 10 deletions

View File

@ -18,14 +18,6 @@ export function ArrayItemDetails({ schema }: { schema: SchemaModel }) {
return null; return null;
} }
if (schema.type === 'string' && schema.pattern) {
return (
<Wrapper>
[<Pattern schema={schema} />]
</Wrapper>
);
}
return ( return (
<Wrapper> <Wrapper>
[ items [ items

View File

@ -8,7 +8,7 @@ import {
TypePrefix, TypePrefix,
TypeTitle, TypeTitle,
} from '../../common-elements/fields'; } from '../../common-elements/fields';
import { getSerializedValue, isObject } from '../../utils'; import { getSerializedValue, isArray, isObject } from '../../utils';
import { ExternalDocumentation } from '../ExternalDocumentation/ExternalDocumentation'; import { ExternalDocumentation } from '../ExternalDocumentation/ExternalDocumentation';
import { Markdown } from '../Markdown/Markdown'; import { Markdown } from '../Markdown/Markdown';
import { EnumValues } from './EnumValues'; import { EnumValues } from './EnumValues';
@ -30,7 +30,8 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {
const { showExamples, field, renderDiscriminatorSwitch } = props; const { showExamples, field, renderDiscriminatorSwitch } = props;
const { schema, description, deprecated, extensions, in: _in, const: _const } = field; const { schema, description, deprecated, extensions, in: _in, const: _const } = field;
const isArrayType = schema.type === 'array'; const isArrayType =
schema.type === 'array' || (isArray(schema.type) && schema.type.includes('array'));
const rawDefault = enumSkipQuotes || _in === 'header'; // having quotes around header field default values is confusing and inappropriate const rawDefault = enumSkipQuotes || _in === 'header'; // having quotes around header field default values is confusing and inappropriate