https://kotlinlang.org logo
Title
n

Nezteb

04/22/2019, 6:06 PM
d

dave

04/22/2019, 6:26 PM
Not at the moment, no.
n

Nezteb

04/22/2019, 7:10 PM
Is it possible to manually injection fields in the OpenAPI document?
d

dave

04/22/2019, 7:22 PM
Once again - not at the moment. What specifically were you thinking of?
n

Nezteb

04/22/2019, 7:50 PM
That’s fine; I was just trying to think of a way to extend existing Swagger spec files that are generated, but worst case scenario I could do that manually. I’m pushing for using HTTP4K at work but people want to make sure it can do various things. The swagger spec generation is one of those things. Because none of us want to use Spring just to get a free Swagger spec.
d

dave

04/22/2019, 7:55 PM
it's s bit difficult to know exactly how we would neatly plug in the extension - capabilities. it's certainly possible to do it, but by their very definition there is no defined schema to extension, so the best we could could do would be to provide a hook points to plug in native JSON nodes or auto-json'd parts to the response. Undoubtably because we're generating the JSON from the code, we won't be able to replicate the entirety of the OpenApi spec.
Also, it's worth pointing out that unlike other swagger supporting libs, we generate the Swagger at runtime rather than as an exportable spec file. but this isn't a major problem to overcome as you can write a simple test to generate the doc as an output of the build and then transform/serve it statically.
n

Nezteb

04/22/2019, 7:57 PM
Yeah extensions are weird. Ideally I’d like to just be able to retrieve the entire JSON object and manipulate it if needed. And yeah, I’m not worried about the runtime thing.
d

dave

04/22/2019, 7:59 PM
you could also definitely wire in something at runtime to transform it if you need to. it might look a little weird in the code though