salsadigitalauorg / merlin-framework

Merlin - migration framework
GNU General Public License v3.0
16 stars 3 forks source link

Different data structure for xpath vs. standard selector #63

Closed stooit closed 5 years ago

stooit commented 5 years ago

Describe the bug When using long_text the resulting data structure differs for xpath vs. non-xpath selectors.

The non-xpath selector result always appears in an array of results, whereas xpath returns a single object.

Sample configuration XPath (returns object):

---
domain: https://www.chiefscientist.gov.au
urls:
  - /about/

entity_type: basic_page
mappings:
  - field: alias
    type: alias
  - field: field_body
    selector: "//*[@id='content']"
    type: long_text

Standard (returns arr):

---
domain: https://www.chiefscientist.gov.au
urls:
  - /about/

entity_type: basic_page
mappings:
  - field: alias
    type: alias
  - field: field_body
    selector: "#content"
    type: long_text

Expected behavior The type should behave the same way (single object for a single result) for non-xpath selectors.

Additional context This is important so migration plugins have standard data schemas to work with no matter what type of selector is applied

nickgeorgiou commented 5 years ago

Think I've covered this issue now.

Issue 63.docx

See origin/feature/issue-63