38f01501761423ec8373cad2d36943444d120da3
[akkoma] / lib / pleroma / docs / json.ex
1 defmodule Pleroma.Docs.JSON do
2 @behaviour Pleroma.Docs.Formatter
3 def process(descriptions) do
4 config_path = "docs/generate_config.json"
5 {:ok, file} = File.open(config_path, [:write])
6 json = generate_json(descriptions)
7 IO.write(file, json)
8 :ok = File.close(file)
9 {:ok, config_path}
10 end
11
12 def generate_json(descriptions) do
13 Jason.encode!(descriptions)
14 end
15 end