We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Generation models for official docker swagger specification is writing models with error in validation methods.
https://raw.githubusercontent.com/docker/engine/v19.03.13/api/swagger.yaml
swagger generate model \ -f https://raw.githubusercontent.com/docker/engine/v19.03.13/api/swagger.yaml \ --target internal/generated
Definition https://raw.githubusercontent.com/docker/engine/v19.03.13/api/swagger.yaml#/definitions/PortMap
Part of generated code for definition
// swagger:model PortMap type PortMap map[string]*[]PortBinding // Validate validates this port map func (m PortMap) Validate(formats strfmt.Registry) error { var res []error for k := range m { if err := validate.Required(k, "body", m[k]); err != nil { return err } for i := 0; i < len(m[k]); i++ { if err := m[k][i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName(k + "." + strconv.Itoa(i)) } return err } } } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }
We can't get len(m[k]) cause of pointer to slice. And we can't get m[k][i] cause pointer does not support indexing. So build will be failed.
len(m[k])
m[k][i]
swagger version: v0.26.0 go version: 1.15.6 OS: darwin/linux
The text was updated successfully, but these errors were encountered:
fixed map elements which are arrays should never be rendered with a p…
1b1c70c
…ointer, regardless of the x-nullable directive * fixes go-swagger#2494 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
d9443ab
c1a6d50
…ointer, (#2497) regardless of the x-nullable directive * fixes #2494 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@fredbi can you make a release/tag 0.26.1? we need docker image with new version and with this fix.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Problem statement
Generation models for official docker swagger specification is writing models with error in validation methods.
Swagger specification
https://raw.githubusercontent.com/docker/engine/v19.03.13/api/swagger.yaml
Steps to reproduce
Example
Definition https://raw.githubusercontent.com/docker/engine/v19.03.13/api/swagger.yaml#/definitions/PortMap
Part of generated code for definition
We can't get
len(m[k])
cause of pointer to slice.And we can't get
m[k][i]
cause pointer does not support indexing.So build will be failed.
Environment
swagger version: v0.26.0
go version: 1.15.6
OS: darwin/linux
The text was updated successfully, but these errors were encountered: