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

feat: register additional JSON-LD files via config #3317

Conversation

paullatzelsperger
Copy link
Member

@paullatzelsperger paullatzelsperger commented Jul 20, 2023

What this PR changes/adds

Adds the possibility to register additional files with the CachedDocumentLoader via config entries, e.g.:
edc.jsonld.document.foo.path=/tmp/path/to/doc.json
edc.jsonld.document.foo.url=https://foo.com/doc.jsonld

Why it does that

configurability and flexibility in downstream projects

Further notes

  • a Config#getRelativeEntries(String, boolean) method was added to allow stripping away the basePath from resulting entries, returning foo.path instead of edc.jsonld.document.foo.path

Linked Issue(s)

Closes #2951

Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.

@paullatzelsperger paullatzelsperger force-pushed the feat/2951_load_file_doc_resolver_from_config branch from 39264b4 to 0103710 Compare July 20, 2023 18:19
@paullatzelsperger paullatzelsperger force-pushed the feat/2951_load_file_doc_resolver_from_config branch from 0103710 to fbd9143 Compare July 20, 2023 18:20
@codecov-commenter
Copy link

codecov-commenter commented Jul 20, 2023

Codecov Report

Patch coverage: 90.90% and project coverage change: +0.01 🎉

Comparison is base (b6c5f4e) 71.91% compared to head (a1abeca) 71.93%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3317      +/-   ##
==========================================
+ Coverage   71.91%   71.93%   +0.01%     
==========================================
  Files         810      810              
  Lines       16509    16524      +15     
  Branches      962      965       +3     
==========================================
+ Hits        11872    11886      +14     
  Misses       4236     4236              
- Partials      401      402       +1     
Impacted Files Coverage Δ
...n/java/org/eclipse/edc/jsonld/JsonLdExtension.java 78.37% <90.90%> (+5.30%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

* converts a map entry, that looks like "something.url" -> https://foo.bar, into a map entry, that looks like
* "something" -> ("url" -> "https://foo.bar") and adds it to an existing map
*/
private void split(Map<String, Map<String, String>> targetMap, Map.Entry<String, String> entry) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now this can be deleted

return service;
}

private void registerCachedDocumentsFromConfig(ServiceExtensionContext context, TitaniumJsonLd service) {
Map<String, Map<String, String>> tempMappings = new HashMap<>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@paullatzelsperger paullatzelsperger merged commit 5e8aaa0 into eclipse-edc:main Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core feature enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

json-ld: load file document resolver from configuration
4 participants