cowboy_swagger icon indicating copy to clipboard operation
cowboy_swagger copied to clipboard

generate swagger.json on build

Open DmytroKostin0 opened this issue 6 months ago • 4 comments

is there any way to generate swagger.json on build time?

DmytroKostin0 avatar Dec 15 '23 13:12 DmytroKostin0

Not at this moment, I don't think. It shouldn't be complex to implement, as a hook on cowboy_swagger:to_json/1, but I'm not sure we'll want that. @elbrujohalcon?

paulo-ferraz-oliveira avatar Dec 16 '23 20:12 paulo-ferraz-oliveira

Yeah… I would say it should not be the default app behaviour. But, if it's clearly optional, we can accept a PR with such changes.

elbrujohalcon avatar Dec 19 '23 06:12 elbrujohalcon

👍 then I propose a behaviour with a single function cowboy_swagger_json_exporter:export/1 where the input is the generated swagger.json. Then with an application config. key like e.g. json_exporter_mod, you can add a module name that'll be called when the JSON is done.

paulo-ferraz-oliveira avatar Dec 20 '23 19:12 paulo-ferraz-oliveira

Sounds good to me

elbrujohalcon avatar Dec 20 '23 21:12 elbrujohalcon