Skip to content

Conversation

PrettyWood
Copy link
Collaborator

@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
Collaborator 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.

2 participants