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

__modify_schema__() missing 1 required positional argument: 'field' #599

Closed
SaluteGF opened this issue Oct 28, 2022 · 10 comments
Closed

__modify_schema__() missing 1 required positional argument: 'field' #599

SaluteGF opened this issue Oct 28, 2022 · 10 comments

Comments

@SaluteGF
Copy link

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

@vitalik
Copy link
Owner

vitalik commented Oct 28, 2022

Hi @SaluteGF

Could you provide your versions (django version, pydantic version, ninja version)

@SaluteGF
Copy link
Author

SaluteGF commented Oct 28, 2022 via email

@SaluteGF
Copy link
Author

SaluteGF commented Oct 28, 2022 via email

@SaluteGF
Copy link
Author

SaluteGF commented Oct 28, 2022 via email

@vitalik
Copy link
Owner

vitalik commented Oct 28, 2022

try upgrading pydantic to 1.9.x

@SaluteGF
Copy link
Author

SaluteGF commented Oct 28, 2022 via email

@vitalik
Copy link
Owner

vitalik commented Oct 28, 2022

did upgrading pydantic solved the original problem ?

@SaluteGF
Copy link
Author

SaluteGF commented Oct 28, 2022 via email

@vitalik
Copy link
Owner

vitalik commented Oct 28, 2022

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 ?

@SaluteGF
Copy link
Author

SaluteGF commented Oct 28, 2022 via email

@vitalik vitalik closed this as completed Dec 13, 2022
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

No branches or pull requests

2 participants