Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
EnrouteBuilder,
EnrouteDecorator,
EnrouteDecoratorKind,
GraphqlEnrouteDecorator,
GraphqlQueryEnrouteDecorator,
Handler,
HandlerMeta,
HandlerWrapper,
Expand All @@ -63,8 +65,6 @@
RestCommandEnrouteDecorator,
RestEnrouteDecorator,
RestQueryEnrouteDecorator,
GraphqlEnrouteDecorator,
GraphqlQueryEnrouteDecorator,
enroute,
)
from .discovery import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
CheckDecorator,
EnrouteDecorator,
EnrouteDecoratorKind,
GraphqlEnrouteDecorator,
GraphqlQueryEnrouteDecorator,
PeriodicEnrouteDecorator,
PeriodicEventEnrouteDecorator,
RestCommandEnrouteDecorator,
RestEnrouteDecorator,
RestQueryEnrouteDecorator,
GraphqlEnrouteDecorator,
GraphqlQueryEnrouteDecorator,
)
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
BrokerEventEnrouteDecorator,
BrokerQueryEnrouteDecorator,
EnrouteDecorator,
GraphqlEnrouteDecorator,
GraphqlQueryEnrouteDecorator,
PeriodicEventEnrouteDecorator,
RestCommandEnrouteDecorator,
RestEnrouteDecorator,
RestQueryEnrouteDecorator,
GraphqlEnrouteDecorator,
GraphqlQueryEnrouteDecorator,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
BrokerCommandEnrouteDecorator,
BrokerEventEnrouteDecorator,
BrokerQueryEnrouteDecorator,
GraphqlQueryEnrouteDecorator,
PeriodicEventEnrouteDecorator,
RestCommandEnrouteDecorator,
RestQueryEnrouteDecorator,
GraphqlQueryEnrouteDecorator
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
from .checkers import (
CheckDecorator,
)
from .graphql import (
GraphqlEnrouteDecorator,
GraphqlQueryEnrouteDecorator,
)
from .kinds import (
EnrouteDecoratorKind,
)
Expand All @@ -22,7 +26,3 @@
RestEnrouteDecorator,
RestQueryEnrouteDecorator,
)
from .graphql import (
GraphqlEnrouteDecorator,
GraphqlQueryEnrouteDecorator
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@
class GraphqlService:
@enroute.graphql(url="/graphql", method="POST")
def add_ticket(self, request: Request) -> Response:
return Response({
"data": {},
"errors": []
})
return Response({"data": {}, "errors": []})
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
BrokerEventEnrouteDecorator,
BrokerQueryEnrouteDecorator,
EnrouteAnalyzer,
GraphqlQueryEnrouteDecorator,
PeriodicEventEnrouteDecorator,
RestCommandEnrouteDecorator,
RestQueryEnrouteDecorator,
GraphqlQueryEnrouteDecorator,
)
from tests.utils import (
FakeService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
BrokerCommandEnrouteDecorator,
BrokerEventEnrouteDecorator,
BrokerQueryEnrouteDecorator,
GraphqlQueryEnrouteDecorator,
PeriodicEventEnrouteDecorator,
RestCommandEnrouteDecorator,
RestQueryEnrouteDecorator,
GraphqlQueryEnrouteDecorator,
enroute,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import asyncio

from graphql import (
graphql, GraphQLSchema, GraphQLObjectType, GraphQLField, GraphQLString)
GraphQLField,
GraphQLObjectType,
GraphQLSchema,
GraphQLString,
graphql,
)


def resolve_hello(obj, info):
return 'world'
return "world"


schema = GraphQLSchema(
query=GraphQLObjectType(
name='RootQueryType',
fields={
'hello': GraphQLField(
GraphQLString,
resolve=resolve_hello)
}))
query=GraphQLObjectType(name="RootQueryType", fields={"hello": GraphQLField(GraphQLString, resolve=resolve_hello)})
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
from aiohttp import (
web,
)
from graphql_server.aiohttp import (
GraphQLView,
)

from minos.common import (
MinosConfig,
Expand All @@ -31,15 +34,15 @@
ResponseException,
)

from .graphql_example import (
schema,
)
from .requests import (
RestRequest,
)
from .responses import (
RestResponse,
)
from graphql_server.aiohttp import GraphQLView

from .graphql_example import schema

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -102,7 +105,7 @@ def get_app(self) -> web.Application:
@cached_property
def _app(self) -> web.Application:
app = web.Application()
#self._mount_routes(app)
# self._mount_routes(app)
self._mount_graphql(app)
return app

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from aiohttp import web
from minos.plugins.graphql_aiohttp.services import RestService
from aiohttp import (
web,
)

from minos.plugins.graphql_aiohttp.services import (
RestService,
)


def main():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
from aiomisc.service.aiohttp import (
AIOHTTPService,
)
from graphql_server.aiohttp import (
GraphQLView,
)

from .graphql_example import (
schema,
)
from .handlers import (
RestHandler,
)
from graphql_server.aiohttp import GraphQLView

from .graphql_example import schema


class RestService(AIOHTTPService):
Expand All @@ -21,8 +25,8 @@ class RestService(AIOHTTPService):
"""

def __init__(self, **kwargs):
#self.handler = RestHandler.from_config(**kwargs)
#super().__init__(**(kwargs | {"address": self.handler.host, "port": self.handler.port}))
# self.handler = RestHandler.from_config(**kwargs)
# super().__init__(**(kwargs | {"address": self.handler.host, "port": self.handler.port}))
super().__init__(**(kwargs | {"address": "localhost", "port": 7030}))

def _mount_graphql(self, app: web.Application):
Expand All @@ -37,5 +41,4 @@ async def create_application(self) -> web.Application:
# self._mount_routes(app)
self._mount_graphql(app)
return app
#return self.handler.get_app() # pragma: no cover

# return self.handler.get_app() # pragma: no cover