Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Broken validation errors with v0.15.4 #1886

Closed
AtomicNibble opened this issue Jan 26, 2020 · 7 comments
Closed

Broken validation errors with v0.15.4 #1886

AtomicNibble opened this issue Jan 26, 2020 · 7 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@AtomicNibble
Copy link

AtomicNibble commented Jan 26, 2020

It looks like validation errors for forms are broken in v0.15.4 due to some package changes.

New versions of github.com/gobuffalo/tags use github.com/gobuffalo/validate/v3 while a project created with buffalo new coke is pulling a old none v3 package github.com/gobuffalo/validate.

Which then means you end up with diffrent types resulting in the reflection not working here:
https://github.com/gobuffalo/tags/blob/master/form/form_for.go#L58-L69

Steps to Reproduce the Problem

Create a new v0.15.4 project and add a model with validation.
Eg: buffalo plugins install github.com/gobuffalo/buffalo-auth
Run locally buffalo dev
Place data in the form that fails server side validation.

Expected Behavior

Validation failures shown on page.

Actual Behavior

No reasons show on page.
Log contains Unexpected errors type *validate.Errors, please

Thanks.

@stanislas-m stanislas-m added the bug Something isn't working label Jan 29, 2020
@markbates
Copy link
Member

Can you please add full steps to reproduce and fill out the other information requested in the issue template?

With the detail provided, the issue can not be reproduced.

@paganotoni
Copy link
Member

paganotoni commented Feb 2, 2020

Oh! I was lucky enough to have the same experience this week. The way I solved it was changing all occurrences of github.com/gobuffalo/validate to be github.com/gobuffalo/validate/v3

Apparently Forms was expecting errors context variable to be assigned a v3 *validate.Errors, when this is not the case it prints something like:

Invalid type assigned in errors please use *validate.Errors

@AtomicNibble
Copy link
Author

I have updated OP with additional details, sorry for not been more clear.

@paganotoni
Copy link
Member

@markbates thoughts on a Fixer for this one?

@AtomicNibble
Copy link
Author

Judging from v0.15.5 release notes this looks fixed.

@breml
Copy link

breml commented Feb 24, 2020

Based on the workaround from @paganotoni I was able to make it work. Beside of changing all occurrences of github.com/gobuffalo/validate to be github.com/gobuffalo/validate/v3 I also needed to change to following:

  • github.com/gobuffalo/pop => github.com/gobuffalo/pop/v5
  • github.com/gobuffalo/buffalo-pop/pop/popmw => github.com/gobuffalo/buffalo-pop/v2/pop/popmw

Updating to v0.15.5 and executing buffalo fix on the project did not resolve the problem for me.

@paganotoni paganotoni added this to the v0.15.6 milestone Mar 22, 2020
@paganotoni
Copy link
Member

The latest tags version (v3.1.0) does not depend on any github.com/gobuffalo/validate version. Updating to that version should solve this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants