Skip to content

Fixed validation of JTokens with type Uri#1403

Merged
lahma merged 1 commit into
RicoSuter:masterfrom
ertrumbl:fix-uri-type-to-string
Jul 27, 2025
Merged

Fixed validation of JTokens with type Uri#1403
lahma merged 1 commit into
RicoSuter:masterfrom
ertrumbl:fix-uri-type-to-string

Conversation

@ertrumbl
Copy link
Copy Markdown
Contributor

JsonSchemaValidator was not properly converting JTokens of type Uri to strings. Calling token.Value() would throw exception because Uri does not implement IConvertible. Instead Uri's ToString() should be used to convert to string.

Converted to switch statement to handle multiple different Type scenarios and added unit test to cover Uri case.

@ertrumbl
Copy link
Copy Markdown
Contributor Author

@RicoSuter Is anyone still reviewing PR's that can take a look at this?

Comment thread src/NJsonSchema/Validation/JsonSchemaValidator.cs Outdated
@RicoSuter
Copy link
Copy Markdown
Owner

RicoSuter commented Sep 26, 2023

Tests are failing, please fix if we should merge the PR.

@lahma lahma force-pushed the fix-uri-type-to-string branch from 273ba7e to cb922f0 Compare July 27, 2025 09:36
Copy link
Copy Markdown
Collaborator

@lahma lahma left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@lahma lahma merged commit b5ec5b4 into RicoSuter:master Jul 27, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants