Skip to content

Commit

Permalink
Remove deprecated workspace-related endpoints which did not include `…
Browse files Browse the repository at this point in the history
…/workspaces` in their path
  • Loading branch information
index-git committed Jan 8, 2025
1 parent 04f691a commit 1a2ef3b
Show file tree
Hide file tree
Showing 16 changed files with 4 additions and 126 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- key `db_table` was removed from GET [Workspace Layer](doc/rest.md#get-workspace-layer) response
- key `data`.`layman`.`last-migration` was removed from [GET Version](doc/rest.md#get-version) response
- body parameter `sld` was removed from [POST Workspace Publications](doc/rest.md#post-workspace-layers) and [PATCH Workspace Publication](doc/rest.md#patch-workspace-layer)
- workspace-related endpoints which did not include `/workspaces` in their path were removed
- [#1028](https://github.com/LayerManager/layman/issues/1028) Upgrade Node.js of Laymen Test Client from v18 to v22 and dependencies:
- eslint-config-next 13 -> 14
- next 13 -> 14
Expand Down
2 changes: 0 additions & 2 deletions doc/rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
- **workspace_name**, string `^[a-z][a-z0-9]*(_[a-z0-9]+)*$`
- string identifying [workspace](models.md#workspace)

**_NOTE:_** Before version 1.10.0, workspace-related endpoints did not include `/workspaces` in their path. These old endpoints are still functional, but deprecated. More specifically, they return HTTP header **Deprecation**. If you get such header in response, rewrite your client to use new endpoint path. Old endpoints will stop working in the next major release.

## Publications
### URL
`/rest/publications`
Expand Down
1 change: 0 additions & 1 deletion src/layman/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

for bp in get_workspace_blueprints():
app.register_blueprint(bp, url_prefix=f'/rest/{settings.REST_WORKSPACES_PREFIX}/<workspace>')
app.register_blueprint(bp, url_prefix='/rest/<workspace>', name=bp.name + '_deprecated')

for bp in get_blueprints():
app.register_blueprint(bp, url_prefix=f'/rest')
Expand Down
6 changes: 0 additions & 6 deletions src/layman/layer/rest_workspace_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ def before_request():
pass


@bp.after_request
def after_request(response):
layman_util.check_deprecated_url(response)
return response


@bp.route(f"/{LAYER_REST_PATH_NAME}/<layername>", methods=['GET'])
def get(workspace, layername):
# pylint: disable=unused-argument
Expand Down
8 changes: 1 addition & 7 deletions src/layman/layer/rest_workspace_layer_chunk.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from flask import Blueprint, jsonify, request, current_app as app, g

from layman import LaymanError, util as layman_util
from layman import LaymanError
from layman.util import check_workspace_name_decorator
from layman.authn import authenticate
from layman.authz import authorize_workspace_publications_decorator
Expand All @@ -19,12 +19,6 @@ def before_request():
pass


@bp.after_request
def after_request(response):
layman_util.check_deprecated_url(response)
return response


@bp.route(f"/{LAYER_REST_PATH_NAME}/<layername>/chunk", methods=['POST'])
def post(workspace, layername):
app.logger.info(f"POST Layer Chunk, actor={g.user}")
Expand Down
6 changes: 0 additions & 6 deletions src/layman/layer/rest_workspace_layer_metadata_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ def before_request():
pass


@bp.after_request
def after_request(response):
layman_util.check_deprecated_url(response)
return response


@bp.route(f"/{LAYER_REST_PATH_NAME}/<layername>/metadata-comparison", methods=['GET'])
def get(workspace, layername):
app.logger.info(f"GET Layer Metadata Comparison, actor={g.user}")
Expand Down
6 changes: 0 additions & 6 deletions src/layman/layer/rest_workspace_layer_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ def before_request():
pass


@bp.after_request
def after_request(response):
layman_util.check_deprecated_url(response)
return response


@bp.route(f"/{LAYER_REST_PATH_NAME}/<layername>/style", methods=['GET'])
def get(workspace, layername):
app.logger.info(f"GET Style, actor={g.user}, workspace={workspace}, layername={layername}")
Expand Down
8 changes: 1 addition & 7 deletions src/layman/layer/rest_workspace_layer_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from flask import Blueprint, send_file, current_app as app, g

from layman.common.filesystem.util import get_workspace_dir
from layman import LaymanError, util as layman_util
from layman import LaymanError
from layman.util import check_workspace_name_decorator
from layman.authn import authenticate
from layman.authz import authorize_workspace_publications_decorator
Expand All @@ -22,12 +22,6 @@ def before_request():
pass


@bp.after_request
def after_request(response):
layman_util.check_deprecated_url(response)
return response


@bp.route(f"/{LAYER_REST_PATH_NAME}/<layername>/thumbnail", methods=['GET'])
def get(workspace, layername):
app.logger.info(f"GET Layer Thumbnail, actor={g.user}")
Expand Down
6 changes: 0 additions & 6 deletions src/layman/layer/rest_workspace_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ def before_request():
pass


@bp.after_request
def after_request(response):
layman_util.check_deprecated_url(response)
return response


@bp.route(f"/{LAYER_REST_PATH_NAME}", methods=['GET'])
def get(workspace):
app.logger.info(f"GET Layers, actor={g.user}")
Expand Down
6 changes: 0 additions & 6 deletions src/layman/map/rest_workspace_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ def before_request():
pass


@bp.after_request
def after_request(response):
layman_util.check_deprecated_url(response)
return response


@bp.route(f"/{MAP_REST_PATH_NAME}/<mapname>", methods=['GET'])
def get(workspace, mapname):
# pylint: disable=unused-argument
Expand Down
6 changes: 0 additions & 6 deletions src/layman/map/rest_workspace_map_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ def before_request():
pass


@bp.after_request
def after_request(response):
layman_util.check_deprecated_url(response)
return response


@bp.route(f"/{MAP_REST_PATH_NAME}/<mapname>/file", methods=['GET'])
def get(workspace, mapname):
app.logger.info(f"GET Map File, actor={g.user}")
Expand Down
6 changes: 0 additions & 6 deletions src/layman/map/rest_workspace_map_metadata_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ def before_request():
pass


@bp.after_request
def after_request(response):
layman_util.check_deprecated_url(response)
return response


@bp.route(f"/{MAP_REST_PATH_NAME}/<mapname>/metadata-comparison", methods=['GET'])
def get(workspace, mapname):
app.logger.info(f"GET Map Metadata Comparison, actor={g.user}")
Expand Down
8 changes: 1 addition & 7 deletions src/layman/map/rest_workspace_map_thumbnail.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from flask import Blueprint, send_file, current_app as app, g

from layman import LaymanError, util as layman_util
from layman import LaymanError
from layman.util import check_workspace_name_decorator
from layman.authn import authenticate
from layman.authz import authorize_workspace_publications_decorator
Expand All @@ -21,12 +21,6 @@ def before_request():
pass


@bp.after_request
def after_request(response):
layman_util.check_deprecated_url(response)
return response


@bp.route(f"/{MAP_REST_PATH_NAME}/<mapname>/thumbnail", methods=['GET'])
def get(workspace, mapname):
app.logger.info(f"GET Map Thumbnail, actor={g.user}")
Expand Down
6 changes: 0 additions & 6 deletions src/layman/map/rest_workspace_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ def before_request():
pass


@bp.after_request
def after_request(response):
layman_util.check_deprecated_url(response)
return response


@bp.route(f"/{MAP_REST_PATH_NAME}", methods=['GET'])
def get(workspace):
app.logger.info(f"GET Maps, actor={g.user}")
Expand Down
46 changes: 0 additions & 46 deletions src/layman/rest_deprecated_test.py

This file was deleted.

8 changes: 0 additions & 8 deletions src/layman/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,6 @@ def to_safe_names(unsafe_names, type_name):
return values


def check_deprecated_url(response):
regexp = rf'^/rest/{settings.REST_WORKSPACES_PREFIX}\b.*$'
if not re.match(regexp, request.path):
response.headers['Deprecation'] = 'version=v2'
response.headers['Link'] = f'<{request.url.replace("/rest/",f"/rest/{settings.REST_WORKSPACES_PREFIX}/")}>; rel="alternate"'
return response


def check_workspace_name_decorator(func):
@wraps(func)
def decorated_function(*args, **kwargs):
Expand Down

0 comments on commit 1a2ef3b

Please sign in to comment.