aleph
aleph copied to clipboard
FEATURE: Add option to disable resolving nested entities
Is your feature request related to a problem? Please describe.
API endpoints that return entities (such as search, fetching individual entities) automatically resolve nested entities. For example, the entity ID 456def
in the following entity would be resolved:
{
"id": "123abc",
"schema": "Company",
"properties": {
"name": ["ACME, Inc."],
"addressEntity": ["456def"]
}
}
The resolved API response will look like this:
{
"id": "123abc",
"schema": "Company",
"properties": {
"name": ["ACME, Inc."],
"addressEntity": [
{
"id": "456def",
"schema": "Address",
"properties": {
"country": ["us"],
"city": ["Anytown"],
"full": ["123 Main St, Anytown 12345"],
}
}
]
}
}
In many cases, this is useful (e.g. it’s heavily relied on by the UI). However, in some cases it may be preferred to return the unresolved entity IDs instead (e.g. when exporting a subset of the entity graph).
Describe the solution you'd like
I suggest adding an optional query parameter to relevant endpoints (e.g. resolve
or nested
) that defaults to the current behavior, but can be used to optionally disable automatic resolution.
Describe alternatives you've considered Manually replacing resolved entity objects with their IDs. This works, but it adds overhead, especially when implementing one-off scripts for analysis.
Additional context
It should be fairly easy to implement this in the Serializer
class.