imeji-community / imeji

imeji source code can now be found on https://github.com/MPDL/imeji.
https://github.com/MPDL/imeji
13 stars 15 forks source link

API: creating a collection seems to require specifying an author #1045

Closed xrotwang closed 9 years ago

xrotwang commented 9 years ago

I just ran into this error:

{
  "error" : {
    "code" : "1400",
    "title" : "Bad Request",
    "message" : "1400-message",
    "exceptionReport" : "error_collection_need_one_author"
  }
}

This seems to be a new requirement, which I think is unnecessary. Why does a collection need an author, if it has a creator anyway?

natasab commented 9 years ago

Creator of the collection is user who created the collection. This is not necessarily the author of collection. Imeji web application imposes the same condition.

xrotwang commented 9 years ago

So why does the imeji web application require an author? There seems to be no logic tied to this, since many legacy collections in the system seem to work fine without an author.

natasab commented 9 years ago

Collection is a form of a research data resource. An author of the collection (who may be different from creator) must be provided as minimal provenance information. Which legacy collections do not have an author?

xrotwang commented 9 years ago

The collections created on the dev instance before the API required an author, e.g.: http://dev-faces.mpdl.mpg.de:80/imeji/rest/collections/sd65bpoN2rckNhK I also remember seeing some collections which had contributors, but none with role author.

I understand that provenance information must be provided, but why not simply assume the creator to be the author if not specified otherwise? I.e. why not leave the simplest case as simple as possibe?

When reverse engineering the required information, I found that an author does also need at least one organization with a name. Is this also a must?

natasab commented 9 years ago

I see, dev-faces collections created at the time were obviously created before the validation was enforced via the REST API (in order to be consistent with the logic of the web app). One should ignore them.

The collection validation rules are here: https://github.com/MPDL-Innovations/imeji/blob/develop/src/main/java/de/mpg/imeji/logic/controller/CollectionController.java

look for method named validateCollection

xrotwang commented 9 years ago

My point about the existing collections without author was only, that since the app doesn't break, there seems to be no logic relying on an author to be specified; thus relaxing this requirement wouldn't break existing code, right?

But what about interpreting the creator as author in case no author is specified in the metadata? This seems to be me prefereable to collections with

"contributors": [{
    "familyName": "none", 
    "role": "author",
    "organizations": [{"name": "none"}]
}]

My whole argument is to make the simple case as simple as possible.

natasab commented 9 years ago

This can be done for sure.

xrotwang commented 9 years ago

@natasab You mean dropping the requirement to specify an author? This would be appreciated. I also think that this is an issue of data curation policy and not something that should/could be meaningfully enforced by the system.

natasab commented 9 years ago

What I meant is to specify the user creator as author (in case author is not provided) as default.

xrotwang commented 9 years ago

Ah. What I meant was that I wouldn't specify an author, and the system would then treat the creator as author. See, the server has all the information necessary to do so, whereas the client library only knows a username.

natasab commented 9 years ago

I meant the same as well :)