Skip to content

Commit

Permalink
Merge pull request #377 from guillotinaweb/fix_373_schemaprocessor_2.4.x
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 cd952a9 + c1e818b commit 8fd6851
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.4.12 (2020-12-03)
- fix #373: missing schemaprocessor implementation

# 2.4.11 (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.4.11",
"version": "2.4.12",
"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 @@ -134,7 +134,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 8fd6851

Please sign in to comment.