Skip to content

Commit

Permalink
Merge pull request #376 from guillotinaweb/fix_373_schemaprocessor
Browse files Browse the repository at this point in the history
fix #373: missing schemaprocessor implementation
  • Loading branch information
ebrehault authored Dec 14, 2020
2 parents 1e9a520 + 30f1eca commit 29d5135
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 2.5.11 (2020-12-03)
- fix #373: missing schemaprocessor implementation

# 2.5.10 (2020-12-03)
- fix #373: add support for array items with different schema definitions

Expand Down
2 changes: 1 addition & 1 deletion projects/schema-form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ngx-schema-form",
"version": "2.5.10",
"version": "2.5.11",
"repository": {
"type": "git",
"url": "git+https://github.com/guillotinaweb/ngx-schema-form"
Expand Down
11 changes: 10 additions & 1 deletion projects/schema-form/src/lib/model/schemapreprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,16 @@ export class SchemaPreprocessor {
}
}
} else if (jsonSchema.type === 'array') {
SchemaPreprocessor.preprocess(jsonSchema.items, path + '*/');
if (Array.isArray(jsonSchema.items || {})) {
for (let i = 0; i < jsonSchema.items.length; i++) {
SchemaPreprocessor.preprocess(jsonSchema.items[i], path + '*/');
}
} else {
SchemaPreprocessor.preprocess(jsonSchema.items, path + '*/');
}
if (jsonSchema.additionalItems) {
SchemaPreprocessor.preprocess(jsonSchema.additionalItems, path + '*/');
}
}
}

Expand Down

0 comments on commit 29d5135

Please sign in to comment.