inveniosoftware / inveniosoftware/domapping
global: management of circular references
- Dominant language
- Python
- Stars
- 14
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
I am writing this issue here because `domapping` is one of the affected tools.
The case is very simple. Right now, we have a circular reference in one of our schemas and it will occur more times in the near future, so trying to avoid this case doesn't look to be possible.
An example could be something like this: An owner has a car which has an owner. In this case, you can denormalize the schemas, but not in our real case. In our case, someone is trying to create a composite pattern using schemas.
Here is a little example:
Owner:
``` json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"car": {
"$ref": "car.json#"
}
}
}
```
Car:
``` json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"owner": {
"$ref": "owner.json#"
}
}
}
```
The solution in this case is easy: denormalize the data. However, we can not apply the same solution to our case.
We have been thinking about several solutions:
1) We can set the `type` of the inner item to `object` when we are generating the mapping and we detect the circular reference. It is not mapped properly but we avoid the problem.
2) Set the inner field as a number in order to use it as a external identifier. In this way, you need to normalize the data from the client and denormalize again to send it to the client.
3) Try to avoid somehow the dependencies (Check in our case (CERN Analysis Preservation) all the schemas looking for a solution to these issues.) but it will not be reasonable.
Thanks a lot in advance.
Contributor guide
Assessment
This issue has not been assessed yet.