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 missing isValidNewName legacy route #8252

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Fix a bug where changing the color of a segment via the menu in the segments tab would update the segment color of the previous segment, on which the context menu was opened. [#8225](https://github.com/scalableminds/webknossos/pull/8225)
- Fix a bug where in the add remote dataset view the dataset name setting was not in sync with the datasource setting of the advanced tab making the form not submittable. [#8245](https://github.com/scalableminds/webknossos/pull/8245)
- Fix a bug when importing an NML with groups when only groups but no trees exist in an annotation. [#8176](https://github.com/scalableminds/webknossos/pull/8176)
- Added missing legacy support for `isValidNewName` route. [#8252](https://github.com/scalableminds/webknossos/pull/8252)
- Fix a bug where trying to delete a non-existing node (via the API, for example) would delete the whole active tree. [#8176](https://github.com/scalableminds/webknossos/pull/8176)
- Fix a bug where dataset uploads would fail if the organization directory on disk is missing. [#8230](https://github.com/scalableminds/webknossos/pull/8230)

Expand Down
8 changes: 8 additions & 0 deletions app/controllers/LegacyApiController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ class LegacyApiController @Inject()(annotationController: AnnotationController,

/* provide v8 */

def isValidNewNameV8(datasetName: String, organizationId: String): Action[AnyContent] = sil.SecuredAction.async {
implicit request =>
for {
_ <- Fox.successful(logVersioned(request))
result <- datasetController.isValidNewName(datasetName)(request)
} yield result
}
Comment on lines +62 to +68
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing implementations for v5-v7

The PR objective mentions testing via v7 endpoint (/api/v7/datasets/<some orga>/TestThisName/isValidNewName), but only v8 implementation is present. Implementations for v6 and v7 appear to be missing.

Add implementations for v6 and v7:

def isValidNewNameV7(datasetName: String, organizationId: String): Action[AnyContent] =
  isValidNewNameV8(datasetName, organizationId)

def isValidNewNameV6(datasetName: String, organizationId: String): Action[AnyContent] =
  isValidNewNameV8(datasetName, organizationId)


def readDatasetV8(organizationId: String, datasetName: String, sharingToken: Option[String]): Action[AnyContent] =
sil.UserAwareAction.async { implicit request =>
for {
Expand Down
4 changes: 4 additions & 0 deletions conf/webknossos.versioned.routes
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
PATCH /v8/datasets/:organizationId/:datasetName controllers.LegacyApiController.updateDatasetV8(organizationId: String, datasetName: String)
GET /v8/datasets/:organizationId/:datasetName/sharingToken controllers.LegacyApiController.getDatasetSharingTokenV8(organizationId: String, datasetName: String)
PATCH /v8/datasets/:organizationId/:datasetName/teams controllers.LegacyApiController.updateDatasetTeamsV8(organizationId: String, datasetName: String)
GET /v8/datasets/:organizationId/:datasetName/isValidNewName controllers.LegacyApiController.isValidNewNameV8(datasetName: String, organizationId: String)
GET /v8/datasets/:organizationId/:datasetName controllers.LegacyApiController.readDatasetV8(organizationId: String, datasetName: String, sharingToken: Option[String])
GET /v8/tasks/:id controllers.LegacyApiController.readTaskV8(id: String)
POST /v8/tasks controllers.LegacyApiController.createTaskV8()
Expand All @@ -33,6 +34,7 @@ GET /v8/tasks/:id/annotations co
PATCH /v7/datasets/:organizationId/:datasetName controllers.LegacyApiController.updateDatasetV8(organizationId: String, datasetName: String)
GET /v7/datasets/:organizationId/:datasetName/sharingToken controllers.LegacyApiController.getDatasetSharingTokenV8(organizationId: String, datasetName: String)
PATCH /v7/datasets/:organizationId/:datasetName/teams controllers.LegacyApiController.updateDatasetTeamsV8(organizationId: String, datasetName: String)
GET /v7/datasets/:organizationId/:datasetName/isValidNewName controllers.LegacyApiController.isValidNewNameV8(datasetName: String, organizationId: String)
GET /v7/datasets/:organizationId/:datasetName controllers.LegacyApiController.readDatasetV8(organizationId: String, datasetName: String, sharingToken: Option[String])
GET /v7/tasks/:id controllers.LegacyApiController.readTaskV8(id: String)
POST /v7/tasks controllers.LegacyApiController.createTaskV8()
Expand All @@ -50,6 +52,7 @@ GET /v7/datasets co
PATCH /v6/datasets/:organizationId/:datasetName controllers.LegacyApiController.updateDatasetV8(organizationId: String, datasetName: String)
GET /v6/datasets/:organizationId/:datasetName/sharingToken controllers.LegacyApiController.getDatasetSharingTokenV8(organizationId: String, datasetName: String)
PATCH /v6/datasets/:organizationId/:datasetName/teams controllers.LegacyApiController.updateDatasetTeamsV8(organizationId: String, datasetName: String)
GET /v6/datasets/:organizationId/:datasetName/isValidNewName controllers.LegacyApiController.isValidNewNameV8(datasetName: String, organizationId: String)
GET /v6/tasks/:id controllers.LegacyApiController.readTaskV8(id: String)
POST /v6/tasks controllers.LegacyApiController.createTaskV8()
PUT /v6/tasks/:id controllers.LegacyApiController.updateTaskV8(id: String)
Expand All @@ -69,6 +72,7 @@ GET /v6/datasets/:organizationName/:datasetName co
PATCH /v5/datasets/:organizationId/:datasetName controllers.LegacyApiController.updateDatasetV8(organizationId: String, datasetName: String)
GET /v5/datasets/:organizationId/:datasetName/sharingToken controllers.LegacyApiController.getDatasetSharingTokenV8(organizationId: String, datasetName: String)
PATCH /v5/datasets/:organizationId/:datasetName/teams controllers.LegacyApiController.updateDatasetTeamsV8(organizationId: String, datasetName: String)
GET /v5/datasets/:organizationId/:datasetName/isValidNewName controllers.LegacyApiController.isValidNewNameV8(datasetName: String, organizationId: String)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Inconsistent parameter naming between v5 routes.

There's an inconsistency in parameter naming between the new v5 route and the existing v5 route:

  • New route (L75): Uses organizationId
  • Existing route (L89): Uses organizationName

This might cause confusion for API consumers using v5.

Consider using consistent parameter naming within the same API version. Either:

  1. Update the new v5 route to use organizationName to match the existing pattern:
-GET      /v5/datasets/:organizationId/:datasetName/isValidNewName             controllers.LegacyApiController.isValidNewNameV8(datasetName: String, organizationId: String)
+GET      /v5/datasets/:organizationName/:datasetName/isValidNewName           controllers.LegacyApiController.isValidNewNameV8(datasetName: String, organizationName: String)
  1. Or document the difference in the version changelog if this is intentional.

Also applies to: 89-89

GET /v5/tasks/:id controllers.LegacyApiController.readTaskV8(id: String)
POST /v5/tasks controllers.LegacyApiController.createTaskV8()
PUT /v5/tasks/:id controllers.LegacyApiController.updateTaskV8(id: String)
Expand Down