atviriduomenys / spinta

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

Enum on nested property does not work #540

Open sirex opened 7 months ago

sirex commented 7 months ago
cat > /tmp/manifest.txt <<EOF
d | r | b | m | property    | type    | ref | source | prepare
example                     |         |     |        |
  |   |   | Answer          |         | id  |        |
  |   |   |   | id          | integer |     |        |
  |   |   |   | opinion.o1  | integer |     |        |
  |   |   |   |             | enum    |     |        | 1
  |   |   |   |             |         |     |        | 0
  |   |   |   | opinion.o2  | integer |     |        |
  |   |   |   |             | enum    |     |        | 1
  |   |   |   |             |         |     |        | 0
EOF
spinta check /tmp/manifest.txt

This gives following error:

Traceback (most recent call last):
  File "spinta/cli/config.py", line 35, in check
    prepare_manifest(context, ensure_config_dir=True)
  File "spinta/cli/helpers/store.py", line 136, in prepare_manifest
    store = load_manifest(
  File "spinta/cli/helpers/store.py", line 120, in load_manifest
    commands.load(
  File "spinta/manifests/yaml/commands/load.py", line 108, in load
    commands.load(
  File "spinta/manifests/tabular/commands/load.py", line 58, in load
    load_manifest_nodes(context, into, schemas, source=manifest)
  File "spinta/manifests/helpers.py", line 134, in load_manifest_nodes
    for eid, schema in schemas:
  File "spinta/manifests/tabular/helpers.py", line 1444, in read_tabular_manifest
    yield from _read_tabular_manifest_rows(
  File "spinta/manifests/tabular/helpers.py", line 1399, in _read_tabular_manifest_rows
    reader.read(row)
  File "spinta/manifests/tabular/helpers.py", line 1174, in read
    self.error(
  File "spinta/manifests/tabular/helpers.py", line 217, in error
    raise TabularManifestError(f"{self.path}:{self.line}: {message}")
spinta.manifests.tabular.helpers.TabularManifestError:
    /tmp/manifest.txt:9:
        Enum '' item '1' with the same value is already defined.

It looks, that enum is attached to opinion property instead of opinion.o2.

Might be related