spectra_abstract_code (spectra v0.11.1)
View SourceSummary
Functions
Filters the fields of a map type to only those named in Only.
Functions
-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.
-spec types_in_module(atom()) -> spectra:type_info().
-spec types_in_module_path(file:filename()) -> spectra:type_info().