mirror of https://github.com/databricks/cli.git
apply comments
This commit is contained in:
parent
699f7dd527
commit
769d092108
|
@ -24,10 +24,7 @@ func (s *Schema) LoadInstance(path string) (map[string]any, error) {
|
||||||
// We convert integer properties from float64 to int64 here.
|
// We convert integer properties from float64 to int64 here.
|
||||||
for name, v := range instance {
|
for name, v := range instance {
|
||||||
propertySchema, ok := s.Properties[name]
|
propertySchema, ok := s.Properties[name]
|
||||||
if !ok {
|
if !ok || propertySchema.Type != IntegerType {
|
||||||
continue
|
|
||||||
}
|
|
||||||
if propertySchema.Type != IntegerType {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
integerValue, err := toInteger(v)
|
integerValue, err := toInteger(v)
|
||||||
|
@ -105,10 +102,7 @@ func (s *Schema) validateTypes(instance map[string]any) error {
|
||||||
func (s *Schema) validateEnum(instance map[string]any) error {
|
func (s *Schema) validateEnum(instance map[string]any) error {
|
||||||
for k, v := range instance {
|
for k, v := range instance {
|
||||||
fieldInfo, ok := s.Properties[k]
|
fieldInfo, ok := s.Properties[k]
|
||||||
if !ok {
|
if !ok || fieldInfo.Enum == nil {
|
||||||
continue
|
|
||||||
}
|
|
||||||
if fieldInfo.Enum == nil {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !slices.Contains(fieldInfo.Enum, v) {
|
if !slices.Contains(fieldInfo.Enum, v) {
|
||||||
|
@ -135,10 +129,7 @@ func (s *Schema) validatePattern(instance map[string]any) error {
|
||||||
func (s *Schema) validateConst(instance map[string]any) error {
|
func (s *Schema) validateConst(instance map[string]any) error {
|
||||||
for k, v := range instance {
|
for k, v := range instance {
|
||||||
fieldInfo, ok := s.Properties[k]
|
fieldInfo, ok := s.Properties[k]
|
||||||
if !ok {
|
if !ok || fieldInfo.Const == nil {
|
||||||
continue
|
|
||||||
}
|
|
||||||
if fieldInfo.Const == nil {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if v != fieldInfo.Const {
|
if v != fieldInfo.Const {
|
||||||
|
|
|
@ -125,6 +125,8 @@ func (c *config) skipPrompt(p jsonschema.Property, r *renderer) (bool, error) {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// All fields referred to in a SkipPromptIf condition are implicitly made required and
|
||||||
|
// we diverge from strictly following the JSON schema because it makes the author UX better.
|
||||||
var keys []string
|
var keys []string
|
||||||
for k := range p.Schema.SkipPromptIf.Properties {
|
for k := range p.Schema.SkipPromptIf.Properties {
|
||||||
keys = append(keys, k)
|
keys = append(keys, k)
|
||||||
|
|
Loading…
Reference in New Issue