Schema returns "invalid path" error when struct does not contain all fields from submitted form

1,202 views
Skip to first unread message

peter...@gmail.com

unread,
Nov 4, 2013, 6:40:48 AM11/4/13
to goril...@googlegroups.com
Hi,

I'm working on an application that uses gorilla/schema. I assumed the decoding behavior worked like e.g. encoding/json, where Unmarshal ignores fields in the json document
that do not have corresponding fields in the target Struct type. However, schema returns an "invalid path" error.

Is this the intended behavior, or would you be open to pull requests that make schema ignore form fields that do not have corresponding fields in the Struct?

Kamil Kisiel

unread,
Nov 4, 2013, 1:20:24 PM11/4/13
to goril...@googlegroups.com
I believe there are some pull requests to that effect, but the authors have not provided any test cases so I haven't merged them. If you could take a look at one of the existing PRs and see if it works and provide some tests then we can merge the functionality. Unfortunately I don't really use gorilla/schema myself so I need to rely on others to tell me if the changes are any good or not :)

peter...@gmail.com

unread,
Nov 5, 2013, 2:36:05 PM11/5/13
to goril...@googlegroups.com
Great! I'll see what I can do with one of those PRs.

Matt Silverlock

unread,
Nov 8, 2013, 5:16:16 AM11/8/13
to goril...@googlegroups.com
https://github.com/gorilla/schema/pull/9 looks fairly complete and includes a test case, from what I can see. It may be worth checking/testing.

Kamil Kisiel

unread,
Nov 8, 2013, 1:11:01 PM11/8/13
to goril...@googlegroups.com
If it solves the problem, please comment on the issue and I'll merge it in.

Thomas Modeneis

unread,
Nov 19, 2016, 8:35:50 AM11/19/16
to Gorilla web toolkit
Hey,
I'm having a very similar error, and I've opened a ticket for gorilla with the test case evidencing the error.


Does anyone have any idea how to work around this?
Cheers.
Reply all
Reply to author
Forward
0 new messages