spectra_abstract_code (spectra v0.13.0)

View Source

Summary

Functions

apply_field_aliases/2

-spec apply_field_aliases(spectra:sp_type(), #{atom() | integer() => binary()}) -> spectra:sp_type().

apply_only/2

-spec apply_only(spectra:sp_type(), [atom()]) -> spectra:sp_type().

Filters the fields of a map type to only those named in Only.

Propagates through #sp_union{} members so that types like MyStruct | nil work correctly. #sp_user_type_ref{} and #sp_remote_type{} nodes are passed through unchanged — they resolve at encode/decode time and cannot be filtered here without cross-module type resolution.

Note: When only is used, the produced or accepted maps may not fully conform to the declared Erlang type. This is intentional.

types_in_forms(Module, Forms)

-spec types_in_forms(module(), [erl_parse:abstract_form() | erl_parse:form_info()]) ->
                        spectra:type_info().

types_in_module(Module)

-spec types_in_module(atom()) -> spectra:type_info().

types_in_module_path(FilePath)

-spec types_in_module_path(file:filename()) -> spectra:type_info().