Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix array path resolve for descendants #669

Merged
merged 3 commits into from
Oct 24, 2019

Conversation

serhii-ohorodnyk
Copy link
Contributor

At the moment during casting process Array type passes the field path to sub items without resolving it according to sub item array index.
The path is exposed to end consumer as part of context in conditional validation when (could be somewhere else).
If conditional validation relies on context path - this behaviour will lead to bugs.

src/array.js Outdated
const castElement = this._subType.cast(v, _opts);
const castArray = value.map((v, idx) => {
var path = makePath`${_opts.path}[${idx}]`;
var innerOptions = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move this inline below: cast(v, { ..._opts, path: makePat

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for quick check @jquense ! Made the change.

@jquense jquense merged commit d31e34d into jquense:master Oct 24, 2019
@jquense
Copy link
Owner

jquense commented Oct 24, 2019

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants