You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to migrate from RefResolver to referencing #1079
...
File ~/.virtualenvs/sds/lib/python3.10/site-packages/referencing/_core.py:394, in Registry.crawl(self)
391 while uncrawled:
392 uri, resource = uncrawled.pop()
--> 394 id = resource.id()
395 if id is not None:
396 uri = urljoin(uri, id)
AttributeError: 'dict' object has no attribute 'id'
You're passing dicts (object schemas) to the second argument of with_resources, but it takes referencing.Resource objects, which are essentially your dict wrapped with the information that it is a Draft 4 schema.
You could instead either call Resource.from_contents on your dicts if they contain $schema keys, or use referencing.jsonschema.DRAFT4.create_resource(each) on them to explicitly say they're draft 4 resources, or even better would be if they have id keys in them indicating they're subresources (so e.g. "id": "https://my_url/EDM.json" in your definitions/edm schema) in which case you need to do nothing extra at all, they'll be automatically found if your parent schema resource is in the registry.
Hope that helps but if there's suggestions for how you'd have figured the above out in the doc page you linked let me know.
Activity
Julian commentedon Apr 5, 2023
You're passing
dicts (object schemas) to the second argument ofwith_resources, but it takesreferencing.Resourceobjects, which are essentially your dict wrapped with the information that it is a Draft 4 schema.You could instead either call
Resource.from_contentson your dicts if they contain$schemakeys, or usereferencing.jsonschema.DRAFT4.create_resource(each)on them to explicitly say they're draft 4 resources, or even better would be if they haveidkeys in them indicating they're subresources (so e.g."id": "https://my_url/EDM.json"in yourdefinitions/edmschema) in which case you need to do nothing extra at all, they'll be automatically found if your parent schema resource is in the registry.Hope that helps but if there's suggestions for how you'd have figured the above out in the doc page you linked let me know.