Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

upgrade pydantic to 0.28#320

Merged
tiangolo merged 2 commits intofastapi:masterfrom
jekirl:master
Jun 18, 2019
Merged

upgrade pydantic to 0.28#320
tiangolo merged 2 commits intofastapi:masterfrom
jekirl:master

Conversation

@jekirl
Copy link
Contributor

Thisfixes#307 and#308
Looks like the change to pydantic is required due to their changes to support circular JSON Schema references
pydantic/pydantic@d73aa1b#diff-7d11a8c77c4167b2958bcdb27b18cf2a

There is a decent chance I may be missing something, but simply passing an empty set for known_models passes all tests.

A better solution might be for pydantic to change the signature ofget_flat_models_from_fields to

defget_flat_models_from_field(field:Field,known_models:Set[Type['BaseModel']]=None)->Set[Type['BaseModel']]:known_models=known_modelsorset()flat_models:Set[Type['BaseModel']]=set()# Handle dataclass-based modelsfield_type=field.type_iflenient_issubclass(getattr(field_type,'__pydantic_model__',None),pydantic.BaseModel):field_type=field_type.__pydantic_model__# type: ignoreiffield.sub_fields:flat_models|=get_flat_models_from_fields(field.sub_fields,known_models=known_models)eliflenient_issubclass(field_type,pydantic.BaseModel)andfield_typenotinknown_models:flat_models|=get_flat_models_from_model(field_type,known_models=known_models)returnflat_models

@codecov
Copy link

codecovbot commentedJun 18, 2019
edited
Loading

Codecov Report

Merging#320 intomaster willnot change coverage.
The diff coverage isn/a.

Impacted file tree graph

@@          Coverage Diff          @@##           master   #320   +/-   ##=====================================  Coverage     100%   100%           =====================================  Files         224    224             Lines        5303   5303           =====================================  Hits         5303   5303
Impacted FilesCoverage Δ
...t_query_params_str_validations/test_tutorial013.py100% <ø> (ø)⬆️
fastapi/utils.py100% <ø> (ø)⬆️

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last updatec26f176...80314f5. Read thecomment docs.

@euri10
Copy link
Contributor

euri10 commentedJun 18, 2019
edited
Loading

You need to update pyproject.toml to update the dependencies, pipfile is just for the dev setup iirc
Edit: Oups, it's done...sorry

@dmontagu
Copy link
Collaborator

dmontagu commentedJun 18, 2019
edited
Loading

It might make sense to also add a (failing?) test for circular JSON schema references (outside of the main test folder? Maybe inpending_tests?), since that is now supported by pydantic.

@tiangolo
Copy link
Member

Thanks! Hehe, I have almost exactly the same in local WIP. I was planning to integrate right away Pydantic's ORM support, but let's keep them separated them. Let me check this.

dmontagu reacted with hooray emoji

@tiangolotiangolo merged commitf0df79a intofastapi:masterJun 18, 2019
@tiangolo
Copy link
Member

Thanks! Perfect. Merged 🚀

Thanks@euri10 for the note!

Good point@dmontagu , It should work fine. I think it deserves a small section in the docs, and then some tests on those docs, so I'll do it later.

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

eta on pydantic update to 0.28

4 participants

@jekirl@euri10@dmontagu@tiangolo

Comments


[8]ページ先頭

©2009-2026 Movatter.jp