Skip to content

Incorrectly nested arrays in name_aliases #125

@orangejulius

Description

@orangejulius

While running a WOF import today I noticed the following error:

error: [whosonfirst] doc generator error: invalid document type, expecting: string got: Feldbach
error: [whosonfirst] {
  "id": 1394398051,
  "name": "Liebenfels",
  "name_aliases": [
    "Liebenfels",
    [
      "Feldbach"
    ],
    "Feldbach / Liebenfels"
  ],
  "name_langs": {
    "el": [
      "Φέλντμπαχ"
    ],
    "en": [
      [
        "Feldbach"
      ],
      "Feldbach / Liebenfels"
    ],
    "nl": [
      "Feldbach"
    ],
    "ro": [
      "Feldbach"
    ]
  },
  "place_type": "neighbourhood",
  "lat": 47.24069,
  "lon": 8.78906,
  "bounding_box": "8.78906,47.24069,8.78906,47.24069",
  "population": 7,
  "hierarchies": [
    {
      "continent_id": 102191581,
      "country_id": 85633051,
      "county_id": 1394212863,
      "localadmin_id": 1394253973,
      "locality_id": 1125908497,
      "neighbourhood_id": 1394398051,
      "region_id": 85682309
    }
  ]
}

It looks like, for whatever reason, a nested array is being created in the name_aliases field:

  "name_aliases": [
    "Liebenfels",
    [
      "Feldbach"
    ],
    "Feldbach / Liebenfels"
  ],

It's unclear if the underlying error is made in the WOF importer, or here in pelias/model. Looks like we should add a .flatten to any arrays before we send them off.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions