Skip to content

Scim models with FastAPI not working #125

@NaqGuug

Description

@NaqGuug

When passing User from scim2-models as a parameter to FastAPI like this

@app.post("/")
async def create_user(user: User):
    return User(
        user_name="test user"
    )

The following error occurs

pydantic.errors.PydanticInvalidForJsonSchema: Cannot generate a JsonSchema for core_schema.PlainValidatorFunctionSchema ({'type': 'no-info', 'function': <function Reference.__get_pydantic_core_schema__.<locals>.validate at 0x7fdf8892a6c0>})

This also occurs if you try to pass types Group, PatchOp, list[PatchOperation] and EnterpriseUser. This is most likely because Pydantic can't create a json schema of the Reference type (as the error suggests). There already exists issue in the Pydantic library with a possible fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions