-
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 /links #95
Add /links #95
Conversation
Since map_back is the same for several endpoints, it has been moved to ResourceMapper and will only be modified (at this point) for the /links endpoint mapper.
TODO: Turn providers.json into proper MongoDB entries
Codecov Report
@@ Coverage Diff @@
## master #95 +/- ##
==========================================
- Coverage 85.74% 84.99% -0.76%
==========================================
Files 38 39 +1
Lines 2315 2352 +37
==========================================
+ Hits 1985 1999 +14
- Misses 330 353 +23
Continue to review full report at Codecov.
|
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! LGTM but made a few comments below.
def get_links(request: Request, params: EntryListingQueryParams = Depends()): | ||
for str_param in ["filter", "sort"]: | ||
if getattr(params, str_param): | ||
setattr(params, str_param, "") | ||
for int_param in [ | ||
"page_offset", | ||
"page_page", | ||
"page_cursor", | ||
"page_above", | ||
"page_below", | ||
]: | ||
if getattr(params, int_param): | ||
setattr(params, int_param, 0) | ||
params.page_limit = CONFIG.page_limit | ||
return u.get_entries(links, LinksResponse, request, params) |
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.
Looks like you ran into the same problems as me, there must be a better way of doing this!
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.
I think there is in pydantic
v1 maybe? Here's hoping.
I've just added two validator changes to this PR: one that checks the new links endpoint, and one minor change that stops the validator from failing if there are no references in the database. |
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 , looks good. I'll accept and let you merge, could you just clarify what the new local_index_openapi.json
is for?
Better documentation of `map_back` and _only_ use `task_id` for structures ids.
21752a7
to
8ce3e80
Compare
This should not have been in this PR and has now been removed. It's purpose is for the upcoming "extra" server, serving the index meta-database. A PR will be created for this after this and #99 have been merged. |
Closes #89
Several things are happening here:
map_back
in the parent class. This should provide an idea of going forward and perhaps removing the sub-classed mappers or similar./links
endpoint with a pseudoindex
parent implementation and all the providers fromproviders.json
.Comments:
I am unsure on how to treat the
/links
endpoint concerning whether/links/{entry_id}
is valid. And why is it demanded that only theSingleEntryQueryParams
are valid query parameters for the endpoint, (see here)?I think some of these questions should be put to the consortium and changes should be suggested to the spec.
Missing:/links
endpoint. (Added by @ml-evs)