From f13f5d9303d45093953a7c609a7b1f282a31e8da Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 9 Feb 2021 22:10:09 +0300 Subject: [PATCH 1/2] OpenAPI spec task: Load pleroma application to get version info For whatever reason it seems to pick up the version without loading the app on my machine, but not on the CI. --- lib/mix/tasks/pleroma/openapi_spec.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/mix/tasks/pleroma/openapi_spec.ex b/lib/mix/tasks/pleroma/openapi_spec.ex index 524bf5144..8f719c58b 100644 --- a/lib/mix/tasks/pleroma/openapi_spec.ex +++ b/lib/mix/tasks/pleroma/openapi_spec.ex @@ -1,5 +1,7 @@ defmodule Mix.Tasks.Pleroma.OpenapiSpec do def run([path]) do + # Load Pleroma application to get version info + Application.load(:pleroma) spec = Pleroma.Web.ApiSpec.spec(server_specific: false) |> Jason.encode!() File.write(path, spec) end From 0d9230aed9f492599ecb505375474578714a2ee8 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 9 Feb 2021 22:23:11 +0300 Subject: [PATCH 2/2] OpenAPI spec: Do not show build enviroment in the spec version --- lib/pleroma/web/api_spec.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/api_spec.ex b/lib/pleroma/web/api_spec.ex index 81b7bc9e8..b16068f7b 100644 --- a/lib/pleroma/web/api_spec.ex +++ b/lib/pleroma/web/api_spec.ex @@ -37,7 +37,8 @@ def spec(opts \\ []) do Please report such occurences on our [issue tracker](https://git.pleroma.social/pleroma/pleroma/-/issues). Feel free to submit API questions or proposals there too! """, - version: Application.spec(:pleroma, :vsn) |> to_string(), + # Strip environment from the version + version: Application.spec(:pleroma, :vsn) |> to_string() |> String.replace(~r/\+.*$/, ""), extensions: %{ # Logo path should be picked so that the path exists both on Pleroma instances and on api.pleroma.social "x-logo": %{"url" => "/static/logo.svg", "altText" => "Pleroma logo"}