Skip to content

Scim models with FastAPI not working #125

Closed

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.

Activity

  1. added theissue type on Jan 29, 2026
  2. azmeuk commented on Jan 29, 2026

    @azmeuk
    Member

    Thank you for you bug report.
    Can you please test #126 and confirm it fixes the issue?

  3. NaqGuug commented on Jan 29, 2026

    @NaqGuug
    ContributorAuthor

    Thank you, on quick glance #126 seems to fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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