Replies: 1 comment
-
I'd create a custom mix task, giving you control over how much of the app is running at the time the spec is generated. defmodule Mix.Tasks.MyApp.OpenApiSpec do
def run([output_file]) do
json =
MyApp.ApiSpec.spec()
|> Jason.encode!(pretty: true)
:ok = File.write!(output_file, json)
end
end Although I'm not sure if there's some amount of initialisation that would be required to allow you to discover the phoenix routes? The phx.routes doesn't seem to require anything special. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a project that connects to a message broker on startup. When I tried to generate API specs using
mix openapi.spec.json --spec MyProj.ApiSpec
, I got the following error, because my application could not connect to the broker from the build server.Do you know how should I generate API spec without trying to connect to the broker?
Beta Was this translation helpful? Give feedback.
All reactions