-
-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No error, when there are no items in CSV file during struct deserializing (with serde) #272
Comments
An empty CSV file (including a CSV file with a single header row) is a valid CSV file. If it doesn't work for your specific use case, then your code should return an error. I don't see a reason why this crate should return an error. Also, I don't know what serde has to do with this. It seems orthogonal. |
Yes, you are right, but this issue is more about headers. I think I misdescribed the problem. In this case, it does not give an error even if the headers are not compatible with the struct, for example struct structure: pub struct ProductCreate {
pub model: String,
pub brand: String,
pub description: Option<String>,
pub classification: Option<String>,
pub sales_type: Option<String>,
} example csv: One more example csv file: I think, In this case, it would be better to have an error. |
I don't think this is possible to implement with serde. |
Problem:
When deserializing a CSV file with only headers without any other rows into a struct (with serde), It doesn't give any error, and the records count is 0.
In this case, it may give an error, and can be stated that there must be at least one item in the csv file
The text was updated successfully, but these errors were encountered: