-
Notifications
You must be signed in to change notification settings - Fork 35
fix: schema generation with type keyword (#84) #87
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
base: master
Are you sure you want to change the base?
Conversation
|
I'm not sure why |
| ), | ||
| ) | ||
| return api_dir | ||
| return request.param |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not change the fixture return type.
If you need access to some of the fixture params, you can follow one of the two ways:
- return a "smart" object and access its attributes
- create a fixture and access/control params through it
I would prefer the second method for this case:
@pytest.fixture(params=['no-collide', 'collide'])
def api_package_signature(request):
return request.param
@pytest.fixture()
def api_package(..., api_package_signature):
...| else: | ||
| assert web_request_ref != mobile_request_ref | ||
| assert web_request_ref.split('/')[-1] in schemas | ||
| assert mobile_request_ref.split('/')[-1] in schemas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we bring back hard-coded values to make the test clearer about which values are expected?
| from pydantic import BaseModel | ||
|
|
||
|
|
||
| def test_type_keyword_field(ep, app, app_client): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def test_type_keyword_field(ep, app, app_client): | |
| def test_py312_type_keyword_field(ep, app, app_client): |
schema['title']if there is no 'title'request_responsefrom fastapi required in latest fastapi version. In previous fastapi versions there is an import from starlette (fastapi/fastapi@e329d78#diff-4d573079004a9f3d148baa4658e68e82b8a3d1a95d603fee8177daa92cf65c93)test_no_collide, because now fastapi generates schema with full nameapi.mobile._Response[probe]even if it's not necessary