-
Notifications
You must be signed in to change notification settings - Fork 44
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 references endpoint #78
Conversation
Also update provider information in meta to align with providers.json on Materials-Consortia/OPTiMaDe on github.com
Moved all utility functions used by the server in main.py into utils.py. Abstracted some things away to utility functions and BaseClassres, in order to easier create new entry endpoints. Added /references, /references/{entry_id}, and /info/references to the validator.
1276fea
to
e948504
Compare
Codecov Report
@@ Coverage Diff @@
## master #78 +/- ##
==========================================
+ Coverage 84.36% 85.08% +0.71%
==========================================
Files 35 38 +3
Lines 2111 2212 +101
==========================================
+ Hits 1781 1882 +101
Misses 330 330
Continue to review full report at Codecov.
|
e948504
to
6ac75e1
Compare
In order for openapi.json to include the StructureResource and ReferenceResource, the specific resource response models are needed.
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.
Thanks for this @CasperWA, merge when you're happy.
LGTM after testing locally (and adding a few extra endpoint tests), can't see anything worth changing in the code :)
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.
Thanks @CasperWA, still LGTM, I'm going to quickly add the relationship from the test structures to this reference and add tests for that machinery.
If it's okay with you, I'd rather just merge this and then do relationships in another PR, unless you think it will be short and painful? |
Yeah that's fair enough, I have something nearly working but its worth scrutiny as a new PR. |
Closes #69
Closes #70
Short description
This PR adds the
/references
endpoint (as well as/info/references
and/references/{entry_id}
) to the server.Additional changes
Changes made in order to ease the incorporation of
references
, and in the future, more entry endpoints:StructureResponseMany
andStructureResponseOne
have been renamed toEntryResponseMany
andEntryResponseOne
. The resource model used is theEntryResource
, so new entry resource models must subclass this resource.Validator*Response
, where * is any entry resource, since the validator has to check whether an endpoint then also produces the correct resources. ThereforeValidatorReferenceResponseMany
andValidatorReferenceResponseOne
have been added.EntryCollection
andMongoCollection
to be mapper agnostic, i.e., pass a specific mapper class, when initializing a collection.ResourceMapper
that contains the generally used class methods.StructureMapper
now subclasses this class.ReferenceMapper
. As of now, it is basically a complete copy ofStructureMapper
, barring some structure-specific lines inStructureMapper
.test_references.json
with a single reference. For now, this reference matches the example from the spec (see here).Other "minor" changes:
CONFIG.provider
as a dictionary.providers.json
in the OPTiMaDe repository (here)main.py
intoutils.py
and clean upmain.py
.optimade_validator
tool has had its verbosity set to a default of 1 (it was 0).