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
I started using Yamale in order to give more detailed error messages to users when they enter in incorrect Yaml, to help direct where the issues are. This has been an overall success, but there's still some confusion as there are more error messages than I expected.
1: Key error - 'generate_crowd_anki' is not a regex match.
1: Key error - 'generate_crowd_anki' is not a regex match.
1.generate_crowd_anki.media.bad_thing: Unexpected element
1.generate_crowd_anki.media: '{'from_notes': True, 'from_note_models': False, 'bad_thing': 'test'}' is not a bool.
Where the 3rd line is the only actual error I am interested in 😞
Why are the first two errors there? They seem to be about the other two perfectly valid list items, but only show when this one breaks 🤔
The 3rd line does not specify that it is trying to parse it as a ca_media, which could help with clarity.
Sure, Media is neither a bool or a ca_media, but the 4th line just says "Is not a bool", which is confusing. Something like "media is neither a 'ca_media' or a bool" would be technically accurate and not confusing.
Does this perhaps have something to do with my Yaml being a top level list? I ask because I had some even funkier isses in a previous version where I was not looking for specific keys in the list of dictionaries.
1.generate_crowd_anki: '{'folder': 'exports/crowdankidecks/csv_to_crowdanki1/', 'headers': 'default', 'notes': {'deck_part': 'csv_first_attempt'}, 'note_models': {'deck_parts': [{'deck_part': 'LL Noun'}, {'deck_part': 'LL Verb'}, {'deck_part': 'LL Word'}]}, 'media': {'from_notes': True, 'from_note_models': False, 'bad_thing': 'test'}}' is not a list.
1.generate_crowd_anki.folder: Unexpected element
1.generate_crowd_anki.headers: Unexpected element
1.generate_crowd_anki.media: Unexpected element
1.generate_crowd_anki.note_models: Unexpected element
1.generate_crowd_anki.notes: '{'deck_part': 'csv_first_attempt'}' is not a str.
1.generate_crowd_anki.note_model_mappings: Required field missing
1.generate_crowd_anki.file_mappings: Required field missing
1.generate_crowd_anki.media: '{'from_notes': True, 'from_note_models': False, 'bad_thing': 'test'}' is not a bool.
1.generate_crowd_anki.media.bad_thing: Unexpected element
With the error generate_crowd_anki.file_mappings: Required field missing even though that is not a value on that type of object, but one of the other ones 😱
Anyways, apologies for the data dump. Any light anyone could shed onto my issues here would be well appreciated. I simply want to check for a specific key and match that to a specific object, in a top level list. If I am doing something wrong here I'd love to hear and correct it! 😁
The text was updated successfully, but these errors were encountered:
Thanks for the detailed report. On the surface, this seems to be an error in the processing of the list validator when combined with more complex validators such as the map validator.
I started using Yamale in order to give more detailed error messages to users when they enter in incorrect Yaml, to help direct where the issues are. This has been an overall success, but there's still some confusion as there are more error messages than I expected.
Take the following example
Schema
Data
Error
Validating this gives the errors:
Where the 3rd line is the only actual error I am interested in 😞
Does this perhaps have something to do with my Yaml being a top level list? I ask because I had some even funkier isses in a previous version where I was not looking for specific keys in the list of dictionaries.
Full Schema and Yaml
Schema
Data
Which generates the errors:
With the error
generate_crowd_anki.file_mappings: Required field missing
even though that is not a value on that type of object, but one of the other ones 😱Anyways, apologies for the data dump. Any light anyone could shed onto my issues here would be well appreciated. I simply want to check for a specific key and match that to a specific object, in a top level list. If I am doing something wrong here I'd love to hear and correct it! 😁
The text was updated successfully, but these errors were encountered: