Skip to content
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 POST endpoint for additional access methods to existing object #47

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

suhaspete
Copy link

@suhaspete suhaspete commented Nov 14, 2023

Description

Added a new endpoint to allow posting additional access methods to an existing DRS object.

Fixes #25

Type of change

New feature

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have not reduced the existing code coverage
  • I have added docstrings following the Python style guidelines of this project to all new modules, classes, methods and functions are documented with docstrings following; I have updated any previously existing docstrings, if applicable
  • I have updated any sections of the app's documentation that are affected by the proposed changes, if applicable

@uniqueg uniqueg self-requested a review November 15, 2023 12:29
Copy link
Member

@uniqueg uniqueg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, it's a very good start :) I have suggested some changes, mostly small.

@@ -110,6 +110,47 @@ paths:
tags:
- DRS-Filer
x-swagger-router-controller: ga4gh.drs.server
'/objects/{object_id}/access':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As briefly discussed, I'm afraid we will need to create a different endpoint here, maybe /objects/{object_id}/access:register, because in the latest versions of the DRS specification, there is (unfortunately) already a POST method defined for /objects/{object_id}/access that has a different non-REST-compliant meaning (see here).

Actually, supporting the new DRS versions will require a lot of code changes on DRS-Filer, including some breaking changes, but for now let's just focus on this issue and try to avoid conflicts in the future, when we will do the migration to the latest version.

operationId: PostObjectAccess
responses:
'201':
description: Successfully added access method.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep in the style of the other descriptions, maybe better to write:

The access method was successfully added.

@@ -110,6 +110,47 @@ paths:
tags:
- DRS-Filer
x-swagger-router-controller: ga4gh.drs.server
'/objects/{object_id}/access':
post:
summary: Add additional access method to an existing object.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an additional access method to an existing object

'/objects/{object_id}/access':
post:
summary: Add additional access method to an existing object.
operationId: PostObjectAccess
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the same reason as above, maybe it's better to write PostObjectAccessRegister here.

Comment on lines +132 to +135
'409':
description: Conflict - Object with the same ID already exists.
schema:
$ref: '#/definitions/Error'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that in a POST request the resource ID will generally be created by the implementation, it is the implementation's responsibility to ensure that this type of error does not happen. So you can remove it from the specs.

Comment on lines +548 to +550
method_id:
type: string
description: ID of the access method.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be created by the implementation/service, so no need to put it here.

@@ -501,3 +542,20 @@ definitions:
- name
tags:
- name: DataRepositoryService
AdditionalAccessMethod:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just reuse the AccessMethodRegister model/component that is already defined in this file. No need to create a new one.

name: AdditionalAccessMethod
description: Additional access method details.
schema:
$ref: '#/definitions/AdditionalAccessMethod'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use AccessMethodRegister, see below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement "POST /objects/{object_id}/access"
2 participants