Include actual media type in InvalidSchemaMediaTypeException#872
Merged
DannyvdSluijs merged 4 commits intomainfrom Jan 23, 2026
Merged
Include actual media type in InvalidSchemaMediaTypeException#872DannyvdSluijs merged 4 commits intomainfrom
DannyvdSluijs merged 4 commits intomainfrom
Conversation
Co-authored-by: DannyvdSluijs <618940+DannyvdSluijs@users.noreply.github.com>
Co-authored-by: DannyvdSluijs <618940+DannyvdSluijs@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Report what media type is in UriRetriever
Include actual media type in InvalidSchemaMediaTypeException
Jan 23, 2026
Co-authored-by: DannyvdSluijs <618940+DannyvdSluijs@users.noreply.github.com>
DannyvdSluijs
approved these changes
Jan 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix InvalidSchemaMediaTypeException to include actual media type
UriRetriever::confirmMediaType()to include the actual media type discoveredSummary
This PR fixes the issue where
InvalidSchemaMediaTypeExceptiononly reported what media type was expected but not what was actually received.Changes:
"Media type application/schema+json expected"to"Media type application/schema+json expected, but text/html given"(example)Testing:
Original prompt
This section details on the original issue you should resolve
<issue_title>UriRetriever: Report what Media type is</issue_title>
<issue_description>https://github.com/jsonrainbow/json-schema/blob/53725e0/src/JsonSchema/Uri/UriRetriever.php#L94
Seen at https://integration.wikimedia.org/ci/job/quibble-for-mediawiki-core-vendor-mysql-php83/4583/console when trying to upgrade the OpenApi spec we're using in testing (so on 5.3.1, currently) from
3.0.3to3.0.4.https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1229635/1/tests/phpunit/integration/includes/Rest/Handler/data/OpenApi-3.0.json
While it's helpful to be told what media type something isn't... It's not very helpful if you're not also told what media type something apparently is.