Closed sneakers-the-rat closed 1 month ago
@sneakers-the-rat thank you for this!! it works perfectly. i'm going to merge now.
you are also correct there are a few please where we could impose a Literal
// set of accepted values. And also not accept a missing field such as package name and repo url (authors / maintainers too).
Fix: https://github.com/pyOpenSci/pyosMeta/issues/186
sorry this is coming so late today, i have been helping everyone else will stuff all day long and haven't even gotten to any of my own work yet lmao, but since i caused this bug i wanted to fix ASAP.
so here's fix as discussed
enum.StrEnum
) instead of aLiteral
because in the future it would be nice to be able to add annotations like the text that comes after the key in the template currently so that we can generate the review template directly from the model. It does the same thing - the pydantic model will validate and throw an error there if there's any value that isn't in that enum.get_categories
is used for parsing a regular checklist and a checklist that is effectively a key: value pair, i added akeyed
param that extracts the key.so by making the model more strict we now can make the claim that "this key will always be this value or absent" and "if the string is within the tested boundaries of the regex pattern it will be present." We need to do that for the rest of the model now too - make it reflect the contract we want to make with anyone ingesting data from our packages.yaml file: eg. currently
package_name
is optional and defaults to a blank string, but we should actually never have a review with no package name. and so on. but that's enough for this v simple lil bug