Skip to content

Commit

Permalink
chore: adjust comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dadav committed Sep 17, 2023
1 parent 9fd2d8e commit 47a81e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 8 additions & 3 deletions cmd/helm-schema/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (
"strings"
"sync"

"github.com/dadav/helm-schema/pkg/chart"
"github.com/dadav/helm-schema/pkg/schema"
"github.com/dadav/helm-schema/pkg/util"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
yaml "gopkg.in/yaml.v3"

"github.com/dadav/helm-schema/pkg/chart"
"github.com/dadav/helm-schema/pkg/schema"
"github.com/dadav/helm-schema/pkg/util"
)

func searchFiles(startPath, fileName string, queue chan<- string, errs chan<- error) {
Expand Down Expand Up @@ -288,8 +289,12 @@ loop:
Description: dependencyResult.Chart.Description,
Properties: dependencyResult.Schema.Properties,
}
// you don't NEED to overwrite the values
// so every required check will be disabled
depSchema.DisableRequiredProperties()

result.Schema.Properties[dep.Name] = &depSchema

} else {
log.Warnf("Dependency (%s->%s) specified but no schema found. If you want to create jsonschemas for external dependencies, you need to run helm dependency build & untar the charts.", result.Chart.Name, dep.Name)
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ func YamlToSchema(
}

// If the value is another map and no properties are set, get them from default values
// TODO: also consider allOf, anyOf and oneOf
if valueNode.Kind == yaml.MappingNode && keyNodeSchema.Properties == nil {
requiredProperties := []string{}
keyNodeSchema.Properties = YamlToSchema(
Expand All @@ -408,7 +407,6 @@ func YamlToSchema(
}
} else if valueNode.Kind == yaml.SequenceNode && keyNodeSchema.Items == nil {
// If the value is a sequence, but no items are predefined
// TODO: also consider allOf, anyOf and oneOf
var seqSchema Schema

for _, itemNode := range valueNode.Content {
Expand All @@ -426,7 +424,6 @@ func YamlToSchema(
itemSchema.RequiredProperties = itemRequiredProperties
}

// here
if itemNode.Kind == yaml.MappingNode && (!itemSchema.HasData || itemSchema.AdditionalProperties == nil) {
itemSchema.AdditionalProperties = new(bool)
}
Expand Down

0 comments on commit 47a81e5

Please sign in to comment.