Skip to content

Commit 0dfa7a8

Browse files
committed
[#25] Add docstrings
1 parent 38ab3dc commit 0dfa7a8

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

lib/aws_codegen.ex

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
defmodule AWS.CodeGen do
22
alias AWS.CodeGen.Spec
3+
@moduledoc """
4+
AWS API Services generator.
35
6+
Generates the AWS client modules for the `aws-beam/aws-erlang` and
7+
`aws-beam/aws-elixir` projects.
8+
9+
Maintains a global `@configuration` that specifies what protocols
10+
are implemented for which target language (`:erlang` or `:elixir`).
11+
12+
The services that will be generated is discovered by finding all
13+
available specs in the provided `spec_base_path` and then checking
14+
if there is an available implementation for that protocol.
15+
"""
16+
17+
# Configuration map which determines what AWS API protocols have an
18+
# implementation for what language.
419
@configuration %{
520
:json => %{
621
:module => AWS.CodeGen.PostService,
@@ -32,6 +47,9 @@ defmodule AWS.CodeGen do
3247
}
3348
}
3449

50+
@doc """
51+
Entrypoint for the code generation.
52+
"""
3553
def generate(language, spec_base_path, template_base_path, output_base_path) do
3654
endpoints_spec = get_endpoints_spec(spec_base_path)
3755
tasks = Enum.map(api_specs(spec_base_path, language),
@@ -43,6 +61,11 @@ defmodule AWS.CodeGen do
4361
Enum.each(tasks, fn(task) -> Task.await(task) end)
4462
end
4563

64+
@doc """
65+
Generate code for a specific API using `spec`.
66+
67+
Called throuhg Task.async/3.
68+
"""
4669
def generate_code(spec, language, endpoints_spec, template_base_path, output_path) do
4770
template = @configuration[spec.protocol][:template][language]
4871
if not is_nil(template) do

lib/aws_codegen/spec.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
defmodule AWS.CodeGen.Spec do
2+
@moduledoc """
3+
Parse and process the specfication for an AWS service.
4+
"""
25
defstruct protocol: nil,
36
module_name: nil,
47
filename: nil,

0 commit comments

Comments
 (0)