I have the following schemes:
nodes = {
'type': 'dict',
'schema': {
'hardware': {
'type': 'string',
'data_relation': {
'resource': 'nodes_hw',
'field': 'name',
'embeddable': True
}
}
}
}
nodes_hw = {
'type': 'dict',
'schema': {
'name': {
'type': 'string',
'required': True,
'unique': True
}
}
}
When now querying
/nodes?embedded={"hardware":1}
the resulting value for hardware is null.
The following lines seem to be the problem
|
# NOTE: in case it is a DBRef link, the id_field_name is always the _id |
|
# regardless the Eve set-up |
|
id_field_name = "_id" if isinstance(reference, DBRef) \ |
|
else config.DOMAIN[subresource]['id_field'] |
Internally, in nodes_hw a lookup is performed with _id = VALUE_OF_HARDWARE.
Changing this line to use data_relation['field'] yields the expected result.
Then the internal lookup is correctly performed with name = VALUE_OF_HARDWARE
As result, hardware contains a dictionary with the embedded nodes_hw object.
Am I doing something wrong, is this not wanted or is this a bug?
I have the following schemes:
When now querying
the resulting value for hardware is null.
The following lines seem to be the problem
eve/eve/methods/common.py
Lines 826 to 829 in cee2f7e
Internally, in nodes_hw a lookup is performed with _id = VALUE_OF_HARDWARE.
Changing this line to use data_relation['field'] yields the expected result.
Then the internal lookup is correctly performed with name = VALUE_OF_HARDWARE
As result, hardware contains a dictionary with the embedded nodes_hw object.
Am I doing something wrong, is this not wanted or is this a bug?