Commit 66219933 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

feat: slightly relax wizard validation forcing certain items to be last

Previously all wizard items not of type credential were forced to be last,
but it suffices to force only items having no credential type to be last
(regardless of their type), because only those cannot be taken into account
in the dependency expansion algorithm.
parent 15366c00
......@@ -381,13 +381,11 @@ func (wizard *IssueWizard) Validate(conf *Configuration) error {
for i, outer := range wizard.Contents {
for j, middle := range outer {
for k, item := range middle {
// validate all non-credential-items of a wizard are at the end
if item.Type != "credential" {
// validate all items having no credential type of a wizard are at the end
if item.Credential == nil {
shouldBeLast = true
} else {
if shouldBeLast {
return errors.Errorf("non-credential types in wizard %s should come last", wizard.ID)
}
} else if shouldBeLast {
return errors.Errorf("items having no credential type in wizard %s should come last", wizard.ID)
}
if err := item.validate(conf); err != nil {
......
......@@ -1085,7 +1085,7 @@ func TestWizardIncorrectContentsOrder(t *testing.T) {
}
err := wizard.Validate(conf)
require.EqualError(t, err, "non-credential types in wizard testwizard should come last")
require.EqualError(t, err, "items having no credential type in wizard testwizard should come last")
}
func TestWizardComplexity(t *testing.T) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment