Skip to content

Improve parse errors in generated FromJSON instances#1356

Merged
parsonsmatt merged 3 commits intoyesodweb:masterfrom
danbroooks:improve-json-errors
Mar 12, 2022
Merged

Improve parse errors in generated FromJSON instances#1356
parsonsmatt merged 3 commits intoyesodweb:masterfrom
danbroooks:improve-json-errors

Conversation

@danbroooks
Copy link
Contributor

@danbroooks danbroooks commented Jan 29, 2022

Fixes #1350


Before submitting your PR, check that you've:

  • Documented new APIs with Haddock markup
  • Added @since declarations to the Haddock
  • Ran stylish-haskell on any changed files.
  • Adhered to the code style (see the .editorconfig file for details)

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Bumped the version number if there isn't an (unreleased) on the Changelog
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

@danbroooks danbroooks changed the title Improve parse errors in FromJSON instance Improve parse errors in generated FromJSON instances Jan 30, 2022
Copy link
Collaborator

@parsonsmatt parsonsmatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great, thanks!

@parsonsmatt parsonsmatt merged commit eb19057 into yesodweb:master Mar 12, 2022
@jfraudeau
Copy link

Hello, I believe this PR introduced a breaking change:
When defining entities with FromJSON instances we now need to import Data.Aeson (withObject) while previously no Data.Aeson imports where needed.

withObject should probably be imported in persistent/Database/Persist/TH.hs

@parsonsmatt
Copy link
Collaborator

Great catch @jfraudeau ! opened #1369 to fix it

@danbroooks danbroooks deleted the improve-json-errors branch March 16, 2022 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Could the errors from derived FromJSON instances be improved?

3 participants