Skip to content
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

Add more validation to service struct #1110

Merged
merged 1 commit into from
Jun 26, 2019
Merged

Conversation

krhubert
Copy link
Contributor

close #1088

@antho1404 antho1404 merged commit f061345 into dev Jun 26, 2019
@antho1404 antho1404 deleted the fix/service-validation branch June 26, 2019 04:10
@@ -22,5 +22,5 @@ type Parameter struct {
Repeated bool `hash:"name:6"`

// Definition of the structure of the object when the type is object
Object []*Parameter `hash:"name:7"`
Object []*Parameter `hash:"name:7" validate:"unique,dive,required"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this one is unique?
does it actually works?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it won't be used here, but shouldn't exist


existparam := make(map[string]bool)
for _, param := range event.Data {
if existparam[param.Key] {
Copy link
Member

@NicolasMahe NicolasMahe Jun 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params.Object keys are not tested (task inputs, task outputs and event)
maybe we could use the validation lib with something like:

Object []*Parameter `hash:"name:7" validate:"dive,(key)unique,required"`

otherwise a function that validate keys of type []*Parameter that can be called recursively.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise a new custom validation like PortMapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add back validation on service struct
3 participants