elixir-cloud-aai / trs-filer

Lightweight, flexible Flask/Gunicorn-based GA4GH TRS implementation
Apache License 2.0
8 stars 6 forks source link

feat: add "GET .../descriptor" #66

Closed kushagra189 closed 4 years ago

kushagra189 commented 4 years ago

Resolves #25

uniqueg commented 4 years ago

Hi @kushagra189: I'm not absolutely sure myself about the PLAIN types, but I think that for the regular types (e.g., CWL) you should return the FileWrapper object as defined in the endpoint 200 response. But for the PLAIN types (e.g., PLAIN_CWL), we should just return the file contents, i.e, the value of FileWrapper.content. Similar to the discussion on the GET .../files endpoint, I think we should get file contents from downloading them from FileWrapper.url during registration if not provided in FileWrapper.content, so that we don't have to get them every time when anyone calls GET .../descriptor or GET .../files.

That being said, please DON'T implement the PLAIN types at the moment, because they will not adhere to the schema and Connexion will complain. In my opinion this is a problem in the specs - there would be a really good opportunity to actually make use of the different content types (application/json and text/plain) to define different responses for these different content types, as is possible in OpenAPI 3.0. This would also avoid having to add PLAIN_ to the type name (which is perhaps a little inelegant). At the moment, let's not deal with these complications. Eventually though, we may need to implement a custom response validator for Connexion that takes care of this problem as long as the specs are as they are (I will file an issue for that in a little while).