Skip to content

Commit

Permalink
refactor: move validate to expose it as receivers (#2419)
Browse files Browse the repository at this point in the history
## Description

Moves `validate` behavior out of `internal` and onto receivers to their
given types. Since validation requires no external logic, this fits
better and has a cleaner experience. Additionally, validation can be
called against each type itself individually instead of only living at
the package level.

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed

---------

Signed-off-by: razzle <[email protected]>
Co-authored-by: Austin Abro <[email protected]>
  • Loading branch information
Noxsios and AustinAbro321 committed May 10, 2024
1 parent 898061d commit 9ca6e9a
Show file tree
Hide file tree
Showing 12 changed files with 388 additions and 397 deletions.
369 changes: 0 additions & 369 deletions src/internal/packager/validate/validate.go

This file was deleted.

3 changes: 1 addition & 2 deletions src/pkg/packager/composer/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"strings"

"github.com/defenseunicorns/pkg/helpers"
"github.com/defenseunicorns/zarf/src/internal/packager/validate"
"github.com/defenseunicorns/zarf/src/pkg/layout"
"github.com/defenseunicorns/zarf/src/pkg/packager/deprecated"
"github.com/defenseunicorns/zarf/src/pkg/utils"
Expand Down Expand Up @@ -142,7 +141,7 @@ func NewImportChain(head types.ZarfComponent, index int, originalPackageName, ar
}

// TODO: stuff like this should also happen in linting
if err := validate.ImportDefinition(&node.ZarfComponent); err != nil {
if err := node.ZarfComponent.ValidateImportDefinition(); err != nil {
return ic, err
}

Expand Down
Loading

0 comments on commit 9ca6e9a

Please sign in to comment.