OAuthPlug, Router: Handle deactivated users in the UserEnabledPlug
[akkoma] / lib / pleroma / docs / json.ex
1 defmodule Pleroma.Docs.JSON do
2 @behaviour Pleroma.Docs.Generator
3
4 @spec process(keyword()) :: {:ok, String.t()}
5 def process(descriptions) do
6 config_path = "docs/generate_config.json"
7
8 with {:ok, file} <- File.open(config_path, [:write]),
9 json <- generate_json(descriptions),
10 :ok <- IO.write(file, json),
11 :ok <- File.close(file) do
12 {:ok, config_path}
13 end
14 end
15
16 @spec generate_json([keyword()]) :: String.t()
17 def generate_json(descriptions) do
18 Jason.encode!(descriptions)
19 end
20 end