From 0840b09de785ba92b941634e15e310d279340261 Mon Sep 17 00:00:00 2001
From: Johan de Klerk <jdeklerk00@gmail.com>
Date: Wed, 11 May 2022 15:54:58 +0200
Subject: [PATCH] Docs

- Ignore tabs
- Ignore fields marked with "-"
---
 api_documentation/api_documentation.go | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/api_documentation/api_documentation.go b/api_documentation/api_documentation.go
index ad413d4..74b7882 100644
--- a/api_documentation/api_documentation.go
+++ b/api_documentation/api_documentation.go
@@ -318,7 +318,10 @@ func StructSchema(docs *Docs, t reflect.Type) (interface{}, error) {
 
 				var err error
 				fieldDesc := f.Tag.Get("doc")
-				if fieldDesc == "" {
+				if fieldDesc == "-" {
+					continue
+				}
+				if fieldDesc == ""  {
 					fieldDesc = description + "." + fieldName
 				}
 				properties[fieldName], err = StructSchema(docs, f.Type)
@@ -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
 			}
 
-- 
GitLab