From: rinpatch Date: Fri, 18 Sep 2020 21:50:38 +0000 (+0300) Subject: OpenAPI: make it possible to generate a spec without starting the app X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=4b12e071ac7ea87c91f6192cc0da90c32e846ca4;p=akkoma OpenAPI: make it possible to generate a spec without starting the app Needed for api docs generation on pleroma.social that will come later --- 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(),