From 35b3b9cb1c60699527dc3d46bb18bd166cd652fa Mon Sep 17 00:00:00 2001 From: Nick Jackson Date: Thu, 9 Nov 2023 12:30:21 +0000 Subject: [PATCH] Correctly type document URIs as DocumentURIStrings --- src/openapi_server/apis/reading_api.py | 4 ++-- src/openapi_server/apis/writing_api.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/openapi_server/apis/reading_api.py b/src/openapi_server/apis/reading_api.py index 2146672..462d187 100644 --- a/src/openapi_server/apis/reading_api.py +++ b/src/openapi_server/apis/reading_api.py @@ -2,7 +2,7 @@ import lxml.etree from typing import Dict, List, Any # noqa: F401 - +from caselawclient.models.documents import DocumentURIString from fastapi import ( # noqa: F401 APIRouter, Body, @@ -58,7 +58,7 @@ def unpack_list(xpath_list): ) async def get_document_by_uri( response: Response, - judgmentUri: str, + judgmentUri: DocumentURIString, token_basic: TokenModel = Security(get_token_basic), ): with error_handling(): diff --git a/src/openapi_server/apis/writing_api.py b/src/openapi_server/apis/writing_api.py index d0e5c24..37439e6 100644 --- a/src/openapi_server/apis/writing_api.py +++ b/src/openapi_server/apis/writing_api.py @@ -2,6 +2,8 @@ from typing import Dict, List, Optional # noqa: F401 +from caselawclient.models.documents import DocumentURIString + from fastapi import ( # noqa: F401 APIRouter, Body, @@ -49,7 +51,7 @@ ) async def judgment_uri_lock_get( response: Response, - judgmentUri: str, + judgmentUri: DocumentURIString, token_basic: TokenModel = Security(get_token_basic), ): client = client_for_basic_auth(token_basic) @@ -81,7 +83,7 @@ async def judgment_uri_lock_get( ) async def judgment_uri_lock_put( response: Response, - judgmentUri: str, + judgmentUri: DocumentURIString, token_basic: TokenModel = Security(get_token_basic), expires="0", ): @@ -112,7 +114,7 @@ async def judgment_uri_lock_put( ) async def judgment_uri_lock_delete( response: Response, - judgmentUri: str, + judgmentUri: DocumentURIString, token_basic: TokenModel = Security(get_token_basic), ): client = client_for_basic_auth(token_basic) @@ -146,7 +148,7 @@ async def judgment_uri_lock_delete( async def judgment_uri_patch( request: Request, response: Response, - judgmentUri: str, + judgmentUri: DocumentURIString, if_match: str = Header( None, description="The last known version number of the document" ),