package builder import ( "encoding/json" ) type Info struct { Title string `json:"title"` Version string `json:"version"` } type Paths map[string]interface{} type Document struct { Version string `json:"openapi"` Info *Info `json:"info"` Paths Paths `json:"paths"` } func (document *Document) ToJSON() string { bytes, _ := json.MarshalIndent(document, "", " ") return string(bytes) }