GoogleCloudPlatform / go-endpoints

Cloud Endpoints for Go
https://go-endpoints.appspot.com
Apache License 2.0
255 stars 56 forks source link

json tags validation #79

Closed miko-code closed 9 years ago

miko-code commented 9 years ago

Hi , In the struct usage example , you use the endpoints:"req"` that suppose to be a mandatory field ? I tried to pass an empty value to a field with the endpoints:req tag and i didn't get any error What will be the best way to valid mandatory fields ?

i can do something like that but it must be a nicer solution

if len(subscriptionToken) == 0 {
        return endpoints.NewAPIError("subscriptionToken is empty", "subscriptionToken is empty", 400)
    }
campoy commented 9 years ago

First attempt to fix this: https://github.com/GoogleCloudPlatform/go-endpoints/pull/87/files

campoy commented 9 years ago

dup of #72