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
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 of dynamicTyping = true) which result in a terminal error:
AstroError [InvalidContentEntryDataError]: **persons → xyz** data does not match collection schema.
**category**: Expected type `"string"`, received "number"
I think in this case I should configure the csv loader like:
@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.
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:
The text was updated successfully, but these errors were encountered: