Skip to content
Snippets Groups Projects
Commit 0840b09d authored by Johan de Klerk's avatar Johan de Klerk
Browse files

Docs

- Ignore tabs
- Ignore fields marked with "-"
parent 92697b90
No related branches found
No related tags found
No related merge requests found
......@@ -318,6 +318,9 @@ func StructSchema(docs *Docs, t reflect.Type) (interface{}, error) {
var err error
fieldDesc := f.Tag.Get("doc")
if fieldDesc == "-" {
continue
}
if fieldDesc == "" {
fieldDesc = description + "." + fieldName
}
......@@ -336,7 +339,7 @@ func StructSchema(docs *Docs, t reflect.Type) (interface{}, error) {
element := t.Elem()
if element.Kind() == reflect.Struct || element.Kind() == reflect.Ptr {
elementName := getType(t)
elementName := t.Elem().Name()
if elementName == "" || elementName == "error" {
return schema, nil
}
......@@ -396,11 +399,13 @@ func GetStructDocs(corePath string) map[string]string {
for _, objectTypes := range p.Types {
doc := strings.ReplaceAll(objectTypes.Doc, objectTypes.Name, "")
doc = strings.ReplaceAll(doc, "\t", "")
docs[objectTypes.Name] = doc
}
for _, function := range p.Funcs {
doc := strings.ReplaceAll(function.Doc, function.Name, "")
doc = strings.ReplaceAll(doc, "\t", "")
docs[function.Name] = doc
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment