Conversation
| dotColonE <- [|(.:)|] | ||
| dotColonQE <- [|(.:?)|] | ||
| objectE <- [|object|] | ||
| withObjectE <- [|withObject|] |
There was a problem hiding this comment.
Bug was here. withObject was not imported, so I think this turned into an UnboundVarE instead of a VarE that we want. Wow. Using the VarE 'withObject form forces the name to be in scope, which then becomes a NameG value.
@danbroooks TIL 😅
|
|
||
| import Control.Applicative (Const(..)) | ||
| import Data.Aeson hiding (Key) | ||
| import Data.Aeson (decode, encode) |
There was a problem hiding this comment.
Surfaced problem in tests by doing this
There was a problem hiding this comment.
Thanks for resolving this! Do you think it is worth adding a specific spec to cover imports required by users of persistent? Something like a test that only imports persistent, and defines some entities (some with derivied json instances) or do you think that might be overkill, something like:
module Database.Persist.TH.JsonEncodingSpec where
-- this test asserts this is the only import required
import Database.Persist.TH
mkPersist sqlSettings [persistLowerCase|
JsonEncoding json
name Text
age Int
Primary name
deriving Show Eq
JsonEncoding2 json
name Text
age Int
blood Text
Primary name blood
deriving Show Eq
JsonEncMigrationOnly json
name Text
age Int
foo Text MigrationOnly
|]My original PR added to JsonEncodingSpec but that was already importing Data.Aeson 😅 what you have done here seems to be a more robust solution, but I wonder if we should also add a test similar to the above? Happy to do the PR for this if so 😄
There was a problem hiding this comment.
Yeah, that's a good idea.
Before submitting your PR, check that you've:
@sincedeclarations to the Haddockstylish-haskellon any changed files..editorconfigfile for details)After submitting your PR:
(unreleased)on the Changelog