Skip to content

Commit

Permalink
Add doc for RequiredFields function
Browse files Browse the repository at this point in the history
Signed-off-by: Sergen Yalçın <[email protected]>
(cherry picked from commit 845dbf6)
  • Loading branch information
sergenyalcin committed Mar 19, 2024
1 parent 335c06b commit 36a16b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions pkg/config/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ type Resource struct {
requiredFields []string
}

// RequiredFields returns slice of the marked as required fieldpaths.
func (r *Resource) RequiredFields() []string {
return r.requiredFields
}
Expand Down
5 changes: 1 addition & 4 deletions pkg/types/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,7 @@ func newTopLevelRequiredParam(path string, includeInit bool) *topLevelRequiredPa
}

func (r *resource) addParameterField(f *Field, field *types.Var) {
requiredBySchema := !f.Schema.Optional
if f.Required {
requiredBySchema = f.Required
}
requiredBySchema := !f.Schema.Optional || f.Required
// Note(turkenh): We are collecting the top level required parameters that
// are not identifier fields. This is for generating CEL validation rules for
// those parameters and not to require them if the management policy is set
Expand Down

0 comments on commit 36a16b2

Please sign in to comment.