Commit c97a6bc
Fix OKHManifest.from_dict crashing on string items in list fields
Two list fields accepted strings in practice but the parser called
.get() on each item unconditionally, raising AttributeError and
producing an unactionable "Failed to parse content as OKHManifest:
'str' object has no attribute 'get'" error in both validate and fix.
making_instructions / design_files / manufacturing_files etc.:
A plain string (e.g. an instruction step like "Heat oven to 350°F")
is now coerced into a DocumentRef(title=<string>, path="", type=<field type>).
The default doc type is now field-specific (making-instructions,
operating-instructions, etc.) rather than always falling back to
design-files.
standards_used:
A plain string (e.g. "CC0-1.0") is coerced into
Standard(standard_title=<string>).
Both cases now also raise a clear ValueError naming the offending
field and received type when an item is neither str nor dict.
materials already handled strings; this brings the other list fields
in line with that pattern.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 13b9897 commit c97a6bc
1 file changed
Lines changed: 46 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | | - | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
844 | 845 | | |
845 | 846 | | |
846 | 847 | | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
855 | | - | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
856 | 870 | | |
857 | 871 | | |
858 | 872 | | |
| |||
955 | 969 | | |
956 | 970 | | |
957 | 971 | | |
958 | | - | |
959 | | - | |
960 | | - | |
961 | | - | |
962 | | - | |
963 | | - | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
964 | 987 | | |
965 | 988 | | |
966 | 989 | | |
| |||
0 commit comments