Skip to content

Commit

Permalink
Adds Platform Settings OpenApi spec
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonkopliku committed May 24, 2022
1 parent 2fc8f85 commit 5f3c05d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/trento_web/controllers/settings_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ defmodule TrentoWeb.SettingsController do

use OpenApiSpex.ControllerSpecs

operation :settings, false
operation :settings,
summary: "Platform Settings",
tags: ["Platform"],
description: "Provides the Platform Settings for the current installation.",
responses: [
ok: {"Platform Settings", "application/json", Schema.Platform.Settings}
]

@spec settings(Plug.Conn.t(), any) :: Plug.Conn.t()
def settings(conn, _) do
Expand Down
26 changes: 26 additions & 0 deletions lib/trento_web/openapi/schema/platform.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
defmodule TrentoWeb.OpenApi.Schema.Platform do
@moduledoc false

require OpenApiSpex
alias OpenApiSpex.Schema

defmodule Settings do
@moduledoc false

OpenApiSpex.schema(%{
title: "PlatformSettings",
description: "Settings values for the current installation",
type: :object,
properties: %{
eula_accepted: %Schema{
type: :boolean,
description: "Whether the user has accepted EULA (on a Premium installation)"
},
premium_subscription: %Schema{
type: :boolean,
description: "Whether current installation is a Premium one"
}
}
})
end
end

0 comments on commit 5f3c05d

Please sign in to comment.