json scheme
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
import auth as app
|
import auth as app
|
||||||
|
|
||||||
|
from .conftest import LambdaContext
|
||||||
|
|
||||||
def test_bearer_jwt(lambda_context):
|
|
||||||
|
def test_bearer_jwt(lambda_context: LambdaContext):
|
||||||
app.get_user = lambda *args, **kwargs: {
|
app.get_user = lambda *args, **kwargs: {
|
||||||
'sub': '58efed8d-d276-41a8-8502-4ab8b5a6415e',
|
'sub': '58efed8d-d276-41a8-8502-4ab8b5a6415e',
|
||||||
'name': 'pytest',
|
'name': 'pytest',
|
||||||
@@ -13,7 +15,7 @@ def test_bearer_jwt(lambda_context):
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
assert app.lambda_handler(event, lambda_context) == { # type: ignore
|
assert app.lambda_handler(event, lambda_context) == {
|
||||||
'isAuthorized': True,
|
'isAuthorized': True,
|
||||||
'context': {
|
'context': {
|
||||||
'user': {
|
'user': {
|
||||||
|
|||||||
@@ -148,6 +148,17 @@ class CpfCnpj:
|
|||||||
|
|
||||||
return cpfcnpj_
|
return cpfcnpj_
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __get_pydantic_json_schema__(
|
||||||
|
cls, core_schema: core_schema.CoreSchema, handler: GetJsonSchemaHandler
|
||||||
|
) -> JsonSchemaValue:
|
||||||
|
field_schema = handler(core_schema)
|
||||||
|
field_schema.update(
|
||||||
|
type='string',
|
||||||
|
format=cls.__name__.lower().removesuffix('str'),
|
||||||
|
)
|
||||||
|
return field_schema
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
CpfStr = Annotated[str, ...]
|
CpfStr = Annotated[str, ...]
|
||||||
|
|||||||
Reference in New Issue
Block a user