Closed futugyou closed 9 months ago
You can do it with a function like this.
func DumpOpenAPISpec(fn string, s *web.Service) error {
j, err := json.Marshal(s.OpenAPISchema())
if err != nil {
return err
}
return os.WriteFile(fn, j, 0600)
}
You can do it with a function like this.
func DumpOpenAPISpec(fn string, s *web.Service) error { j, err := json.Marshal(s.OpenAPISchema()) if err != nil { return err } return os.WriteFile(fn, j, 0600) }
thank you for your help
How to generate openapi.json file without using http.ListenAndServe to start the service. I just want to use 'go run .' to generate an openapi.json file, not start a http service.