Code Monkey home page Code Monkey logo

Comments (7)

mchiocca avatar mchiocca commented on July 28, 2024

Hello. I'm guessing that you're using $ref to resolve json-calendar.schema is that correct? The support for $ref is currently limited. I have been working on expanding the implementation of $ref and URI resolving to add support for more use cases. I hope to issue a pull request soon.

from json-schema.

michapixel avatar michapixel commented on July 28, 2024

I don't know what $ref is, but is there an alternative wihch i can use?

from json-schema.

michapixel avatar michapixel commented on July 28, 2024

what is combineRelativePathWithBasePath trying to achieve?

from json-schema.

mchiocca avatar mchiocca commented on July 28, 2024

Using $ref allows you to refer to schemas in other locations, whether they be within the current schema file or in some other file. My guess is that you have something like {"$ref": "json-calendar.schema"} somewhere in your schema and json-schema can't resolve the reference to that file.

The combineRelativePathWithBasePath tries to merge a base path with a relative path. For example, suppose your base path is /foo/bar/ick and your relative path is ../json-calendar.schema. Then the method should combine these into /foo/bar/json-calendar.schema (notice that ick is removed from the path).

from json-schema.

michapixel avatar michapixel commented on July 28, 2024

Oh, now i understand what you meant by $ref. But i haven't such references in there.

The error is within FileGetContents which throws an exception at line 34, so the schema couldn't be read.

btw. it only threw this exception after i copied "ResourceNotFoundException.php" inside "Uri/Retrievers/" otherwise i got "PHP Fatal error: Class 'JsonSchema\Uri\Retrievers\ResourceNotFoundException' not found in ...", quick and dirty, i know.

After "fixing" this, i could go on debugging. i added "error_log($uri);" in line 31 in FileGetContents.php, and it gave me ":///is/htdocs/wp10606769_ZYB0S33ES7/JSON_Feed/inc/schemata/json-calendar.json" which is why the schema couldn't be found.
(should have been "/is/htdocs/wp10606769_ZYB0S33ES7/JSON_Feed/inc/schemata/json-calendar.json")

so i tried to correct the path:

if(preg_match('/^:\/\/\//', $uri)) { $uri = str_replace(':///', '/', $uri); }

but then something really weired happened.
my autoloader tried to load a class qjesqzok_k_
(Class: "qjesqzok_k_" not found (inc/qjesqzok_k_.php)) and certainly failed to do so, because there i no such class/php file there.

here's what i use as an autoloader:
pl_autoload_register(function ($class) { $file = 'inc/'.strtr($class, '\\', '/').'.php'; if (file_exists($file)) { require $file; return true; } else { echo '#argl#' .'<br>'; echo 'Class: "' .$class . '" not found (' .$file .')'; exit; } });

now i'm stuck.

i know this all sounds weired, but have you ever tried to run your class on different machines (linux for example) or am i simply too stupid to use this?

from json-schema.

michapixel avatar michapixel commented on July 28, 2024

Ah, nevermind, this has sth. to do with WordPress and the way i'm using it right now.

but besides that, you might have a look at the file/path quirks i had.
and thanks for helping out :-)

from json-schema.

reod avatar reod commented on July 28, 2024

@michapixel, any chances that you resolved this issue and you remember the answer? ;) Two years later I have the same problem as you had (I'm not using WP but Cake PHP).

from json-schema.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.