-
Notifications
You must be signed in to change notification settings - Fork 356
New way of handling references #277
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
@@ -7,3 +7,4 @@ coverage | |||
.settings | |||
composer.lock | |||
docs-api | |||
.idea/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please omit this change and add this to a global .gitignore
https://help.github.com/articles/ignoring-files/#create-a-global-gitignore
@psafarov please rebase this on master |
@@ -27,29 +31,13 @@ public function getUriRetriever() | |||
} | |||
|
|||
/** | |||
* @param UriRetrieverInterface $uriRetriever | |||
*/ | |||
public function setUriRetriever($uriRetriever) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach prevents reuse of an instance of SchemaStorage
by only allowing a user to set the retriever or resolver only during instantiation. The goal of simplifying instantiation SchemaStorage
is achieved but I am not sure that is a problem nor am I sure it is germane to the main goal of handling circular references.
I am not sure I think this is an improvement but I won't hold up this PR for this if the community supports this move.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bighappyface you're right, it's not only about circular references. I also wanted to simplify the interface. Now there is no RefResolvers you need to know about, until you have to
Any info on this one? I would like to see this in a release. |
@FlorianSW @steffkes @mirfilip would you mind giving this PR a review? This looks to be all but certainly a major update that would push us to 3.0.0. |
SchemaStorage $schemaStorage = null, | ||
UriRetriever $uriRetriever = null, | ||
Factory $factory = null | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be kinda easier to move $schemaStorage
to the end of the list? if we'd append it to the existing list, we wouldn't introduce a BC-Break at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 This seems like an unnecessary breaking change. However, if this is already a breaking change (and in this core functionality), it probably doesn't make sense to reorder arguments, if it makes sense. Unfortunately, I don't see a good reason to do it here? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steffkes @FlorianSW I think, you're right, it's better to be in the end
just had a first glance over the changes - did add a comment where i thought it's need. will have a more detailed look during this week - given this PR is still open and not already merged |
|
||
/** | ||
* Factory for centralize constraint initialization. | ||
*/ | ||
class Factory | ||
{ | ||
/** | ||
* @var SchemaStorage | ||
*/ | ||
protected $schemaStorage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've a getter method for $uriRetriever, wouldn't it make sense to have one for $schemStorage
, too?
Added some comments. For now it looks sane and reasonable, but someone (:P) should test it in a real life example, just to make sure it's working like expected :) |
@FlorianSW I can't say It has no bugs for sure, but this code is used in production in a company, no problems so far |
@psafarov I have merged a few PRs this morning and I put this PR out of sync. Would you please rebase on master? |
@bighappyface done |
@psafarov sorry for the confusion. It looks like you merged master in okay but rebasing is different than merging master in. There should only be one commit in this PR. |
@bighappyface fixed. |
With community support I'll merge it into master. The plan is to merge it and then bump to 3.0.0 so indicate BC-breaking changes. Other PRs I have merged have probably already put us in a position to bump to 3.0.0 anyway. |
Based on the passing tests, the account of this code being in production, the need for verified handling of circular references, and what feels like community approval and support, I am going to move this along and am going to cut release 3.0.0. +1 |
👍 |
I had issues compiling schemas containing circular references with RefResolver, so the way of handling references was changed, now Validator contains SchemaStorage object inside, which contains all schemas and can resolve references when it's needed. The pros of this approach are: