-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add model validators and regexp for chemical formulae fields #547
Conversation
Have just discovered that all of our test data has the wrong element ordering for |
4326a16
to
235271d
Compare
Codecov Report
@@ Coverage Diff @@
## master #547 +/- ##
==========================================
+ Coverage 91.67% 91.77% +0.10%
==========================================
Files 62 62
Lines 3182 3221 +39
==========================================
+ Hits 2917 2956 +39
Misses 265 265
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
235271d
to
0d13b74
Compare
I think that's caught them all now... |
0d13b74
to
1e9e387
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @ml-evs !
This is some of the more intricate stuff that hasn't been fully specified in the specification, only in a human-readable way, so we might want to contribute some of this back to the specification. I'm thinking specifically of the regex.
I've put in some requested changes, suggested changes, observations, and other comments :)
d622806
to
50c7913
Compare
From a resolved suggestion above:
|
f158311
to
3dcc5bc
Compare
I think that's dealt with everything, except my question above (which is for another PR). Are we happy to add the regexp to our OpenAPI specification for now, but potentially demote it down to a validator property pending the meeting next week? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only minor changes. Thanks @ml-evs.
Also, the changes in this PR introduces a lot of |
|
Right. It just seems 6 new lines are missed for the |
Ah, those are the checks that aren't triggered as they are already caught by the overall field regexp. How much do we want to placate the coverage gods? |
So what you're saying is that they are now never reached?... :) |
Well, the checks themselves are, if they raise an error then we can diagnose any future problems that we have introduced into the regexp. Equally, if we decide tomorrow that we shouldn't include the regexp in the schema, then we'll have to rely on these checks again (or at least stop fastapi from putting the regexp in the schema itself) |
Personally, I'd prefer the cleaner option; to cut away the fat/non-used code. |
Understood; let's park this until the meeting tomorrow, in case they don't like the regexp.
|
In the OPTIMADE meeting today it was agreed that putting the chemical formula regexp into the schema is good, so we can proceed here and remove the extra validators that never fail. The discussion also included the possibility of expanding the regexp to also check for element symbols. |
824e2ba
to
e011f28
Compare
408b8a6
to
87a1da5
Compare
6df223c
to
b491698
Compare
Regexp has been left in, any validators added by this PR that were not being hit were either removed or tests were added to hit them. Should be good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good on my part.
I still did a few suggestions, but they are not worth not approving for :)
8cd476a
to
0ed2f49
Compare
Closes #546 by adding validators and regexps to the
chemical_formula_*
OPTIMADE fields.