-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No check on attributes #9
Comments
This is also the case for the value of the attributes |
I believe the "lack" of a check on attributes is intentional, so that data about tracked items can be easily added under new keys without needing to wait for the tooling to update. However as noted this can cause issues when typos happen. Some thoughts on possible approaches:
It also seems possible to combine these approaches. |
Hrm, so it looks like there is a check for some properties, though only that certain mandatory ones are present: # The mandatory properties
for pname in ["labelled", "description", "value", "condition"]:
try:
setattr(self, pname, self.info[pname])
except KeyError:
raise ValueError("Part sr{} is missing '{}' property."
.format(self.code, pname)) |
My ideal solution to this would be to ship a schema within the repo and use something like Typesystem for validation. This is what SRO are planning for their asset tracker, which is heavily inspired by our tooling here. |
Nice library, shame it's Python 3.6+ though. We're (for the moment at least) somewhat tied to supporting a wider range of versions than that. |
There are a few similar libraries knocking around, not quite as nice as Typesystem though. e.g Schematics(2.7, 3.3+). We're able to get away with 3.6+ at SRO because we're introducing a web interface for it. |
There is no check on
inv-set-attr
for the spelling, or existence of an attribute. Perhaps we should define what attributes are allowed?The text was updated successfully, but these errors were encountered: