add support for 'required' tag value#167
Conversation
|
Would be nice if this could be set globally as well, for all fields. |
|
@bonifaido I was looking exactly for this. What's the status? |
|
I need to rebase on master now I guess, since this is almost 1 year old, after that I'm waiting on a review/merge 🙂 |
39194a0 to
1a6dfa8
Compare
|
Rebased it on latest master. |
|
@mitchellh Are there any plans to merge/review this? It's a really helpful addition! |
|
need merge |
|
this is feature is really helpful. can we give this a review? thanks :) @mitchellh |
|
Please merge |
|
Are you using my fork@branch @wangshuai14 ? |
Got it! thanks |
|
Just rebased on the latest master to see its working. |
|
@mitchellh |
|
If it's helpful to anyone, I forked mapstructure and merged this PR as well as #225 into my fork. Feel free to use. |
|
Hello all. Its been 3 years, and I've sat on this. I've integrated mapstructure into a dozen or more projects by this point. I've certainly run into this issue before. I believe that its better to use a full featured struct validation library rather than support this one feature in mapstructure. I've always reached for something like ozzo-validation or validator and felt that was just the better approach. I'm sorry, but I want to keep this library as focused on the decoding problem rather than data validation (beyond simple type matching -- necessary for decoding). |
|
Actually #225 is a great approach to this that I think balances the line between enabling this sort of functionality but not stepping into what in my opinion is validation territory in the same way. I'll merge that. |

Implementation for checking that required fields got filled in
map->structdecoding direction.A basic test has been added as well.
Fixes: #7