PhoenixSpec. ViewExtractor
(PhoenixSpec v0.1.1)
View Source
Extracts response shapes from Phoenix JSON view modules by analyzing their AST.
Detects:
- Map literals returned by
data/1and action functions - Ecto schema pattern matches to resolve field types
- Calls to other
*JSON.data/1for nested schemas - Wrapping patterns like
%{data: ...} - Optional fields via
@optionalattribute or inline conditionals
Summary
Functions
Extracts view information from a JSON view module's source file.
Derives an OpenAPI schema name from a JSON view module name.
Functions
Extracts view information from a JSON view module's source file.
Derives an OpenAPI schema name from a JSON view module name.
Examples
iex> PhoenixSpec.ViewExtractor.view_module_to_schema_name(TestAppWeb.PostJSON)
"Post"
iex> PhoenixSpec.ViewExtractor.view_module_to_schema_name(TestAppWeb.UserJSON)
"User"