aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/docs/json.ex
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2019-09-15 18:52:27 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2019-09-15 18:52:27 +0300
commitefbc2edba17a7ee2d3e15bca5fa4f6cf8b4b5116 (patch)
tree086f3bb1ae6ca2fbb9909e69297a7dabea9061fb /lib/pleroma/docs/json.ex
parente6f43a831bdd2a381ed4de493344886f312f9a38 (diff)
parent9c64a25713790fefa8b5c419aeadf55113c17073 (diff)
downloadpleroma-efbc2edba17a7ee2d3e15bca5fa4f6cf8b4b5116.tar.gz
[#1234] Merge remote-tracking branch 'remotes/upstream/develop' into 1234-mastodon-2-4-3-oauth-scopes
# Conflicts: # lib/pleroma/web/activity_pub/activity_pub_controller.ex # lib/pleroma/web/router.ex
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