Skip to content

fix: Check for NoneType extension in serialization#131

Merged
azmeuk merged 2 commits intopython-scim:mainfrom
NaqGuug:main
Mar 10, 2026
Merged

fix: Check for NoneType extension in serialization#131
azmeuk merged 2 commits intopython-scim:mainfrom
NaqGuug:main

Conversation

@NaqGuug
Copy link
Copy Markdown
Contributor

@NaqGuug NaqGuug commented Mar 6, 2026

Sometimes partial_result can be None when serialising extension. If so, partial_result.items() will raise an error.

This PR just adds a small check for possible NoneType.

@NaqGuug
Copy link
Copy Markdown
Contributor Author

NaqGuug commented Mar 8, 2026

To be more precise, this happens when passing a scim model with empty extensions to FastAPI endpoint with a specific response model.

Example

app = FastAPI()

@app.get(
  "/endpoint/",
  response_model=User[EnterpriseUser]
)
async def get_model() -> User[EnterpriseUser]:
  # EnterpriseUser is None, will raise an error
  # when FastAPI tries to serialise the object.
  return User[EnterpriseUser]() 

@azmeuk azmeuk merged commit 8666d12 into python-scim:main Mar 10, 2026
25 checks passed
@azmeuk
Copy link
Copy Markdown
Member

azmeuk commented Mar 10, 2026

This is released in 0.6.5

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants