json-schema icon indicating copy to clipboard operation
json-schema copied to clipboard

External schema cannot be loaded

Open mxr576 opened this issue 2 years ago • 0 comments

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#'

mxr576 avatar Oct 27 '22 14:10 mxr576