Open marceloverdijk opened 1 week ago
Yes, I think something analogous to the glob
loader's generateId
function would make sense here.
@ascorbic I had my data in both json and csv format and I think using the out-of-the-box file loader to load the JSON might be a better solution than using csv.
However the file loader also the limitation that it cannot generate ids.
After you mentioned the glob's generateId option I changed the file loader my self to be able to generate ids, and that works perfectly.
I've created a feature request and a PR here
https://github.com/withastro/roadmap/discussions/1045
https://github.com/withastro/astro/pull/12308
I'm looking forward to your feedback.
When loading the CSV the papaparse
dynamicTyping
seems always be set to true, and cannot be overridden:https://github.com/ascorbic/astro-loaders/blob/main/packages/csv/src/csv-loader.ts#L55C1-L60C8
(same for
header
andtransformHeader
,step
andcomplete
).The issue is I have a CSV like:
Where
category
is a string (all values are quoted as well), but when parsing"1"
it still converts it to a number (I believe because ofdynamicTyping = true
) which result in a terminal error:I think in this case I should configure the csv loader like: