Skip to content

Conversation

@adimus11
Copy link
Contributor

Fixes Or Enhances

This change fixes the issue with validating fields in composed structures when the validator uses . before the composed struct in the parent one.

Make sure that you've checked the boxes below before you submit PR:

  • Tests exist or have been written that cover this particular change.

@go-playground/admins

@coveralls
Copy link

coveralls commented Feb 25, 2021

Coverage Status

Coverage increased (+0.004%) to 76.074% when pulling d6c143c on Adimus11:correctlly-validate-composed-structs into f6584a4 on go-playground:master.

vd.misc = append(vd.misc[0:0], name...)
vd.misc = append(vd.misc, '.')
// Don't append empty name for composed structs
if string(vd.misc) != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we check the length of vd.misc here instead of casting to a string? It would be one less allocation :)

@adimus11 adimus11 requested a review from deankarn February 25, 2021 20:48
@deankarn deankarn merged commit ec1baac into go-playground:master Apr 6, 2021
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.

3 participants