Incorrect documentation for `required_fields` option
In TUTORIAL.md, required_fields is listed as an option, nested below the options key. I couldn't get this to work so I looked into the code and it seems required_fields should actually be at the same level as options. Is the documentation erroneous or should the code be changed to match what the docs say?
Which section are you referring to?
It is listed as "optional'.
In the section of simple invoice template there is an example.
issuer: Microsoft Regional Sales Corporation
keywords:
- Microsoft
- M9-0002526-N
exclude_keywords:
- Already\s+paid
- Do not pay
fields:
amount: GrandTotal(\d+\.\d+)HKD
date: DocumentDate:(\d{1,2}\/\d{1,2}\/\d{4})
invoice_number: InvoiceNo.:(\w+)
options:
remove_whitespace: true
currency: HKD
Since it is used in templates already. The code does not have to be changed. The documentation could be clarified.
#576 Includes documentation improvements.
Do you have any suggestions, how it could be improved?
I am referring to the Options section (under Template Structure).
The example you give does not use required_fields, so I don't think it is relevant in this issue. The documentation suggests that the following should be a valid template:
issuer: Microsoft Regional Sales Corporation
keywords:
- Microsoft
- M9-0002526-N
exclude_keywords:
- Already\s+paid
- Do not pay
fields:
amount: GrandTotal(\d+\.\d+)HKD
date: DocumentDate:(\d{1,2}\/\d{1,2}\/\d{4})
invoice_number: InvoiceNo.:(\w+)
options:
remove_whitespace: true
currency: HKD
required_fields:
- invoice_number
However, I can't get it to work like this. Instead, the correct version seems to be:
issuer: Microsoft Regional Sales Corporation
keywords:
- Microsoft
- M9-0002526-N
exclude_keywords:
- Already\s+paid
- Do not pay
fields:
amount: GrandTotal(\d+\.\d+)HKD
date: DocumentDate:(\d{1,2}\/\d{1,2}\/\d{4})
invoice_number: InvoiceNo.:(\w+)
options:
remove_whitespace: true
currency: HKD
required_fields:
- invoice_number
To reflect this, I think the info about required fields should be in its own section and not under Options. Or at least it should be clarified that it is not be nested under options in the template.