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 formatting Validation Error for Map items #8333

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/core/plugins/spec/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,17 @@ export const validationErrors = (state, pathMethod) => {
paramValues.forEach( (p) => {
let errors = p.get("errors")
if ( errors && errors.count() ) {
errors.forEach( e => result.push(e))
errors
.map( e => {
if (e instanceof Map) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you change this to if (Map.isMap(e)), to use a method from Immutable?

return `${e.get("propKey")} : ${e.get("error")}`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove the spacing before the colon ${e.get("propKey")}: ${e.get("error")}?

} else {
return e
}
})
.forEach( e => result.push(e))
Copy link
Member

@char0n char0n Mar 7, 2024

Choose a reason for hiding this comment

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

Can we go for a little bit more concise way of writing this code?

errors
  .map((e) => (Map.isMap(e) ? `${e.get("propKey")} : ${e.get("error")}` : e))
  .forEach((e) => result.push(e))

}
})

return result
}

Expand Down