Don't set empty fields in output#456
Merged
rmilecki merged 1 commit intoinvoice-x:masterfrom Feb 1, 2023
Merged
Conversation
Collaborator
rmilecki
commented
Jan 28, 2023
Before introducing parsers concept extract() did not set empty fields in output. So in case of re.findall() returning an empty list there was a warning like: WARNING:invoice2data.extract.invoice_template:regexp for field <foo> didn't match and on <foo> in output dictionary / file. That has unintentionally changed after commit 670f872 ("Extend fields syntax to support associative arrays & add 2 initial parsers (invoice-x#308)"). Output can now look like: [ { "issuer": "Company", "amount": 12.34, "date": "2023-01-01", "invoice_number": "01/2023", "test_field": [], "currency": "EUR", "desc": "Invoice from Company" } ] Bring back old behaviour and don't set empty fields: [ { "issuer": "Company", "amount": 12.34, "date": "2023-01-01", "invoice_number": "01/2023", "currency": "EUR", "desc": "Invoice from Company" } ]
Collaborator
Author
|
I've just noticed that my old #308 changed parsing behaviour. I'm wondering if the old behaviour made more sense and should be brought back. Any opinion on this? |
Collaborator
|
I am kinda neutral on this. Both methods has his up and downsides. |
bosd
approved these changes
Jan 29, 2023
Collaborator
bosd
left a comment
There was a problem hiding this comment.
Let's restore the old behavior. :+1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.