You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> import Data.Aeson
> data F = F { a :: Maybe Int, b :: Maybe Int } deriving (Show, GHC.Generics.Generic)
> instance FromJSON F where parseJSON = genericParseJSON defaultOptions
> -- omitNothingFields = False by default
> decode "{}" :: Maybe F
Just (F {a = Nothing, b = Nothing})
Coming back to this, I think it's a good thing that parsing is more lenient. I'd be open to add this as a part of Options so you can opt-in if you want it.
Activity
bergmark commentedon Jul 26, 2017
Yes that sounds like a bug. Are you able to provide a reproduction?
Lysxia commentedon Jul 30, 2017
I guess we want that to fail?
bergmark commentedon Aug 2, 2017
Whoops big typo in my deleted comment! I'm not sure if we should consider this a bug as
Does it hurt that parsing is more lenient?
bergmark commentedon Jun 14, 2020
Coming back to this, I think it's a good thing that parsing is more lenient. I'd be open to add this as a part of Options so you can opt-in if you want it.
phadej commentedon Jun 12, 2023
With #1039 this will fail.
I will first add a test to
masterto see how things work now, and then decide what to do in #1039.Add a regression test for issue #571
Merge pull request #1041 from haskell/issue-571
phadej commentedon Jun 14, 2023
#1039 will add
allowOmittedFieldsoption (Trueby default) to control whether omitted fields are ok when parsing.Complete omitField and omittedField things
Complete omitField and omittedField things
Complete omitField and omittedField things
Complete omitField and omittedField things
Add a regression test for issue haskell#571
Complete omitField and omittedField things