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

Move 'validate' in MosaicTilerFactory class #206

Merged
merged 1 commit into from
Feb 2, 2021
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
4 changes: 2 additions & 2 deletions tests/test_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def test_MosaicTilerFactory(set_env):
from titiler.endpoints import factory

app = factory.MosaicTilerFactory()
assert len(app.router.routes) == 19
assert len(app.router.routes) == 20
assert app.tms_dependency == WebMercatorTMSParams

app = factory.MosaicTilerFactory(add_create=False, add_update=False)
assert len(app.router.routes) == 17
assert len(app.router.routes) == 18
9 changes: 9 additions & 0 deletions titiler/endpoints/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ def register_routes(self):
self.tilejson()
self.wmts()
self.point()
self.validate()

############################################################################
# /read
Expand Down Expand Up @@ -1161,6 +1162,14 @@ def point(

return {"coordinates": [lon, lat], "values": values}

def validate(self):
"""Register /validate endpoint."""

@self.router.post("/validate")
def validate(body: MosaicJSON):
"""Validate a MosaicJSON"""
return True


@dataclass
class TMSFactory:
Expand Down
9 changes: 0 additions & 9 deletions titiler/endpoints/mosaic.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
"""TiTiler MosaicJSON Demo endpoint."""

from cogeo_mosaic.mosaic import MosaicJSON

from .factory import MosaicTilerFactory

mosaic = MosaicTilerFactory(router_prefix="mosaicjson")


@mosaic.router.post("/validate")
def mosaic_validate(body: MosaicJSON):
"""Validate a MosaicJSON"""
return True


router = mosaic.router