blob: aed730e78fbbbf0bdf8e60e69452dcd34baf4bfd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
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"
{:ok, file} = File.open(config_path, [:write])
json = generate_json(descriptions)
IO.write(file, json)
:ok = File.close(file)
{:ok, config_path}
end
@spec generate_json([keyword()]) :: String.t()
def generate_json(descriptions) do
Jason.encode!(descriptions)
end
end
|