Current section

Files

Jump to
oaspec src oaspec@internal@codegen@context.erl
Raw

src/oaspec@internal@codegen@context.erl

-module(oaspec@internal@codegen@context).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/oaspec/internal/codegen/context.gleam").
-export([spec/1, config/1, operations/1, new/2]).
-export_type([context/0, file_target/0, write_mode/0, generated_file/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(false).
-opaque context() :: {context,
oaspec@internal@openapi@spec:open_api_spec(oaspec@internal@openapi@spec:resolved()),
oaspec@config:config(),
list({binary(),
oaspec@internal@openapi@spec:operation(oaspec@internal@openapi@spec:resolved()),
binary(),
oaspec@internal@openapi@spec:http_method()})}.
-type file_target() :: shared_target | server_target | client_target.
-type write_mode() :: overwrite | skip_if_exists.
-type generated_file() :: {generated_file,
binary(),
binary(),
file_target(),
write_mode()}.
-file("src/oaspec/internal/codegen/context.gleam", 41).
?DOC(false).
-spec spec(context()) -> oaspec@internal@openapi@spec:open_api_spec(oaspec@internal@openapi@spec:resolved()).
spec(Ctx) ->
erlang:element(2, Ctx).
-file("src/oaspec/internal/codegen/context.gleam", 46).
?DOC(false).
-spec config(context()) -> oaspec@config:config().
config(Ctx) ->
erlang:element(3, Ctx).
-file("src/oaspec/internal/codegen/context.gleam", 53).
?DOC(false).
-spec operations(context()) -> list({binary(),
oaspec@internal@openapi@spec:operation(oaspec@internal@openapi@spec:resolved()),
binary(),
oaspec@internal@openapi@spec:http_method()}).
operations(Ctx) ->
erlang:element(4, Ctx).
-file("src/oaspec/internal/codegen/context.gleam", 36).
?DOC(false).
-spec new(
oaspec@internal@openapi@spec:open_api_spec(oaspec@internal@openapi@spec:resolved()),
oaspec@config:config()
) -> context().
new(Spec, Config) ->
{context,
Spec,
Config,
oaspec@internal@openapi@operations:collect_operations(Spec)}.