|Author:||ACSONE SA/NV,Odoo Community Association (OCA)|
|Dependencies:||base, and web|
|Languages:||HTML (397, 53.3%), Python (115, 15.4%), XML (130, 17.4%), and reStructuredText (103, 13.8%)|
|Other repositories:||Ahmad-Datasmith/rest-framework, Digital5-Odoo/rest-framework, Gabinete-Digital/rest-framework, NeatNerdPrime/rest-framework, OCA-MUK/rest-framework, OCA/rest-framework, SetRac/rest-framework, SeuMarco/rest-framework, TDu/rest-framework, Tomaskarpovic/rest-framework, acsone/rest-framework, alecvinent/rest-framework, altanmur/rest-framework, andres-mejia/rest-framework, baotnp/rest-framework, bigmoney-team/rest-framework, boky1993/rest-framework, cedvict/rest-framework, coopiteasy/rest-framework, darshan-odoo/rest-framework, dndoanh/rest-framework, elmosolutions/rest-framework, gastonfeng/rest-framework, glm-conseil/rest-framework, guewen/rest-framework, gurneyalex/rest-framework, guwenfeng/rest-framework, hinfo506/rest-framework, huntergps/rest-framework, id42sistemas/rest-framework, jacky82669513/rest-framework, jamesvibar/rest-framework, janverb/rest-framework, jobiols/oca-rest-framework, jorgeblanc9/rest-framework, josuf567/rest-framework, lebanggit/rest-framework, led-startup-studio/rest-framework, lideritjnma/rest-framework, marvin981973/rest-framework, mohamed-helmy/rest-framework, novawish/rest-framework, odoogap/rest-framework, osvalr/rest-framework, royalline1/rest-framework, sanube/rest-framework, simahawk/rest-framework, skander-cherif/rest-framework, themreza/rest-framework, ursais/rest-framework, wahello/rest-framework, x0rzkov/odoo-rest-framework, xaoxaodigital/rest-framework, xoe-labs/rest-framework, xubiuit/rest-framework, xwh123807/rest-framework, and yasmanycastillo/rest-framework|
This modules enables the creation of GraphQL endpoints.
In itself, it does nothing and must be used by a developer to
create the GraphQL schema and resolvers using
and expose them through a controller.
An example is available in the
Table of contents
To use this module, you need to
This module does not attempt to expose the whole Odoo object model. This could be the purpose of another module based on this one. We believe however that it is preferable to expose a specific well tested endpoint for each customer, so as to reduce coupling by knowing precisely what is exposed and needs to be tested when upgrading Odoo.
To start working with this module, we recommend the following approach:
graphql_demomodule in this repo, copy it, adapt the controller to suit your needs (routes, authentication methods).
The schema can be built using native graphene types.
is provided as a convenience. It is a graphene
ObjectType with a
default attribute resolver which:
Falsestrings being rendered as json
The module provides an
class to help you build GraphQL controllers providing GraphiQL and/or GraphQL
from odoo import http from odoo.addons.graphql_base import GraphQLControllerMixin from ..schema import schema class GraphQLController(http.Controller, GraphQLControllerMixin): # The GraphiQL route, providing an IDE for developers @http.route("/graphiql/demo", auth="user") 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. @http.route("/graphql/demo", auth="user", csrf=False) def graphql(self, **kwargs): return self._handle_graphql_request(schema)
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
This module is part of the OCA/rest-framework project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.