-
Notifications
You must be signed in to change notification settings - Fork 356
Circular references #281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@nicolas-t Can you check this issue #274 ? In my comment, I found that In our code, we want to cache all the resolved schemas, so we write like this:
It seems that every time you dereference a schema, you need to create a new RefResolver. You can try this way to see if it works or not |
Thanks ! yes I saw your comment before opening this issue, but in my code i'm not looping over schemas. My code looks like this: $refResolver = new JsonSchema\RefResolver(new JsonSchema\Uri\UriRetriever(), new JsonSchema\Uri\UriResolver());
$schema = $refResolver->resolve('file://mySchema.json'));
$validator = new JsonSchema\Validator();
$validator->check($json->data, $schema); So i'm not sure how to use your example. |
Should be solved with #277 and is available in 3.0.0 |
Hi,
I'm using the v2.0.5, and I encouter this error:
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 32 bytes) in vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.php on line 127
This error seems to be related to circular references.
Here is a minimal version of my 2 schemas:
Author.json
_in some cases_ will return a collection of PostsPost.json
_in some cases_ will return an AuthorI just have two cases:
The circular cases (where I want an author with his posts+author) never happens in real life.
Not sure if i'm clear.
My question:
Is it a problem of the way I designed my schemas or is it a problem of your validation library?
Best regards,
The text was updated successfully, but these errors were encountered: