michalmuskala/jason

Better error message on invalid `@derive Jason.Encoder` options

开放

#183 创建于 2024年2月10日

 (1 条评论) (0 个反应) (0 位负责人)Elixir (178 个派生)batch import
enhancementhelp wanted

仓库指标

星标
 (1,680 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Current behavior

When passing an invalid option, eg:

@derive {Jason.Encoder, invalid: [:__meta__]}

It returns the following error: cannot encode metadata from the :__meta__ field for CrosswordsApi.Users.User to JSON.

Expected behavior

Could the error be explicit that expect or only should be passed as valid options only?

贡献者指南