Skip to content

Commit

Permalink
Rename allowedRootChildren field
Browse files Browse the repository at this point in the history
  • Loading branch information
ubavic committed Aug 24, 2024
1 parent c0b92f2 commit e85fc09
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Target struct {
}

type Source struct {
AllowedRootChildren string `yaml:"allowedRootChildren"`
AllowedRootCommands string `yaml:"allowedRootChildren"`
Commands []Command `yaml:"commands"`
Groups []Group `yaml:"groups"`
}
Expand Down
4 changes: 2 additions & 2 deletions schema/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func (s Schema) validate(document parser.Element, parent *string) error {
var err error

if parent == nil {
if s.Source.AllowedRootChildren != "" {
parentAllowedCommands, err = s.getGroup(s.Source.AllowedRootChildren)
if s.Source.AllowedRootCommands != "" {
parentAllowedCommands, err = s.getGroup(s.Source.AllowedRootCommands)
if err != nil {
return fmt.Errorf("%w: parent allowed commands", err)
}
Expand Down
8 changes: 4 additions & 4 deletions schema/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func TestSchemaValidator(t *testing.T) {
Commands []schema.Command
Tokens []parser.Token
Groups []schema.Group
AllowedRootChildren string
AllowedRootCommands string
ExpectedError error
}{
{
Expand Down Expand Up @@ -75,7 +75,7 @@ func TestSchemaValidator(t *testing.T) {
{Type: parser.Identifier, Content: "c1"},
{Type: parser.EOF, Content: ""},
},
AllowedRootChildren: "G1",
AllowedRootCommands: "G1",
Groups: []schema.Group{
{
Name: "G1",
Expand All @@ -92,7 +92,7 @@ func TestSchemaValidator(t *testing.T) {
{Type: parser.Identifier, Content: "c1"},
{Type: parser.EOF, Content: ""},
},
AllowedRootChildren: "G1",
AllowedRootCommands: "G1",
Groups: []schema.Group{
{
Name: "G1",
Expand All @@ -109,7 +109,7 @@ func TestSchemaValidator(t *testing.T) {
func(t *testing.T) {
sc := schema.Schema{
Source: schema.Source{
AllowedRootChildren: testCase.AllowedRootChildren,
AllowedRootCommands: testCase.AllowedRootCommands,
Commands: testCase.Commands,
Groups: testCase.Groups,
},
Expand Down

0 comments on commit e85fc09

Please sign in to comment.