-
-
Notifications
You must be signed in to change notification settings - Fork 62
OPDS feed with partial entries #602
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #602 +/- ##
==========================================
+ Coverage 65.82% 66.10% +0.28%
==========================================
Files 53 53
Lines 3783 3815 +32
Branches 1906 1927 +21
==========================================
+ Hits 2490 2522 +32
Misses 1291 1291
Partials 2 2
Continue to review full report at Codecov.
|
34754e2
to
a08636d
Compare
@veloman-yunkan Should we remove the WIP in the topic of the PR? |
@Kelson When I changed the status of this PR from Draft to Ready the meaning of WIP changed from "Work In Progress" to "Want It Peer-reviewed" 😃 . But since it can be confusing, I guess we indeed better drop that abbreviation from the title. I already did. |
@veloman-yunkan OK, just put a small comment helps in such case to avoid confusion. |
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.
Nothing to say on the code itself. It is good.
But I'm not sure about the provided API :
- As said in the review comment, I understand from the spec that we should have a endpoint which return the full entry xml.
- So we should probably have a
catalog/v2/entry
endpoint for one entry (in opposition tocatalog/v2/entries
which list entries, potentially only one complete entry).
https://specs.opds.io/opds-1.2#512-partial-and-complete-catalog-entries says that we should have atom:category
, atom:contributor
, atom:rights
, opds:price
. It make no really sense to have these in our use case. But maybe we could add more information than the id
in the partial feed. At least the updated
node to allow client if the entry has been updated since last time it get the entry information. Maybe the name
could also be useful.
I'm also a bit afraid that the mustache template become a bit to complex
with all the conditional part. But it can be easily fixed by using two template if it appears it is too complex to maintain. So no problem here for now.
test/server.cpp
Outdated
const auto r = zfs1_->GET("/catalog/v2/entries/raycharles"); | ||
EXPECT_EQ(r->status, 200); | ||
EXPECT_EQ(maskVariableOPDSFeedData(r->body), | ||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | ||
"<feed xmlns=\"http://www.w3.org/2005/Atom\"\n" | ||
" xmlns:opds=\"https://specs.opds.io/opds-1.2\"\n" | ||
" xmlns:opensearch=\"http://a9.com/-/spec/opensearch/1.1/\">\n" | ||
" <id>12345678-90ab-cdef-1234-567890abcdef</id>\n" | ||
"\n" | ||
" <link rel=\"self\"\n" | ||
" href=\"/catalog/v2/entries/raycharles\"\n" | ||
" type=\"application/atom+xml;profile=opds-catalog;kind=acquisition\"/>\n" | ||
" <link rel=\"start\"\n" | ||
" href=\"/catalog/v2/root.xml\"\n" | ||
" type=\"application/atom+xml;profile=opds-catalog;kind=navigation\"/>\n" | ||
" <link rel=\"up\"\n" | ||
" href=\"/catalog/v2/entries\"\n" | ||
" type=\"application/atom+xml;profile=opds-catalog;kind=acquisition\"/>\n" | ||
"\n" | ||
" <title>Single Entry</title>\n" | ||
" <updated>YYYY-MM-DDThh:mm:ssZ</updated>\n" | ||
"\n" | ||
RAY_CHARLES_CATALOG_ENTRY | ||
"</feed>\n" | ||
); |
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'm not sure this is the right format.
The spec about partial entries (https://specs.opds.io/opds-1.2#512-partial-and-complete-catalog-entries) is not explicit about this so I may wrongly interpret this.
But understand that the entry/foo
endpoint should return only the entry part not the a feed containing a complete entry.
"Complete Catalog Entry" in the example would be the full content returned by the endpoint. Not the entry to put in the feed. (Where "Partial Catalog Entry" show a entry to put in the feed as it is explicitly say)
In https://specs.opds.io/opds-1.2#7-discovering-opds-catalogs they say that links may reference entries or feed. Which seems to indicate that entry are not put in feed.
And in https://specs.opds.io/opds-1.2#712-the-opds-catalog-profile-parameter, the fact we must give the profile seems to imply we could use a generic endpoint which could return the entry in another format that opds if we don't provide the profile.
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.
Good catch. You are right, complete entries can be served as separate XML (non-feed) documents.
test/server.cpp
Outdated
@@ -735,7 +735,7 @@ TEST_F(LibraryServerTest, catalog_search_by_phrase) | |||
EXPECT_EQ(maskVariableOPDSFeedData(r->body), | |||
OPDS_FEED_TAG | |||
" <id>12345678-90ab-cdef-1234-567890abcdef</id>\n" | |||
" <title>Filtered zims (q="ray charles")</title>\n" | |||
" <title>Filtered zims (?q="ray charles")</title>\n" |
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.
Do we really want this change ?
(But not sure it is really important, we don't use the feed title)
test/server.cpp
Outdated
" <link rel=\"alternate\"\n" | ||
" href=\"/catalog/v2/entries/raycharles_uncategorized\"\n" | ||
" type=\"application/atom+xml;type=entry;profile=opds-catalog\"\n" | ||
" title=\"Ray (uncategorized) Charles\"/>\n" |
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'm a bit disturb by this attribute here, I would have put the title as a node in the entry
.
But it is what we have in the example in the spec 🤷🏽♂️
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.
Added the <title>
node without removing the title
attribute from the link node. In the example, the latter is used to make it explicit that the link leads to the complete entry (note the word "Complete" in the title). I think it's safe to drop the title attribute from <link rel="alternate">
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.
Yes, we can remove the title from the link. It is a duplicated value and it is better in a <title>
node.
Done. But I don't like that a complete entry document (which is now not a feed document anymore) is still produced by
Now including
I had the same concerns. This PR definitely needs to be cleaned up. I will do it once we agree that the API and the output format are good. |
Yes, it should be done in another method.
With the new "single_entry_mode" it is even worth.
I agree with the output format (assuming we remove the title from the link) and the API. I wonder if we could homogenize a bit the code with But having a unique "dumper" is probably not for this PR. (If you have a idea for the parsing side, I'm a bit disturbed by the idea of a |
@veloman-yunkan Any news on this PR? |
3b7e485
to
37e988e
Compare
@mgautierfr The PR has been cleaned up |
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.
We are globally good here.
My two comments are somehow a nice to have but not mandatory (and the second may be a bit tricky to implement).
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.
Two small easy fixes and we are good.
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.
We are good !
Please rebase-fixup on last master and we merge.
Deduplicated the mustache templates static/templates/catalog_v2_entries.xml and static/templates/catalog_v2_complete_entry.xml (the latter was renamed to static/templates/catalog_v2_entry.xml).
217cedf
to
c0bda42
Compare
Done |
Fixes #209
Things to note:
urn:uuid:
prefix must not be included.