Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: set Pattern encoder in ENCODERS_BY_TYPE #2444

Merged
merged 2 commits into from Mar 2, 2021

Conversation

PrettyWood
Copy link
Member

@PrettyWood PrettyWood commented Mar 1, 2021

Change Summary

Set Pattern encoder directly in ENCODERS_BY_TYPE to be used by fastapi

Related issue number

#2045

Well fastapi uses its own json encoder and reuses ENCODERS_BY_TYPE from pydantic here
https://github.com/tiangolo/fastapi/blob/5614b94ccc9f72f1de2f63aae63f5fe90b86c8b5/fastapi/encoders.py#L126-L127
We could maybe add Pattern directly in ENCODERS_BY_TYPE to make it work

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change
    (see changes/README.md for details)

@pydantic pydantic deleted a comment from codecov bot Mar 1, 2021
@samuelcolvin samuelcolvin added this to the v1.8.1 milestone Mar 2, 2021
@samuelcolvin
Copy link
Member

@PrettyWood I switched from a label to a milestone for v1.8.1, I think that makes more sense.

I'm not sure why this has been tagged as v1.8.1?

@PrettyWood
Copy link
Member Author

@samuelcolvin It's not required for 1.8.1 but without it, the issue is not completely solved as it doesn't work for fastapi. And I thought making it work for fastapi was probably the most common usecase. See #2045 (comment)

@samuelcolvin samuelcolvin merged commit b2d3f33 into pydantic:master Mar 2, 2021
@samuelcolvin
Copy link
Member

this is great, thank you.

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.

None yet

2 participants