Skip to content

Commit

Permalink
Fix missing not found response for options method
Browse files Browse the repository at this point in the history
  • Loading branch information
francbartoli committed Apr 6, 2024
1 parent 4a3417e commit d0ae3d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/pygeoapi/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""pygeoapi models module."""

from openapi_pydantic.v3.v3_0_3 import Reference

not_found = {
"404": Reference(ref="https://schemas.opengis.net/ogcapi/features/part1/1.0/openapi/ogcapi-features-1.yaml#/components/responses/NotFound") # noqa
}
3 changes: 3 additions & 0 deletions app/pygeoapi/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from app.auth.models import unauthorized
from app.config.app import configuration as cfg
from app.config.logging import create_logger
from app.pygeoapi.models import not_found

logger = create_logger("app.pygeoapi.openapi")

Expand Down Expand Up @@ -61,6 +62,8 @@ def augment_security(doc: str, security_schemes: List[SecurityScheme]) -> OpenAP
]
if value.options.responses:
value.options.responses.update(unauthorized)
# Remove when it is fixed from pygeoapi
value.options.responses.update(not_found)
if value.delete:
value.delete.security = [
{f"pygeoapi {cfg.PYGEOAPI_SECURITY_SCHEME}": []}
Expand Down

0 comments on commit d0ae3d2

Please sign in to comment.