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
__modify_schema__() missing 1 required positional argument: 'field' #599
Comments
Hi @SaluteGF Could you provide your versions (django version, pydantic version, ninja version) |
Django=3.2.16 pedantic=1.8.2 Django-ninja=0.19.1
… 2022年10月28日 15:30,Vitaliy Kucheryaviy ***@***.***> 写道:
Hi @SaluteGF <https://github.com/SaluteGF>
Could you provide your versions (django version, pydantic version, ninja version)
—
Reply to this email directly, view it on GitHub <#599 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ALD755OD4PEVE6JXWQKQSJLWFN6KXANCNFSM6AAAAAARQULFZE>.
You are receiving this because you were mentioned.
|
django=3.2.16 pydantic=1.8.2 django-ninja=0.19.1 thanks发自我的 iPhone在 2022年10月28日,15:30,Vitaliy Kucheryaviy ***@***.***> 写道:
Hi @SaluteGF
Could you provide your versions (django version, pydantic version, ninja version)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Django=3.2.16
pedantic=1.8.2
Django-ninja=0.19.1
|
try upgrading pydantic to 1.9.x |
Another error is reported. The /api/docs page cannot be found

This is my urls.py code:
from django.contrib import admin
from django.urls import path
from ninja import NinjaAPI, File
from ninja.files import UploadedFile
api = NinjaAPI()
@api.post("/upload")
def upload(request, file: UploadedFile = File(...)):
data = file.read()
return {'name': file.name, 'len': len(data)}
urlpatterns = [
path('admin/', admin.site.urls),
path('api/',api.urls),
]
|
did upgrading pydantic solved the original problem ? |
yes
…
mentioned.
|
ok, how about these lines: urlpatterns = [
path('admin/', admin.site.urls),
path('api/',api.urls),
] is it in urls.py file ? does /admin/ works for you ? |
/admin work,but /api/docs not work发自我的 iPhone在 2022年10月28日,18:03,Vitaliy Kucheryaviy ***@***.***> 写道:
ok, how about these lines:
urlpatterns = [
path('admin/', admin.site.urls),
path('api/',api.urls),
]
is it in urls.py file ? does /admin/ works for you ?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/views.py", line 35, in openapi_json
schema = api.get_openapi_schema()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/main.py", line 419, in get_openapi_schema
return get_schema(api=self, path_prefix=path_prefix)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 40, in get_schema
openapi = OpenAPISchema(api, path_prefix)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 62, in init
("paths", self.get_paths()),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 77, in get_paths
path_methods = self.methods(path_view.operations)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 86, in methods
operation_details = self.operation_details(op)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 114, in operation_details
body = self.request_body(operation)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 228, in request_body
model, remove_level=model._param_source == "body"
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 186, in _create_schema_from_model
cast(Type[BaseModel], model), ref_prefix=REF_PREFIX, by_alias=by_alias
File "pydantic/schema.py", line 167, in pydantic.schema.model_schema
File "pydantic/schema.py", line 548, in pydantic.schema.model_process_schema
File "pydantic/schema.py", line 589, in pydantic.schema.model_type_schema
File "pydantic/schema.py", line 236, in pydantic.schema.field_schema
File "pydantic/schema.py", line 303, in pydantic.schema.get_field_schema_validations
TypeError: modify_schema() missing 1 required positional argument: 'field'
[28/Oct/2022 10:11:46] "GET /api/openapi.json HTTP/1.1" 500 254519
[28/Oct/2022 10:11:46] "GET /api/docs HTTP/1.1" 200 788
Internal Server Error: /api/openapi.json
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/views.py", line 35, in openapi_json
schema = api.get_openapi_schema()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/main.py", line 419, in get_openapi_schema
return get_schema(api=self, path_prefix=path_prefix)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 40, in get_schema
openapi = OpenAPISchema(api, path_prefix)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 62, in init
("paths", self.get_paths()),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 77, in get_paths
path_methods = self.methods(path_view.operations)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 86, in methods
operation_details = self.operation_details(op)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 114, in operation_details
body = self.request_body(operation)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 228, in request_body
model, remove_level=model._param_source == "body"
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 186, in _create_schema_from_model
cast(Type[BaseModel], model), ref_prefix=REF_PREFIX, by_alias=by_alias
File "pydantic/schema.py", line 167, in pydantic.schema.model_schema
File "pydantic/schema.py", line 548, in pydantic.schema.model_process_schema
File "pydantic/schema.py", line 589, in pydantic.schema.model_type_schema
File "pydantic/schema.py", line 236, in pydantic.schema.field_schema
File "pydantic/schema.py", line 303, in pydantic.schema.get_field_schema_validations
TypeError: modify_schema() missing 1 required positional argument: 'field'
[28/Oct/2022 10:11:47] "GET /api/openapi.json HTTP/1.1" 500 254519
[28/Oct/2022 10:24:17] "GET /api/docs HTTP/1.1" 200 788
Internal Server Error: /api/openapi.json
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/views.py", line 35, in openapi_json
schema = api.get_openapi_schema()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/main.py", line 419, in get_openapi_schema
return get_schema(api=self, path_prefix=path_prefix)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 40, in get_schema
openapi = OpenAPISchema(api, path_prefix)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 62, in init
("paths", self.get_paths()),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 77, in get_paths
path_methods = self.methods(path_view.operations)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 86, in methods
operation_details = self.operation_details(op)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 114, in operation_details
body = self.request_body(operation)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 228, in request_body
model, remove_level=model._param_source == "body"
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/ninja/openapi/schema.py", line 186, in _create_schema_from_model
cast(Type[BaseModel], model), ref_prefix=REF_PREFIX, by_alias=by_alias
File "pydantic/schema.py", line 167, in pydantic.schema.model_schema
File "pydantic/schema.py", line 548, in pydantic.schema.model_process_schema
File "pydantic/schema.py", line 589, in pydantic.schema.model_type_schema
File "pydantic/schema.py", line 236, in pydantic.schema.field_schema
File "pydantic/schema.py", line 303, in pydantic.schema.get_field_schema_validations
TypeError: modify_schema() missing 1 required positional argument: 'field'
[28/Oct/2022 10:24:17] "GET /api/openapi.json HTTP/1.1" 500 254519
The text was updated successfully, but these errors were encountered: