Skip to content

Add option to set MAX_CONTEXT_URLS in ContextResolver#268

Draft
mielvds wants to merge 1 commit into
masterfrom
104-max-context-urls
Draft

Add option to set MAX_CONTEXT_URLS in ContextResolver#268
mielvds wants to merge 1 commit into
masterfrom
104-max-context-urls

Conversation

@mielvds
Copy link
Copy Markdown
Collaborator

@mielvds mielvds commented May 21, 2026

Fixes #104

This would allow setting a custom ContextResolver with a different level, for instance 20:

contextresolver = ContextResolver(jsonld._resolved_context_cache, options['documentLoader'], max_context_urls=20)
jsonld.compact(input, context, {"contextResolver": contextresolver})

This is a ok fix, but the contextresolver could use a refactor.

  • The cycles parameter in ContextResolver.resolve() is a set(), but can also be an integer.
  • It feels like the default contextresolver should be part of the JsonLdProcessor object instead of being created in the method.
  • according to the docs, "contextResolver" is "for internal use only", but I'm not sure why that is. @davidlehn @dlongley @BigBlueHat ?

@github-actions
Copy link
Copy Markdown

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.

MAX_CONTEXT_URLS set to low

1 participant