Skip to content

Add "Validation using online schema" documentation#12

Merged
DannyvdSluijs merged 3 commits intomainfrom
copilot/add-content-online-schema-validation
Mar 23, 2026
Merged

Add "Validation using online schema" documentation#12
DannyvdSluijs merged 3 commits intomainfrom
copilot/add-content-online-schema-validation

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

The advanced-topics.md page had an empty placeholder for the "Validation using online schema" section. This adds concrete content covering both usage patterns.

Changes

  • Simple usage: Validate against a remote schema by passing an HTTPS URL as $ref — the built-in UriRetriever fetches it automatically:
$validator = new JsonSchema\Validator;
$validator->validate($data, (object)['$ref' => 'https://example.com/your/schema.json']);
  • Explicit retrieval: Use UriRetriever + SchemaStorage directly for cases requiring pre-loading or correct resolution of $ref chains within the remote schema:
$retriever = new UriRetriever();
$schema = $retriever->retrieve($schemaUrl);

$schemaStorage = new SchemaStorage($retriever);
$schemaStorage->addSchema($schemaUrl, $schema);

$validator = new Validator(new Factory($schemaStorage));
$validator->validate($data, $schema);
Original prompt

This section details on the original issue you should resolve

<issue_title>Add content on https://jsonrainbow.github.io/docs/docs/advanced-topics.html#validation-using-online-schema</issue_title>
<issue_description>How to validate using an online schema is left empty in the docs. Content should be added.
See https://jsonrainbow.github.io/docs/docs/advanced-topics.html#validation-using-online-schema</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…topics.md

Co-authored-by: DannyvdSluijs <618940+DannyvdSluijs@users.noreply.github.com>
Copilot AI changed the title [WIP] Add content for online schema validation in documentation Add "Validation using online schema" documentation Feb 28, 2026
```php
<?php

$data = json_decode(file_get_contents('data.json'));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$data = json_decode(file_get_contents('data.json'));
$data = json_decode(file_get_contents('data.json'), false);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 0b74a15.

…cit false to json_decode calls

Co-authored-by: DannyvdSluijs <618940+DannyvdSluijs@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jsonrainbow/docs/sessions/002d7fa9-b47f-4da9-8ec1-c9a01f54edeb
@DannyvdSluijs DannyvdSluijs marked this pull request as ready for review March 23, 2026 21:25
@DannyvdSluijs DannyvdSluijs merged commit 897dc57 into main Mar 23, 2026
@DannyvdSluijs DannyvdSluijs deleted the copilot/add-content-online-schema-validation branch March 23, 2026 21:25
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.

Add content on https://jsonrainbow.github.io/docs/docs/advanced-topics.html#validation-using-online-schema

2 participants