-
Notifications
You must be signed in to change notification settings - Fork 24
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
split OGC Features and Tiles endpoints factories #32
Conversation
"urlpath": str(request.url.path), | ||
"urlparams": str(request.url.query), | ||
}, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we create a simple function that can be used outside the factories
@abc.abstractmethod | ||
def conforms_to(self) -> List[str]: | ||
"""Endpoints conformances.""" | ||
... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
each Factory should explicitly tell what they are conform to
@bitner any of this make sense? 😄 |
tipg/main.py
Outdated
app.include_router(ogc_features.router, tags=["OGC Features API"]) | ||
|
||
ogc_tiles = OGCTilesFactory(templates=templates) | ||
app.include_router(ogc_tiles.router, tags=["OGC Tiles API"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We create the endpoints using the 2 factories
latest version of FastAPI/starlette changed something in |
This comment was marked as resolved.
This comment was marked as resolved.
supported_tms: TileMatrixSets = default_tms | ||
|
||
ogc_features: OGCFeaturesFactory = field(init=False) | ||
ogc_tiles: OGCTilesFactory = field(init=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This factory combines both OGCFeaturesFactory
and OGCTilesFactory
factories.
"""Register factory Routes.""" | ||
... | ||
|
||
def register_common_routes(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can will be reused in the 3 factories if with_common=True
is set
) | ||
|
||
return data | ||
self.router.include_router(self.ogc_features.router, tags=["OGC Features API"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we now use include_router
method (without the prefix)
) | ||
|
||
return data | ||
self.router.include_router(self.ogc_tiles.router, tags=["OGC Tiles API"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-160 lines 💥
last commit refactored a bit how we add the To Do
|
@bitner this is ready 🙏 |
tipg/factory.py
Outdated
] | ||
|
||
def register_routes(self): # noqa: C901 | ||
"""Register OGC Features endpoints.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Register OGC Tiles endpoints.""" ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬
closes #6
This PR split the endpoint factory in two:
OGCFeaturesFactory
andOGCTilesFactory
which should enable user to build either the tiles service or features service individually.The main issue is for creating the OGC features
landing
andconformances
endpoints. I've added two ways:within the
OGCFeaturesFactory
, by using thefull=True
option, this will add the/
(landing) and/conformance
endpoints but only referencing the features endpoint (no links to the Tiles endpoints).in main.py, to have both tiles and features endpoints conformances and links. It is likely that a user who will want to add both
/
(landing),/conformance
with tiles and features endpoints in it's own application will have to re-write both endpoints in its code 🤷♂️IMO it's really annoying that both
/
and/conformance
are part of the features specification 😬