atviriduomenys / spinta

Spinta is a framework to describe, extract and publish data (a DEP Framework).
MIT License
10 stars 4 forks source link

Denormalized properties do not show up with XML source #627

Open sirex opened 1 month ago

sirex commented 1 month ago

data.xml:

<?xml version="1.0" encoding="UTF-8"?>
<cities>
    <city id="1" country="LT">Vilnius</city>
    <city id="2" country="LT">Kaunas</city>
</cities>

dsa.txt:

d | r | m | property     | type    | ref     | source       | prepare | level | access
datasets/example         |         |         |              |         |       |
  | resource1            | xml     |         | data.xml     |         |       |  
  |   | Country          |         | code    |              |         |       |  
  |   |   | code         | string  |         |              |         |       | private
  |   | City             |         | id      | /cities/city |         | 4     |  
  |   |   | id           | integer |         | @id          |         | 4     | open
  |   |   | name@lt      | string  |         | text()       |         | 4     | open
  |   |   | country      | ref     | Country | @country     |         | 4     | open
  |   |   | country.code | string  |         | @country     |         | 4     | open
spinta run --mode external dsa.txt &>> spinta.log & ; PID=$!
http :8000/datasets/example/City
HTTP/1.1 200 OK
content-type: application/json

{
    "_data": [
        {
            "_id": "228315df-4b51-42a8-a4ac-ef6dd106452d",
            "_revision": null,
            "_type": "datasets/example/City",
            "id": 1,
            "name": {
                "lt": "Vilnius"
            },
            "country": {
                "_id": "77a958d9-6aae-4c5a-ac4b-fe6133e37fbb"
            }
        },
        {
            "_id": "8cc2c267-8516-47b5-b4ac-e27500c41d69",
            "_revision": null,
            "_type": "datasets/example/City",
            "id": 2,
            "name": {
                "lt": "Kaunas"
            },
            "country": {
                "_id": "77a958d9-6aae-4c5a-ac4b-fe6133e37fbb"
            }
        }
    ]
}

Returned data should be:

HTTP/1.1 200 OK
content-type: application/json

{
    "_data": [
        {
            "_id": "228315df-4b51-42a8-a4ac-ef6dd106452d",
            "_revision": null,
            "_type": "datasets/example/City",
            "id": 1,
            "name": {
                "lt": "Vilnius"
            },
            "country": {
                "_id": "77a958d9-6aae-4c5a-ac4b-fe6133e37fbb",
                "code": "LT"
            }
        },
        {
            "_id": "8cc2c267-8516-47b5-b4ac-e27500c41d69",
            "_revision": null,
            "_type": "datasets/example/City",
            "id": 2,
            "name": {
                "lt": "Kaunas"
            },
            "country": {
                "_id": "77a958d9-6aae-4c5a-ac4b-fe6133e37fbb",
                "code": "LT"
            }
        }
    ]
}