-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No Validate method for server parameter structs #2309
Comments
The |
I am currently working on a PR for this and I was wondering if the creation of a new array/map is necessary in the validation methods. At the moment when the validation takes place a new array/map is build and then reassigned to the property. Can this be omitted?
I would suggest to shorten it down to something like this:
|
Problem statement
When generating models with
swagger generate model
orswagger generate server
the resulting models from the swagger definitions all implement a validation method likeValidate(formats strfmt.Registry) error
. However, the generated models for parameters do not include this functionality.Validations for the parameter are currently generated but only used while binding the param struct. In order to use the validations standalone, without having to bind them with the generated method (for example when binding with a different framework), I propose to add a
Validate(formats strfmt.Registry) error
method togo-swagger/generator/templates/server/parameter.gotmpl
Line 489 in 548768a
Is there any interest in adding this functionality?
Environment
swagger version: 0.23.0
go version: 1.14.2
OS: Debian
The text was updated successfully, but these errors were encountered: