Skip to content

Conversation

@joelostblom
Copy link
Contributor

@joelostblom joelostblom commented Nov 21, 2025

Creates a more human readable format to explain error messages

Closes #11, closes #58, closes #14

Needs an in-depth review.

Checklist

  • Ran just run-all

@joelostblom joelostblom moved this from Todo to In Progress in Iteration planning Nov 21, 2025
@joelostblom
Copy link
Contributor Author

joelostblom commented Nov 21, 2025

@seedcase-project/developers Just a draft for now and lots of things to fix, but early input welcome from anyone if this approach is already going down the down route.

The output currently looks like this:

image

Copy link
Member

@lwjohnst86 lwjohnst86 left a comment

Choose a reason for hiding this comment

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

Super cool 🎉 Some small comments so far 🖊️

lwjohnst86 and others added 2 commits November 21, 2025 17:51
Moves all logic out of init()
and instead into two separate functions:
one for iterating over the errors
and adding a general message,
and one for formatting the message
for each issue.
@lwjohnst86
Copy link
Member

@joelostblom build fails though!

Copy link
Member

@lwjohnst86 lwjohnst86 left a comment

Choose a reason for hiding this comment

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

Nice! Very minor comment about naming ☺️

For certain error types,
a dict or list is set as the instance,
which means logic elsewhere
that calls `set()` on `Issue` fails.
Since we perform deduplication of Issues later,
we need to either only allow hashable items
or write custome comparison logic
to compare unhashable ones.
Technically,
writing custom comparison logic
that ignores unhashable values
might be the most theoretically appropriate
(since it is redundant to compare `instance`
when also comparing `jsonpath`),
but it could look convoluted
and have worse performance.
This is a simpler solution
that is easy to understand
and that does not involve any significant performance penalty
as the extra comparison is of small items.
Trying this out
as a first approach
and changing if we notice that there are occasions
where we would value having access to an unhashable instance.
For more discussion, see:
#208 (comment)
Copy link
Member

@lwjohnst86 lwjohnst86 left a comment

Choose a reason for hiding this comment

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

Look super nice! Just some small comments about docstrings.

@lwjohnst86 lwjohnst86 changed the title feat: ✨ explain errors feat: ✨ explain() errors Nov 25, 2025
joelostblom added a commit that referenced this pull request Nov 26, 2025
But always include it in the Issue object
instead of sometimes excluding it
based on whether it is hashable or not.
See further discussion in
#208 (comment)
But always include it in the Issue object
instead of sometimes excluding it
based on whether it is hashable or not.
See further discussion in
#208 (comment)
@joelostblom
Copy link
Contributor Author

@lwjohnst86 @martonvago I think I have addressed everything we discussed so far and tests are passing so I'm marking this as ready for a review!

A few things I intentionally left out:

  1. Decision around how to treat instance objects during display. Details in my latest comment here: feat: ✨ explain() errors #208 (comment).
  2. Final markup / color syntax for explain -> Separate PR
  3. Line numbers. It didn't seem easy to include these as I didn't see them as part of the errors from jsonschema
  4. Numbering of multiple issues. This can also be in a follow up PR when the format for each error is closer to being finalized.

@joelostblom joelostblom marked this pull request as ready for review November 26, 2025 10:53
@joelostblom joelostblom requested a review from a team as a code owner November 26, 2025 10:53
Copy link
Contributor

@martonvago martonvago left a comment

Choose a reason for hiding this comment

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

Really nice ⭐!!

I added some comments, feel free to ignore what you don't care about ☺️

Copy link
Contributor Author

@joelostblom joelostblom left a comment

Choose a reason for hiding this comment

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

Thanks @martonvago ! I went through and tried to address your comments.

Copy link
Member

@lwjohnst86 lwjohnst86 left a comment

Choose a reason for hiding this comment

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

Very nice 🎉

@lwjohnst86 lwjohnst86 merged commit f871e77 into main Nov 27, 2025
6 checks passed
@lwjohnst86 lwjohnst86 deleted the feat/explain-errors branch November 27, 2025 09:20
@github-project-automation github-project-automation bot moved this from In Progress to Done in Iteration planning Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Create explain() function Improve CheckError error messages Brainstorming for design of messages

4 participants