joshtemple / lkml

A speedy LookML parser & serializer implemented in pure Python.
MIT License
166 stars 31 forks source link

Multiline descriptions are parsed with `\n` characters #81

Closed owlas closed 1 year ago

owlas commented 1 year ago

If I process a lkml view like this:

view: orders {
  sql_table_name: order_1 ;;

  dimension: easy {
    description: "This should be easy"
    sql: ${TABLE}.id ;;
  }

  dimension: hard {
    description: "This is
      probably harder isn't it?"
    sql: ${TABLE}.id ;;
  }
}

Then when I parse the lkml I get the following description for the hard dimension:

This is\n      probably harder isn't it?

In looker the new line and indentation is ignored. Is this something you'd want to handle in lkml? I'm just trying a workaround in our own code but would be great to fix upstream if it's in scope

joshtemple commented 1 year ago

Hey Oliver! The goal of lkml is to allow a Python-operable representation of the LookML. Even though Looker is processing that description string to remove the whitespace, my desire would be to keep it in the parsed representation. Otherwise lkml can't do a proper round trip (parse to Python, then dump back to the identical string).