opis / json-schema

JSON Schema validator for PHP
https://opis.io/json-schema
Apache License 2.0
567 stars 58 forks source link

External schema cannot be loaded #122

Open mxr576 opened 2 years ago

mxr576 commented 2 years ago

I am following the official documentation but I have bumped into a fundamental issue at the first try

<?php
require "vendor/autoload.php";

use Opis\JsonSchema\{
    Validator,
    ValidationResult,
    Helper,
};

$validator = new Validator();

$result = $validator->validate('{}', 'https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json');

if ($result->isValid()) {
  echo 'valid';
}

// Checking if there is an error
if ($result->hasError()) {
    // Get the error
    echo $result->error();
}

Unexpected result:

RuntimeException with message 'Schema not found: https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.0/schema.json#'