You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While datasource is useful, it only supports structured data. There are some cases where I need to just include the text from some source without worrying about whether it's structured data.
At first I'd thought of just enhancing datasource so that it falls back to pulling plain text for content-types it doesn't recognize, but it's possible that I could want to include a JSON file (or some other structured data) unparsed into the template.
So what I'm thinking is maybe a new function include that would support the same kinds of URLs as datasource, but just reads them and doesn't worry about parsing structured data.
The questions I'm pondering are:
am I overthinking this? does this just belong in datasource?
there's a compatibility risk here - if I read an XML file (for example) and get its raw text in one version of gomplate, but then add XML support later, datasource will stop returning a string and start returning a map - this would be bad!
would it make sense to take the same approach as datasource in how datasources are referenced (i.e. on the commandline with -d), or would it make more sense to in-line URLs
adding all manner of commandline arguments gets messy, but on the other hand hard-coding URLs in a template is undesirable. Perhaps there's a middle ground...
🤔
The text was updated successfully, but these errors were encountered:
While
datasource
is useful, it only supports structured data. There are some cases where I need to just include the text from some source without worrying about whether it's structured data.At first I'd thought of just enhancing
datasource
so that it falls back to pulling plain text for content-types it doesn't recognize, but it's possible that I could want to include a JSON file (or some other structured data) unparsed into the template.So what I'm thinking is maybe a new function
include
that would support the same kinds of URLs asdatasource
, but just reads them and doesn't worry about parsing structured data.The questions I'm pondering are:
datasource
?gomplate
, but then add XML support later,datasource
will stop returning astring
and start returning amap
- this would be bad!datasource
in how datasources are referenced (i.e. on the commandline with-d
), or would it make more sense to in-line URLs🤔
The text was updated successfully, but these errors were encountered: