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

  def generate_json(descriptions) do
    Jason.encode!(descriptions)
  end
end