locdb / locdb-frend

Fr(ont-)end for the Linked Open Citation Database.
https://locdb.github.io
GNU General Public License v3.0
6 stars 2 forks source link

external Suggestion return type mismatch #267

Closed lgalke closed 6 years ago

lgalke commented 6 years ago

External suggestions does not return the type advertised on Swagger:

[
  {
    "_id": "string",
    "journal_identifiers": [
      {
        "literalValue": "string",
        "scheme": "string"
      }
    ],
[...]

Instead, we receive:

[[{"journalArticle_identifiers":[{"literalValue":"10.1177/0267323190005002006","scheme":"DOI"},{"literalValue":"http://dx.doi.org/10.1177/0267323190005002006","scheme":"URL_CROSSREF"}],"type":"JOURNAL_ARTICLE","journalArticle_title":"Culture and Communication: Towards an Ethnographic Critique of Media Consumption in the Transnational Media System","journalArticle_subtitle":"","journalArticle_contributors":[{"roleType":"AUTHOR","heldBy":{"givenName":"Ien","familyName":"Ang"}},{"roleType":"PUBLISHER","heldBy":{"nameString":"SAGE Publications"}}],"journalArticle_publicationDate":"1990-01-01T00:00:00.000Z","status":"EXTERNAL","parts":[{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Anderson, Benedict"],"title":"Imagined Communities","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Ang, Ien"],"title":"Watching Dallas","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Ang, Ien"],"title":"Remote Control: Television, Audiences and Cultural Power","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"literalValue":"10.1080/09502388900490091","scheme":"DOI"}],"ocrData":{"authors":[""],"title":"","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Bennett, Tony"],"title":"Popular Culture and Social Relations","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Blumler, Jay G."],"title":"Media Gratifications Research: Current Perspectives","date":"","comments":"First page: 255","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Branegan, Jay"],"title":"","date":"1989","comments":"","journal":"Time","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Certeau, Michel de"],"title":"The Practice of Everyday Life","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Elliott, Philip"],"title":"The Uses of Mass Communications","date":"","comments":"First page: 249","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Fiske, John"],"title":"Channels of Discourse","date":"","comments":"First page: 254","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Fiske, John"],"title":"Television Culture","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Geertz, Clifford"],"title":"Local Knowledge","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Gellner, Ernest"],"title":"Nations and Nationalism","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"literalValue":"10.1080/09502388900490151","scheme":"DOI"}],"ocrData":{"authors":[""],"title":"","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Goldstein, Carl"],"title":"","date":"1989","comments":"First page: 60","journal":"Far Eastern Economic Review","volume":""},"status":"EXTERNAL"},{"identifiers":[{"literalValue":"10.1080/09502388900490131","scheme":"DOI"}],"ocrData":{"authors":[""],"title":"","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Grossberg, Lawrence"],"title":"Communications in Transition","date":"","comments":"First page: 39","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"literalValue":"10.1177/019685998601000204","scheme":"DOI"}],"ocrData":{"authors":[""],"title":"","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Grossberg, Lawrence"],"title":"It's A Sin. Essays on Postmodernism, Politics and Culture","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Hall, Stuart"],"title":"Culture, Media, Language","date":"","comments":"First page: 128","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Hall, Stuart"],"title":"Culture, Society, and the Media","date":"","comments":"First page: 56","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Hall, Stuart"],"title":"Culture, Media, Language","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Hall, Stuart"],"title":"Resistance Through Rituals","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Hamelink, Cees"],"title":"Cultural Autonomy in Global Communications","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Hardt, Hanno"],"title":"Communication Yearbook","date":"","comments":"First page: 558","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Hebdige, Dick"],"title":"Subculture: The Meaning of Style","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Higgins, John"],"title":"Postmodernism and Politics","date":"","comments":"First page: 112","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Lull, James"],"title":"World Families Watch Television","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Lyotard, Jean-François"],"title":"The Postmodern Condition","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Marcus, George E."],"title":"Writing Culture","date":"","comments":"First page: 165","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Marcus, George E."],"title":"Anthropology as Cultural Critique","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"literalValue":"10.1177/016344388010004004","scheme":"DOI"}],"ocrData":{"authors":[""],"title":"","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Modleski, Tania"],"title":"Studies in Entertainment","date":"","comments":"First page: ix","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Morley, David"],"title":"The `Nationwide' Audience","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Morley, David"],"title":"Family Television: Cultural Power and Domestic Leisure","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Morley, David"],"title":"","date":"1990","comments":"","journal":"Screen","volume":"30"},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Morris, Meaghan"],"title":"","date":"1988","comments":"First page: 15","journal":"Block","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Pratt, Mary Louise"],"title":"Postmodernism and Politics","date":"","comments":"First page: 26","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Radway, Janice"],"title":"Reading the Romance","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"literalValue":"10.1080/09502388800490231","scheme":"DOI"}],"ocrData":{"authors":[""],"title":"","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Real, Michael"],"title":"Super Media: A Cultural Studies Approach","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"literalValue":"10.1080/09502388900490101","scheme":"DOI"}],"ocrData":{"authors":[""],"title":"","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Rorty, Richard"],"title":"Contingency, Irony and Solidarity","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Rosengren, Karl Erik"],"title":"The Study of Media Culture: Ideas, Actions, and Artefact","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Ross, Andrew"],"title":"Universal Abandon? The Politics of Postmodernism","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Said, Edward"],"title":"Orientalism","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"literalValue":"10.1177/053901887026002001","scheme":"DOI"}],"ocrData":{"authors":[""],"title":"","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"literalValue":"10.1177/0267323187002001002","scheme":"DOI"}],"ocrData":{"authors":[""],"title":"","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"literalValue":"10.1080/15295038709360112","scheme":"DOI"}],"ocrData":{"authors":[""],"title":"","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Silj, Alessandro"],"title":"East of Dallas. The European Challenge to American Television","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"literalValue":"10.7208/chicago/9780226849638.001.0001","scheme":"DOI"}],"ocrData":{"authors":["Van Maanen, John"],"title":"Tales of the Field","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"},{"identifiers":[{"scheme":"DOI"}],"ocrData":{"authors":["Willis, Paul"],"title":"Learning to Labour","date":"","comments":"","journal":"","volume":""},"status":"EXTERNAL"}],"journalArticle_embodiedAs":[{"firstPage":239,"lastPage":260}],"source":"CROSSREF"},{"journal_identifiers":[{"literalValue":"0267-3231","scheme":"ISSN"},{"literalValue":"1460-3705","scheme":"ISSN"}],"type":"JOURNAL_ISSUE","journal_title":"European Journal of Communication","journalVolume_number":"5","journalIssue_number":"2","journalIssue_contributors":[{"roleType":"PUBLISHER","heldBy":{"nameString":"SAGE Publications"}}],"status":"EXTERNAL","source":"CROSSREF"}]]

So we get a list of lists of suggestions instead of a list of suggestions. For the internal suggestions we get a plain list as advertised on Swagger.

Is this behaviour intended? If yes, please update Swagger specifications @anlausch

Thanks in advance, hope we bother you not too much.

anlausch commented 6 years ago

This behavior is intended and should be the same for the internal suggestions too (in order to be able to show also the meta data of the parent resource to the user). I updated the specifications and the internal suggestions accordingly. Let me know if there is a problem. https://github.com/locdb/loc-db/commit/f218904b88f497be31b20b96d4557b43ad0e029c

lgalke commented 6 years ago

Thanks!

lgalke commented 6 years ago

Re-open because we still need to do two things in the front-end:

lgalke commented 6 years ago

Can we assume that there are always two entries in the sublist? Like [ [parent1, child1], [parent1,child2] , [parent3, child3] ] or how does it work exactly? What happens if some resource does not have a parent? Do you put null as parent or as child?

Would be helpful to know @anlausch

lgalke commented 6 years ago

Just for the record: It is either [parent, child] or [child]... We convert for more consistent front-end use to [parent, child] | [null, child].