Skip to content

Commit

Permalink
Merge pull request #153 from developmentseed/patch/add-tags-to-routes
Browse files Browse the repository at this point in the history
Patch/add tags to routes
  • Loading branch information
vincentsarago authored Dec 20, 2023
2 parents 8946866 + f35276c commit ba3f8f9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).

Note: Minor version `0.X.0` update might break the API, It's recommended to pin `tipg` to minor version: `tipg>=0.1,<0.2`

## [unreleased]

- add `tags` to all routes

## [0.5.6] - 2023-12-19

- Fix collections `prev` links and collections html templates
Expand Down
2 changes: 1 addition & 1 deletion docs/src/advanced/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def lifespan(app: FastAPI):
app = FastAPI(openapi_url="/api", docs_url="/api.html", lifespan=lifespan)

endpoints = OGCFeaturesFactory(with_common=True)
app.include_router(endpoints.router, tags=["OGC Features API"])
app.include_router(endpoints.router)

add_exception_handlers(app, DEFAULT_STATUS_CODES)
```
Expand Down
4 changes: 2 additions & 2 deletions docs/src/user_guide/factories.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ from tipg.factory import OGCFeaturesFactory

app = FastAPI()
endpoints = OGCFeaturesFactory(with_common=True)
app.include_router(endpoints.router, tags=["OGC Features API"])
app.include_router(endpoints.router)
```

#### Creation Options
Expand Down Expand Up @@ -106,7 +106,7 @@ from tipg.factory import OGCTilesFactory

app = FastAPI()
endpoints = OGCTilesFactory(with_common=True)
app.include_router(endpoints.router, tags=["OGC Tiles API"])
app.include_router(endpoints.router)
```

#### Creation Options
Expand Down
19 changes: 17 additions & 2 deletions tipg/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ def _collections_route(self): # noqa: C901
}
},
},
tags=["OGC Features API"],
)
def collections(
request: Request,
Expand Down Expand Up @@ -529,6 +530,7 @@ def _collection_route(self):
}
},
},
tags=["OGC Features API"],
)
def collection(
request: Request,
Expand Down Expand Up @@ -616,6 +618,7 @@ def _queryables_route(self):
}
},
},
tags=["OGC Features API"],
)
def queryables(
request: Request,
Expand Down Expand Up @@ -662,6 +665,7 @@ def _items_route(self): # noqa: C901
"model": model.Items,
},
},
tags=["OGC Features API"],
)
async def items( # noqa: C901
request: Request,
Expand Down Expand Up @@ -918,6 +922,7 @@ def _item_route(self):
"model": model.Item,
},
},
tags=["OGC Features API"],
)
async def item(
request: Request,
Expand Down Expand Up @@ -1150,6 +1155,7 @@ def _tilematrixsets_routes(self):
},
},
},
tags=["OGC Tiles API"],
)
async def tilematrixsets(
request: Request,
Expand Down Expand Up @@ -1202,6 +1208,7 @@ async def tilematrixsets(
},
},
},
tags=["OGC Tiles API"],
)
async def tilematrixset(
request: Request,
Expand Down Expand Up @@ -1248,6 +1255,7 @@ def _tilesets_routes(self):
},
summary="Retrieve a list of available vector tilesets for the specified collection.",
operation_id=".collection.vector.getTileSetsList",
tags=["OGC Tiles API"],
)
async def collection_tileset_list(
request: Request,
Expand Down Expand Up @@ -1331,6 +1339,7 @@ async def collection_tileset_list(
responses={200: {"content": {MediaType.json.value: {}}}},
summary="Retrieve the vector tileset metadata for the specified collection and tiling scheme (tile matrix set).",
operation_id=".collection.vector.getTileSet",
tags=["OGC Tiles API"],
)
async def collection_tileset(
request: Request,
Expand Down Expand Up @@ -1442,12 +1451,14 @@ def _tile_routes(self):
response_class=Response,
responses={200: {"content": {MediaType.mvt.value: {}}}},
operation_id=".collection.vector.getTileTms",
tags=["OGC Tiles API"],
)
@self.router.get(
"/collections/{collectionId}/tiles/{z}/{x}/{y}",
response_class=Response,
responses={200: {"content": {MediaType.mvt.value: {}}}},
operation_id=".collection.vector.getTile",
tags=["OGC Tiles API"],
)
async def collection_get_tile(
request: Request,
Expand Down Expand Up @@ -1521,6 +1532,7 @@ def _tilejson_routes(self):
response_model_exclude_none=True,
response_class=ORJSONResponse,
operation_id=".collection.vector.getTileJSONTms",
tags=["OGC Tiles API"],
)
@self.router.get(
"/collections/{collectionId}/tilejson.json",
Expand All @@ -1529,6 +1541,7 @@ def _tilejson_routes(self):
response_model_exclude_none=True,
response_class=ORJSONResponse,
operation_id=".collection.vector.getTileJSON",
tags=["OGC Tiles API"],
)
async def collection_tilejson(
request: Request,
Expand Down Expand Up @@ -1620,6 +1633,7 @@ def _stylejson_routes(self):
response_model_exclude_none=True,
response_class=ORJSONResponse,
operation_id=".collection.vector.getStyleJSONTms",
tags=["OGC Tiles API"],
)
@self.router.get(
"/collections/{collectionId}/style.json",
Expand All @@ -1628,6 +1642,7 @@ def _stylejson_routes(self):
response_model_exclude_none=True,
response_class=ORJSONResponse,
operation_id=".collection.vector.getStyleJSON",
tags=["OGC Tiles API"],
)
async def collection_stylejson(
request: Request,
Expand Down Expand Up @@ -1849,7 +1864,7 @@ def register_routes(self):
# We do not want `/` and `/conformance` from the factory
with_common=False,
)
self.router.include_router(self.ogc_features.router, tags=["OGC Features API"])
self.router.include_router(self.ogc_features.router)

self.ogc_tiles = OGCTilesFactory(
collection_dependency=self.collection_dependency,
Expand All @@ -1860,4 +1875,4 @@ def register_routes(self):
# We do not want `/` and `/conformance` from the factory
with_common=False,
)
self.router.include_router(self.ogc_tiles.router, tags=["OGC Tiles API"])
self.router.include_router(self.ogc_tiles.router)

0 comments on commit ba3f8f9

Please sign in to comment.