Validates the payload of each broadcast against the manifest at runtime.
The check runs on each broadcast, in each environment. It costs one pass over the
declared fields and one comparison of key sets. That cost is small next to the send to
Phoenix.PubSub that it guards.
Summary
Functions
Whether value satisfies field.
Checks payload against the fields that the manifest declares for {topic, event}.
Functions
@spec valid_field?(VerifiedPubSub.Dsl.Field.t(), term()) :: boolean()
Whether value satisfies field.
An optional field accepts nil, because Elixir and Ecto use nil for an absent value. A
payload that comes from a struct holds every key, so a rule to leave out the key would be
hard to meet. A required field rejects nil.
Checks payload against the fields that the manifest declares for {topic, event}.
Raises VerifiedPubSub.PayloadError on any mismatch. Returns the payload unchanged, so
a caller can use the call inline.