OCA / rest-framework

GNU Affero General Public License v3.0
308 stars 297 forks source link

[16.0] FastAPI does not support `PATCH` requests #376

Closed kenneth-vkd closed 5 months ago

kenneth-vkd commented 1 year ago

Module

fastapi

Describe the bug

When creating endpoints in a router using @router.patch(), it shows in the auto-generated documentation, but when attempting to use it, the following HTML is returned:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>405 Method Not Allowed</title>
<h1>Method Not Allowed</h1>
<p>The method is not allowed for the requested URL.</p>

Seems to be returned from Odoo directly and it therefore never reaches fastapi

Affected versions: 16.0

Expected behavior It would be expected that PATCH requests are supported or that the fastapi module raises a warning/error routes/endpoints using this method have been detected

Additional context installed libraries in environment:

a2wsgi==1.7.0
aniso8601==9.0.1
annotated-types==0.5.0
anyio==3.7.1
apispec==6.3.0
appdirs==1.4.4
attrs==23.1.0
Babel==2.9.1
beautifulsoup4==4.12.2
cached-property==1.5.2
Cerberus==1.3.5
certifi==2023.7.22
cffi==1.15.1
chardet==4.0.0
charset-normalizer==3.2.0
contextvars==2.4
cryptography==3.4.8
decorator==4.4.2
defusedxml==0.7.1
docopt==0.6.2
docutils==0.16
ebaysdk==2.1.5
exceptiongroup==1.1.3
extendable==1.2.0
extendable_pydantic==1.1.0
fastapi==0.103.1
freezegun==0.3.15
gevent==21.8.0
graphene==3.3
graphql-core==3.2.3
graphql-relay==3.2.0
graphql-server==3.0.0b6
greenlet==1.1.2
idna==2.10
immutables==0.20
isodate==0.6.1
Jinja2==2.11.3
jsondiff==2.0.0
libsass==0.20.1
lxml==4.6.5
MarkupSafe==1.1.1
marshmallow==3.20.1
marshmallow-objects==2.3.0
num2words==0.5.9
oauthlib==3.2.2
ofxparse==0.21
packaging==23.1
parse-accept-language==0.1.2
passlib==1.7.4
Pillow==9.0.1
polib==1.1.0
psutil==5.8.0
psycopg2==2.8.6
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycparser==2.21
pydantic==2.3.0
pydantic_core==2.6.3
pydot==1.4.2
pyOpenSSL==20.0.1
pyparsing==3.1.1
PyPDF2==1.26.0
pyquerystring==1.1
pyserial==3.5
python-dateutil==2.8.1
python-ldap==3.4.0
python-multipart==0.0.6
python-stdnum==1.16
pytz==2023.3
pyusb==1.0.2
qrcode==6.1
reportlab==3.5.59
requests==2.31.0
requests-file==1.5.1
requests-oauthlib==1.3.1
requests-toolbelt==1.0.0
six==1.16.0
sniffio==1.3.0
soupsieve==2.4.1
starlette==0.27.0
typing_extensions==4.7.1
ujson==5.8.0
urllib3==1.26.5
vobject==0.9.6.1
Werkzeug==2.0.2
wrapt==1.15.0
xlrd==1.2.0
XlsxWriter==1.1.2
xlwt==1.3.0
zeep==4.0.0
zope.event==5.0
zope.interface==6.0
github-actions[bot] commented 6 months ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

astirpe commented 5 months ago

We have the same issue. Seems to be a limit of standard Odoo. @lmignon do you maybe know if there's a easy way to make it working?

lmignon commented 5 months ago

We have the same issue. Seems to be a limit of standard Odoo. @lmignon do you maybe know if there's a easy way to make it working?

add the "PATCH" method here

A PR with the fix would be appreciated

astirpe commented 5 months ago

Yes, it works! Thank you @lmignon ! I will open a PR later on today.

astirpe commented 5 months ago

PR for V16: https://github.com/OCA/rest-framework/pull/431

PR for V17: https://github.com/OCA/rest-framework/pull/432