Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToJSON instance for TxValidationError #379

Merged
merged 4 commits into from Nov 20, 2023

Conversation

newhoggy
Copy link
Collaborator

Changelog

- description: |
    `ToJSON` instance for `TxValidationError`
# uncomment types applicable to the change:
  type:
  - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
  - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - improvement    # QoL changes e.g. refactoring
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

This is needed for reporting errors in machine readable JSON.

Note that the error tree is not completely converted to JSON structure. Some sub-branches remain as strings because the ledger does not export enough symbols to go all the way down to the leaves.

In any case, these instances are a stop-gap until the instances are implemented in the ledger proper.

How to trust this PR

Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • New tests are added if needed and existing tests are updated. See Running tests for more details
  • Self-reviewed the diff

cardano-api/internal/Cardano/Api/InMode.hs Outdated Show resolved Hide resolved
import qualified Data.Text as Text
import Prettyprinter

newtype ShowOf a = ShowOf a
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a little motivation comment would be helpful in the long term. I believe here the main point of ShowOf is that you want to capture when Show can be lifted to ToJSON, right? I think stating this motivation would help maintenance in the long term (and onboarding of newcomers to the codebase (speaking for a friend)).

Copy link
Contributor

@smelc smelc left a comment

Choose a reason for hiding this comment

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

LGTM

@newhoggy newhoggy added this pull request to the merge queue Nov 20, 2023
Merged via the queue into main with commit bbd4fd1 Nov 20, 2023
20 checks passed
@newhoggy newhoggy deleted the newhoggy/json-instances-for-TxValidationError branch November 20, 2023 18:14
newhoggy pushed a commit that referenced this pull request Mar 11, 2024
…ep-registration-certificate

drep registration-certificate: add a golden test
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.

None yet

4 participants