mirror of https://github.com/databricks/cli.git
fix: Description of root types with additional properties
This commit is contained in:
parent
fe6ba76b7d
commit
c355fbfcb2
|
@ -61,6 +61,12 @@ func getNodes(s jsonschema.Schema, refs map[string]jsonschema.Schema, customFiel
|
||||||
additionalProps, ok := v.AdditionalProperties.(*jsonschema.Schema)
|
additionalProps, ok := v.AdditionalProperties.(*jsonschema.Schema)
|
||||||
if ok {
|
if ok {
|
||||||
objectKeyType := resolveRefs(additionalProps, refs)
|
objectKeyType := resolveRefs(additionalProps, refs)
|
||||||
|
if node.Description == "" {
|
||||||
|
node.Description = getDescription(objectKeyType, true)
|
||||||
|
}
|
||||||
|
if len(node.Example) == 0 {
|
||||||
|
node.Example = getExample(objectKeyType)
|
||||||
|
}
|
||||||
node.ObjectKeyAttributes = getAttributes(objectKeyType.Properties, refs)
|
node.ObjectKeyAttributes = getAttributes(objectKeyType.Properties, refs)
|
||||||
rootProps = append(rootProps, extractNodes(k, objectKeyType.Properties, refs, customFields)...)
|
rootProps = append(rootProps, extractNodes(k, objectKeyType.Properties, refs, customFields)...)
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,11 +88,11 @@ func generateDocs(inputPaths []string, outputPath string, rootType reflect.Type,
|
||||||
if isCustomField {
|
if isCustomField {
|
||||||
customFields[jsonschema.TypePath(typ)] = true
|
customFields[jsonschema.TypePath(typ)] = true
|
||||||
}
|
}
|
||||||
schemas[jsonschema.TypePath(typ)] = s
|
|
||||||
|
|
||||||
refPath := getPath(typ)
|
refPath := getPath(typ)
|
||||||
shouldHandle := strings.HasPrefix(refPath, "github.com")
|
shouldHandle := strings.HasPrefix(refPath, "github.com")
|
||||||
if !shouldHandle {
|
if !shouldHandle {
|
||||||
|
schemas[jsonschema.TypePath(typ)] = s
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,7 @@ func generateDocs(inputPaths []string, outputPath string, rootType reflect.Type,
|
||||||
assignAnnotation(v, a[k])
|
assignAnnotation(v, a[k])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
schemas[jsonschema.TypePath(typ)] = s
|
||||||
return s
|
return s
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue