mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-06 21:10:33 +03:00
fix: displaying nested items with type string (#2634)
This commit is contained in:
parent
639fd2c32c
commit
85b622fc58
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ describe('FieldDetailsComponent', () => {
|
||||||
items: {
|
items: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
pattern: '^see regex[0-9]$',
|
pattern: '^see regex[0-9]$',
|
||||||
constraints: [''],
|
constraints: ['<= 128 characters'],
|
||||||
externalDocs: undefined,
|
externalDocs: undefined,
|
||||||
},
|
},
|
||||||
} as any as SchemaModel,
|
} as any as SchemaModel,
|
||||||
|
|
|
@ -161,13 +161,21 @@ exports[`FieldDetailsComponent renders correctly when field items have string ty
|
||||||
<span
|
<span
|
||||||
class="sc-kpDqfm sc-dAlyuH sc-dxcDKg cGRfjn gHomYR gXntsr"
|
class="sc-kpDqfm sc-dAlyuH sc-dxcDKg cGRfjn gHomYR gXntsr"
|
||||||
>
|
>
|
||||||
[
|
[ items
|
||||||
|
<span>
|
||||||
|
|
||||||
|
<span
|
||||||
|
class="sc-kpDqfm sc-gFqAkR cGRfjn fYEICH"
|
||||||
|
>
|
||||||
|
<= 128 characters
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
<span
|
<span
|
||||||
class="sc-kpDqfm sc-eDPEul cGRfjn cCKYVD"
|
class="sc-kpDqfm sc-eDPEul cGRfjn cCKYVD"
|
||||||
>
|
>
|
||||||
^see regex[0-9]$
|
^see regex[0-9]$
|
||||||
</span>
|
</span>
|
||||||
]
|
]
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user