Skip to content

Commit

Permalink
fix: displaying nested items with type string
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVarchuk committed Dec 30, 2024
1 parent 639fd2c commit 84ca1b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
8 changes: 0 additions & 8 deletions src/components/Fields/ArrayItemDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ export function ArrayItemDetails({ schema }: { schema: SchemaModel }) {
return null;
}

if (schema.type === 'string' && schema.pattern) {
return (
<Wrapper>
[<Pattern schema={schema} />]
</Wrapper>
);
}

return (
<Wrapper>
[ items
Expand Down
5 changes: 3 additions & 2 deletions src/components/Fields/FieldDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TypePrefix,
TypeTitle,
} from '../../common-elements/fields';
import { getSerializedValue, isObject } from '../../utils';
import { getSerializedValue, isArray, isObject } from '../../utils';
import { ExternalDocumentation } from '../ExternalDocumentation/ExternalDocumentation';
import { Markdown } from '../Markdown/Markdown';
import { EnumValues } from './EnumValues';
Expand All @@ -30,7 +30,8 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {

const { showExamples, field, renderDiscriminatorSwitch } = props;
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

Expand Down

0 comments on commit 84ca1b1

Please sign in to comment.