Skip to content
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

Add recursion to FileLocator #85

Merged
merged 1 commit into from
Jan 12, 2020

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented Nov 2, 2019

The FileLocator uses an array of directories to search for metadata for the given class. It will then loop over this array and try to find exact matches by converting backslashes in the FQCN to dots and appending the extension.

Because of this, it will always try to do an exact match. If it cannot find that file, it will continue to the next directory.

If you need to add metadata to a lot of classes, this quickly becomes very messy. You need to create a single file for every class you want to support.

With this change, it should be easier. You can now add multiple definitions in 1 metadata file. The FileLocator will now loop every FQCN until it finds the top level namespace.

Signed-off-by: Ruud Kamphuis [email protected]

Q A
Bug fix? no
New feature? yes
Doc updated no
BC breaks? don't know
Deprecations? no
Tests pass? yes
Fixed tickets #...
License MIT

The FileLocator uses an array of directories to search for metadata for the given class. It will then loop over this array and try to find exact matches by converting backslashes in the FQCN to dots and appending the extension.

Because of this, it will always try to do an exact match. If it cannot find that file, it will continue to the next directory.

If you need to add metadata to a lot of classes, this quickly becomes very messy. You need to create a single file for every class you want to support.

With this change, it should be easier. You can now add multiple definitions in 1 metadata file. The FileLocator will now loop every FQCN until it finds the top level namespace.

Signed-off-by: Ruud Kamphuis <[email protected]>
@goetas
Copy link
Collaborator

goetas commented Nov 2, 2019

This looks a nice idea.... how will it play with jms/serializer? Diid you have a chance to try it?
I think this might need few more tests (both in this library and in jms/serializer at least...)

This looks to me a big change that might require a major version bump

@ruudk
Copy link
Contributor Author

ruudk commented Nov 2, 2019

I created this specifically for JMS Serializer and it works great. What kind of tests should I add?

@ruudk
Copy link
Contributor Author

ruudk commented Jan 8, 2020

@goetas What do you think about this?

@goetas goetas merged commit 092b94d into schmittjoh:master Jan 12, 2020
@goetas
Copy link
Collaborator

goetas commented Jan 12, 2020

ruudk added a commit to ruudk/serializer that referenced this pull request Jan 13, 2020
@ruudk
Copy link
Contributor Author

ruudk commented Jan 13, 2020

@goetas Done schmittjoh/serializer#1155

@ruudk ruudk deleted the recursive-file-locator branch January 13, 2020 18:59
goetas added a commit that referenced this pull request May 25, 2020
This reverts commit 092b94d, reversing
changes made to 8692edc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants