Skip to content

fix: say which value failed to parse and why references could not be resolved - #54

Open
bielu wants to merge 1 commit into
ByteBardOrg:vnextfrom
bielu:fix/reader-error-details
Open

bielu wants to merge 1 commit into
ByteBardOrg:vnextfrom
bielu:fix/reader-error-details

Conversation

@bielu

@bielu bielu commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Problem

Several reader errors hid what actually went wrong:

  • Schema integer fields (maxLength, minItems, …) used a catch-all that reported every failure as The value is out of range., including abc and 1.5.
  • The shared scalar helpers said Value could not parse to integer. without the value or the field location.
  • A referenced document that couldn't be read reported Unable to deserialize reference without the cause (bare catch), and any failed reference was reported twice: once with the specific reason, then again generically.
  • JsonPointer.Find swallowed all exceptions, and for a pointer that walks into a scalar (/info/title/nested) it returned the scalar instead of null.

Change

  • Scalar errors now read e.g. Value 'abc' could not parse to integer. Expected a whole number. or Value '99999999999' could not parse to integer. It must be between -2147483648 and 2147483647., with the field's pointer. Schema integer fields use the same helper. The existing "could not parse to …" wording is kept.
  • Unreadable reference documents include the underlying exception message, and the generic reference error is only added when nothing more specific was recorded.
  • JsonPointer.Find checks array bounds and node kinds instead of catching exceptions.

Tests

ReaderErrorDetails_Should: 6 of its 9 tests fail on vnext. Full suite passes on net8.0/net9.0/net10.0.

🤖 Generated with Claude Code

…resolved

- Integer, long and bool scalar errors now include the value and the
  reason (not a whole number vs. out of range) and the location of the
  field. Schema integer fields used a catch-all that reported every
  failure as "The value is out of range"; they now use the same helper.
- A reference whose document cannot be read now reports the underlying
  error, and a failed reference is no longer reported twice (once with
  the specific reason, then again as "Unable to deserialize reference").
- JsonPointer.Find no longer swallows exceptions. It also returned the
  scalar it walked into for pointers such as /info/title/nested instead
  of null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bielu
bielu requested a review from VisualBean as a code owner October 17, 2026 18:37
@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 79ee3b30-74fa-4c80-90b8-f48d68fcbdcd
📥 Commits

Reviewing files that changed from the base of the PR and between 70e73db and 199ade8.

📒 Files selected for processing: 5
  • src/ByteBard.AsyncAPI.Readers/AsyncApiJsonDocumentReader.cs
  • src/ByteBard.AsyncAPI.Readers/ParseNodes/JsonPointerExtensions.cs
  • src/ByteBard.AsyncAPI.Readers/ParseNodes/ValueNode.cs
  • src/ByteBard.AsyncAPI.Readers/Schemas/AsyncApiJsonSchemaDeserializer.cs
  • test/ByteBard.AsyncAPI.Tests/ReaderErrorDetails_Should.cs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
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.

1 participant