Is there a way to take an existing openapi spec an...
# http4k
a
Is there a way to take an existing openapi spec and use that to implement a server in http4k? I see that the OpenApi module encourages generating the spec from the code, but is there a way to do it the other way around?
m
https://toolbox.http4k.org/openapi is this what you're after?
d
@Arnab note that the toolbox is quite picky on the interpretation of the spec (it requires that is is valid), so the result you get may either be incomplete or not work at all. This mostly depends on if the spec is valid (a lot of them aren't) or was hand rolled or contains features that aren't representable in simple generation.
Alternatively, an AI assistant may do apretty good job. 🙃
a
Eh yeah maybe AI 🤔 The question isn't so much about generating the code though. I was mostly wondering if this workflow of having a spec, and then writing code that is compliant, is supported. I guess the answer is "yes, but it is quite strict"?