fix: array 的子项为 object 时无法设置子项必选 #23
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,我最近在工作中 fork 并使用了这个项目,感谢作者的维护工作。今天我也遇到了 #21 中提到的必选项无法设置的问题,自己修复了一下。
原本的代码里使用
parentSchemaDepth
属性来追踪当前层级的方式个人感觉可以直接使用namePath
+getValueByPath
的方式来代替,代码的可读性也更强一些(调代码的时候这个parentSchemaDepth
行为确实让我有些困惑)。这个 PR 更改了updateRequiredProperty
的逻辑,也解决了上文中提到的 issue 所描述的问题。