OuterfacesEctoApi.Mix.JsCodegenHelpers (Outerfaces Ecto API v0.2.8)

View Source

Generates JSDoc types for api resources

Example usage module:

defmodule Mix.Tasks.JSCodegenMyExampleProject do
  use Mix.Task

  @shortdoc "Generates js typedefs for the api resources for My Outerfaces Example Project"

  @project_name "my_example_project"

  def run(_args) do
    project_js_codegen_config() |> OuterfacesEctoApi.Mix.JsCodegenHelpers.run_js_codegen(@project_name)
  end

  def project_js_codegen_config do
    [
      %{
        schema: "MyApp.MyContext.MySchema"
      },
      %{
        schema: "MyApp.MyContext.MySchema",
        controller_name: "MyAppWeb.MyContext.MySchemaController"
      },
    ]
  end

Summary

Functions

base_js_typedefs()

@spec base_js_typedefs() :: String.t()

run_for_schema(map, project_name)

run_js_codegen(schema_configurations, project_name)

@spec run_js_codegen(schema_configurations :: [map()], project_name :: String.t()) ::
  :ok