schema-openapi icon indicating copy to clipboard operation
schema-openapi copied to clipboard

Feature request: render to openapi doc string

Open jessekelly881 opened this issue 1 year ago • 3 comments

It would be really useful to be able to generate a string of the openapi document. :)

jessekelly881 avatar Nov 16 '23 00:11 jessekelly881

Hey, not sure I understand. Do you mean literally to stringify the openapi spec?

sukovanej avatar Nov 17 '23 00:11 sukovanej

That's what I was thinking at the time but I was probably a bit sleep deprived.. jaja I think as json would be better. I can see that the /docs http page has a link to download the json but I'm not seeing a fn in this lib. I'm probably missing it though.. Basically I'm looking for a way to write the generated openapi schema to a file(in yaml but the 'yaml' package could handle json -> yaml)

jessekelly881 avatar Nov 17 '23 00:11 jessekelly881

In the effect-http I simply call ServerResponse.json and the impl of the encoding is in the @effect/platform/internal/http/body - so basically it's JSON.stringify. I think the openapi spec will be generally small enough so that one don't need to bother with streaming it somehow and you can simply stringify the whole thing and write it to a file.

sukovanej avatar Nov 17 '23 09:11 sukovanej