OpenApiCodeGen.Ast (openapi_codegen v0.1.0)
Contains functions to help with Ast operations.
Summary
Functions
Generates an interpolated string given a URL path.
Converts a string or atom into a variable. It also checks for reserved words and appends _param
to the variable name if it is a reserved word.
Converts the AST into a string, formats it, styles it and writes it to a file and returns the path to the file.
Converts a string or atom into a variable.
Functions
Link to this function
generate_path_interpolation(client_module_name, path)
Generates an interpolated string given a URL path.
Link to this function
sanitize_name(name, transform \\ :underscore)
Converts a string or atom into a variable. It also checks for reserved words and appends _param
to the variable name if it is a reserved word.
Link to this function
to_file!(ast, key, path)
Converts the AST into a string, formats it, styles it and writes it to a file and returns the path to the file.
Link to this function
to_var(name, context)
Converts a string or atom into a variable.
Examples
iex> to_var(:my_var, __MODULE__)
{:my_var, [], __MODULE__}
iex> to_var("my_var", __MODULE__)
{:my_var, [], __MODULE__}
iex> to_var("myVar", __MODULE__)
{:my_var, [], __MODULE__}