<https://www.http4k.org/guide/modules/contracts/> ...
# http4k
n
d
Not at the moment, no.
n
Is it possible to manually injection fields in the OpenAPI document?
d
Once again - not at the moment. What specifically were you thinking of?
n
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
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
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
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