Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6194

Figure out if/how to support relative paths in YamlReader for includes

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Neutral Neutral
    • None
    • None
    • configuration, yaml
    • None
    • 13

      As a developer, in my /foo/bar/qux.yaml file, I want to be able to write !include blah.yaml instead of !include /foo/bar/blah.yaml (i.e when the file-to-be-included is in the same directory)

      Additionally, I might to be able to do

      • !include what/ever.yaml # to include /foo/bar/what/ever.yaml from /foo/bar/qux.yaml
      • !include ../what/ever.yaml # to include a file higher in another directory and/or a parent
      • !include **/kawabunga.yaml # to include the first file called kawabunga.yaml anywhere under /foo/bar
      • !include /**/kawabunga.yaml # to include the first file called kawabunga.yaml anywhere under the root folder
      • etc.. etc..

      The last 2 proposals might seem a bit over the top, but would be super useful to keep things concise (include */common.yaml). They are inspired by FreeMarker's include directive, but differ by using instead of {} (thus looking more like a "glob" pattern), and by being relative to the current directory and going down, rather than going up the hierarchy like FreeMarker does (again, being closer to unix shells and globs).

      Of course this story could be split in 2 if this isn't considered useful or is harder to implement than I thought (I'm think Origin.traverse() with a good Predicate might do the trick)

      Additionally, I'd like to mention this will probably imply changes/improvements on Origin/ResourcePath, and YamlReader will end up just being a client of the new feature (with tests validating the integration).

        Acceptance criteria

              Unassigned Unassigned
              gjoseph Magnolia International
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:

                  Task DoD