aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/docs/json.ex
diff options
context:
space:
mode:
authorkPherox <admin@mail.kr-kp.com>2019-10-01 01:39:22 +0900
committerkPherox <admin@mail.kr-kp.com>2019-10-01 01:40:33 +0900
commita0f101ee806af06bcd4271cd8d57d11ff85ea11a (patch)
tree2cd3c5d1a645be1395c57ec5616f31afb4b68da7 /lib/pleroma/docs/json.ex
parent8ca4f145a51e92c9f3a6c374ceddfac22ea300d9 (diff)
parent7c9b023a918c84b60ae6547289a083c671a3659b (diff)
downloadpleroma-a0f101ee806af06bcd4271cd8d57d11ff85ea11a.tar.gz
Merge remote-tracking branch 'upstream/develop' into fix-prameter-name-of-accounts-update-credentials
Diffstat (limited to 'lib/pleroma/docs/json.ex')
-rw-r--r--lib/pleroma/docs/json.ex20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/pleroma/docs/json.ex b/lib/pleroma/docs/json.ex
new file mode 100644
index 000000000..18ba01d58
--- /dev/null
+++ b/lib/pleroma/docs/json.ex
@@ -0,0 +1,20 @@
+defmodule Pleroma.Docs.JSON do
+ @behaviour Pleroma.Docs.Generator
+
+ @spec process(keyword()) :: {:ok, String.t()}
+ def process(descriptions) do
+ config_path = "docs/generate_config.json"
+
+ with {:ok, file} <- File.open(config_path, [:write]),
+ json <- generate_json(descriptions),
+ :ok <- IO.write(file, json),
+ :ok <- File.close(file) do
+ {:ok, config_path}
+ end
+ end
+
+ @spec generate_json([keyword()]) :: String.t()
+ def generate_json(descriptions) do
+ Jason.encode!(descriptions)
+ end
+end