diff options
author | rinpatch <rinpatch@sdf.org> | 2020-09-19 00:50:38 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2020-09-19 16:26:15 +0300 |
commit | 4b12e071ac7ea87c91f6192cc0da90c32e846ca4 (patch) | |
tree | 3fc3baff7046d77b7c5b1deef7ca6766ffd97813 | |
parent | 51116b539201eb99fa89cabc88a08f92c67bfeca (diff) | |
download | pleroma-4b12e071ac7ea87c91f6192cc0da90c32e846ca4.tar.gz pleroma-4b12e071ac7ea87c91f6192cc0da90c32e846ca4.zip |
OpenAPI: make it possible to generate a spec without starting the app
Needed for api docs generation on pleroma.social that will come later
-rw-r--r-- | lib/pleroma/web/api_spec.ex | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/pleroma/web/api_spec.ex b/lib/pleroma/web/api_spec.ex index 79fd5f871..93a5273e3 100644 --- a/lib/pleroma/web/api_spec.ex +++ b/lib/pleroma/web/api_spec.ex @@ -13,10 +13,15 @@ defmodule Pleroma.Web.ApiSpec do @impl OpenApi def spec do %OpenApi{ - servers: [ - # Populate the Server info from a phoenix endpoint - OpenApiSpex.Server.from_endpoint(Endpoint) - ], + servers: + if Phoenix.Endpoint.server?(:pleroma, Endpoint) do + [ + # Populate the Server info from a phoenix endpoint + OpenApiSpex.Server.from_endpoint(Endpoint) + ] + else + [] + end, info: %OpenApiSpex.Info{ title: "Pleroma", description: Application.spec(:pleroma, :description) |> to_string(), |