fix: dropdown if type is array

This commit is contained in:
Alex Varchuk 2021-05-31 18:30:15 +03:00
parent 9fdcdfb049
commit ce264112f2
2 changed files with 5 additions and 1 deletions

View File

@ -63,6 +63,10 @@ export class Schema extends React.Component<Partial<SchemaProps>> {
return <OneOfSchema schema={schema} {...this.props} />;
}
if (type && Array.isArray(type)) {
return <ArraySchema {...(this.props as any)} />;
}
switch (type) {
case 'object':
if (schema.fields?.length) {

View File

@ -166,7 +166,7 @@ export class SchemaModel {
if (this.type === 'object') {
this.fields = buildFields(parser, schema, this.pointer, this.options);
} else if (this.type === 'array' && schema.items) {
} else if ((this.type === 'array' || Array.isArray(this.type)) && schema.items) {
this.items = new SchemaModel(parser, schema.items, this.pointer + '/items', this.options);
this.displayType = pluralizeType(this.items.displayType);
this.displayFormat = this.items.format;