spectra_abstract_code (spectra v0.11.1)

View Source

Summary

Functions

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

Functions

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_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().