github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/cmd/swagger/commands/generate/markdown.go (about) 1 package generate 2 3 import ( 4 "github.com/jessevdk/go-flags" 5 "github.com/thetreep/go-swagger/generator" 6 ) 7 8 // Markdown generates a markdown representation of the spec 9 type Markdown struct { 10 WithShared 11 WithModels 12 WithOperations 13 14 Output flags.Filename `long:"output" short:"" description:"the file to write the generated markdown." default:"markdown.md"` 15 } 16 17 func (m Markdown) apply(opts *generator.GenOpts) { 18 m.Shared.apply(opts) 19 m.Models.apply(opts) 20 m.Operations.apply(opts) 21 } 22 23 func (m *Markdown) generate(opts *generator.GenOpts) error { 24 return generator.GenerateMarkdown(string(m.Output), m.Models.Models, m.Operations.Operations, opts) 25 } 26 27 func (m Markdown) log(rp string) { 28 } 29 30 // Execute runs this command 31 func (m *Markdown) Execute(args []string) error { 32 return createSwagger(m) 33 }