code-specialist / fastapi-keycloak

Keycloak integration for Python FastAPI
https://fastapi-keycloak.code-specialist.com/
Apache License 2.0
192 stars 49 forks source link

Set None as default for Optional fields #97

Closed alexbarcelo closed 7 months ago

alexbarcelo commented 1 year ago

Optional and Required have different semantics, and the Pydantic v2 cleanup makes the fields required unless None is set as default value.

Without adding = None in those optional fields, the library fails, e.g.:

pydantic_core._pydantic_core.ValidationError: 2 validation errors for KeycloakUser
realmRoles
  Field required [type=missing, input_value={'id': '898e45fa-d868-4b3...: True, 'manage': True}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.1.2/v/missing
attributes
  Field required [type=missing, input_value={'id': '898e45fa-d868-4b3...: True, 'manage': True}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.1.2/v/missing
martincpt commented 8 months ago

Can we please merge this?

alexbarcelo commented 8 months ago

Damn, I needed to test some things, threw a dirty commit in my branch to be able to install-from-git, and did not realize that the branch was being monitored from here. And now everything is in shambles. (I don't know why I believed that the PR was "frozen" at the previous commit)

martincpt commented 8 months ago

@alexbarcelo Should I review again?

alexbarcelo commented 8 months ago

@martincpt I would have thought that my last force-pushed (removing the invalid commit, that I will be using from another branch ofc) invalidated your code review. But GitHub shows me a tick as if you have already validated it. And @yannicschroeer approved this in its current state, but the commit history seem to not sit well with GitHub and does not show a tick :shrug:

Maybe I am not realizing where @yannicschroeer left a comment?

odnobit commented 8 months ago

any updates?

yannicschroeer commented 8 months ago

Sorry. I did not see this. I'll set alexbarcelo as an additional owner of the repository

jvystrcil-mama-ai commented 7 months ago

@yannicschroeer @alexbarcelo I understand you have lack of time for this projects, but do you have some time estimate of merging this PR and releasing it? We either need this fix or we will unfortunately need to fork the repo and do the fix on our side.

alexbarcelo commented 7 months ago

I am not an owner but a collaborator, so I cannot expedite the merge. Unless I have overlooked something obvious, I have to wait until the owners relax the pipelines and restrictions.

yannicschroeer commented 7 months ago

@yannicschroeer @alexbarcelo I understand you have lack of time for this projects, but do you have some time estimate of merging this PR and releasing it? We either need this fix or we will unfortunately need to fork the repo and do the fix on our side.

I do not only have a lack of time, we straight up announced that we can not offer any support in this project anymore. So far, nobody every contacted us to maintain the library.

I am not an owner but a collaborator, so I cannot expedite the merge. Unless I have overlooked something obvious, I have to wait until the owners relax the pipelines and restrictions.

I have escalated your rights further.

alexbarcelo commented 7 months ago

@yannicschroeer @alexbarcelo I understand you have lack of time for this projects, but do you have some time estimate of merging this PR and releasing it? We either need this fix or we will unfortunately need to fork the repo and do the fix on our side.

I do not only have a lack of time, we straight up announced that we can not offer any support in this project anymore. So far, nobody every contacted us to maintain the library.

I sent you an email on 2023/12/28. That may have ended up in the spam folder. I addressed it to admin@code-specialist.com. In that mail I offered myself while proposing a migration to its own organization on GitHub, migrate readthedocs and add PyPI permissions / org.

jvystrcil-mama-ai commented 7 months ago

Thank you @alexbarcelo 🙏

martincpt commented 7 months ago

Finally! Thanks!

odnobit commented 7 months ago

great, waiting for the new release...