Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0df45fb
[ADD] graphql_base and graphql_demo
sbidoul Nov 19, 2018
b99a1b0
graphql: more documentation
sbidoul Dec 3, 2018
d4d46ad
graphql: add development_status and maintainers
sbidoul Dec 3, 2018
16fda01
graphql: improve and test error handling
sbidoul Dec 3, 2018
8c3fce2
graphql: fix typos in documentation
sbidoul Dec 3, 2018
ae882d3
[UPD] README.rst
OCA-git-bot Jan 14, 2019
38ef684
[FIX] graphql: controller must rollback in case of error
sbidoul Feb 6, 2019
5c61249
[FIX] graphql: readme lint
sbidoul Feb 6, 2019
2085e7b
[UPD] README.rst
OCA-git-bot Mar 22, 2019
d338f26
[UPD] README.rst
OCA-git-bot Jul 29, 2019
eb370ff
black, isort pre-commit
lmignon Oct 17, 2019
6175f19
[MIG] 13.0 branch creation
lmignon Oct 17, 2019
db35360
[MIG] graphql_base, graphql_demo from 12 to 13
sbidoul Oct 12, 2019
52ef411
[UPD] README.rst
OCA-git-bot Oct 18, 2019
d386c63
[UPD] README.rst
OCA-git-bot Mar 29, 2020
5ba5577
Initialize 14.0 branch
lmignon Dec 24, 2020
6cc1d06
[MIG] Migration to version 14.0: graphql_base
qgroulard Dec 10, 2021
8f959ef
[UPD] Update graphql_base.pot
oca-travis Dec 24, 2021
803ec42
[UPD] README.rst
OCA-git-bot Dec 24, 2021
b281e60
Forward port from 14.0
lmignon Jun 14, 2022
8c84eb3
[MIG] [16.0] base_graphql
Jan 3, 2023
28180f2
[UPD] Update graphql_base.pot
Jan 16, 2023
7716184
[UPD] README.rst
OCA-git-bot Jan 16, 2023
1b7b4a8
graphql_base 16.0.1.0.1
OCA-git-bot Jan 16, 2023
6aedbc8
[UPD] README.rst
OCA-git-bot Sep 3, 2023
44c73f0
[MIG] mark all modules installable=False
sbidoul Nov 12, 2023
5f46cd0
Added translation using Weblate (Italian)
mymage Jan 10, 2024
7193bdf
Translated using Weblate (Italian)
mymage Jan 15, 2024
7b1c6b3
[MIG] graphql_base: Migration to 17.0
dduarte-odoogap Aug 19, 2024
fb24d97
[FIX] graphql_base: rename types.py
sbidoul Oct 3, 2024
5962125
[UPD] Update graphql_base.pot
Oct 3, 2024
ecc1c99
[BOT] post-merge updates
OCA-git-bot Oct 3, 2024
088fb2f
[IMP] graphql_base: pre-commit auto fixes
ajay-odoogap Nov 14, 2024
3573975
[MIG] graphql_base: Migration to 18.0
ajay-odoogap Nov 14, 2024
7a1bfa7
Merge branch '18.0' into 18.0-mig-graphql_base
ajay-odoogap Mar 31, 2025
414242d
[IMP] graphql_base: pre-commit auto fixes
ajay-odoogap Apr 24, 2025
d82b0c4
[REM] unwanted changes
ajay-odoogap May 28, 2025
97d1741
[REM] unwanted changes
ajay-odoogap Jul 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions graphql_base/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Graphql Base
:target: https://runbot.odoo-community.org/runbot/271/14.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
|badge1| |badge2| |badge3| |badge4| |badge5|

This modules enables the creation of `GraphQL <https://graphql.org/>`__ endpoints.
In itself, it does nothing and must be used by a developer to
Expand Down Expand Up @@ -96,12 +96,6 @@ endpoints.
def graphiql(self, **kwargs):
return self._handle_graphiql_request(schema)

# Optional monkey patch, needed to accept application/json GraphQL
# requests. If you only need to accept GET requests or POST
# with application/x-www-form-urlencoded content,
# this is not necessary.
GraphQLControllerMixin.patch_for_json("^/graphql/demo/?$")

# The graphql route, for applications.
# Note csrf=False: you may want to apply extra security
# (such as origin restrictions) to this route.
Expand Down Expand Up @@ -146,7 +140,7 @@ promote its widespread use.

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-sbidoul|
|maintainer-sbidoul|

This module is part of the `OCA/rest-framework <https://github.com/OCA/rest-framework/tree/14.0/graphql_base>`_ project on GitHub.

Expand Down
4 changes: 2 additions & 2 deletions graphql_base/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Graphql Base",
"summary": """
Base GraphQL/GraphiQL controller""",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"license": "LGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/rest-framework",
Expand All @@ -14,5 +14,5 @@
"external_dependencies": {"python": ["graphene", "graphql_server"]},
"development_status": "Production/Stable",
"maintainers": ["sbidoul"],
"installable": False,
"installable": True,
}
18 changes: 1 addition & 17 deletions graphql_base/controllers/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright 2018 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

import re
from functools import partial

from graphql_server import (
Expand All @@ -17,21 +16,6 @@


class GraphQLControllerMixin(object):
@staticmethod
def patch_for_json(path_re):
# this is to avoid Odoo, which assumes json always means json+rpc,
# complaining about "function declared as capable of handling request
# of type 'http' but called with a request of type 'json'"
path_re = re.compile(path_re)
orig_get_request = http.Root.get_request

def get_request(self, httprequest):
if path_re.match(httprequest.path):
return http.HttpRequest(httprequest)
return orig_get_request(self, httprequest)

http.Root.get_request = get_request

def _parse_body(self):
req = http.request.httprequest
# We use mimetype here since we don't need the other
Expand Down Expand Up @@ -77,7 +61,7 @@ def _process_request(self, schema, data):
return response
except HttpQueryError as e:
result = json_encode({"errors": [{"message": str(e)}]})
headers = dict(e.headers)
headers = dict()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you change this line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imlopes i have revert the changes
also i have update the graphiql lib to latest version

headers["Content-Type"] = "application/json"
response = http.request.make_response(result, headers=headers)
response.status_code = e.status_code
Expand Down
6 changes: 0 additions & 6 deletions graphql_base/readme/USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ endpoints.
def graphiql(self, **kwargs):
return self._handle_graphiql_request(schema)

# Optional monkey patch, needed to accept application/json GraphQL
# requests. If you only need to accept GET requests or POST
# with application/x-www-form-urlencoded content,
# this is not necessary.
GraphQLControllerMixin.patch_for_json("^/graphql/demo/?$")

# The graphql route, for applications.
# Note csrf=False: you may want to apply extra security
# (such as origin restrictions) to this route.
Expand Down